예스스탁
예스스탁 답변
2024-05-27 14:20:24
안녕하세요
예스스탁입니다.
1번식과 2번식의 첫진입이 모두 무포지션에서 진입하므로
첫 진입의이름을 기준으로
나머지 동작하게 하시면 됩니다.
if MarketPosition <= 0 Then
{
if 조건수식1 Then
{
if CurrentContracts < 1 Then
buy("매수1",OnClose,def,1);
}
if 조건수식1 Then
{
if CurrentContracts < 1 Then
buy("매수11",OnClose,def,1);
}
}
if MarketPosition == 1 Then
{
if IsEntryName("매수1") == true Then
{
if 조건수식3 Then
{
if CurrentContracts < 1 Then
buy("수1",OnClose,def,1);
}
Else
{
if 조건수식4 and CurrentContracts < 2 Then
buy("수2",OnClose,def,1);
}
if 조건수식1 Then
{
exitlong("청산1",OnClose,def,"매수1");
}
Else
{
if 조건수식1-2 Then
exitlong("청산1-1",OnClose,def,"매수1");
}
if 조건수식2 Then
{
exitlong("청산2",OnClose,def,"수1");
}
Else
{
if 조건수식2-1 Then
exitlong("청산2-1",OnClose,def,"수1");
}
if 조건수식4 Then
{
exitlong("청산4",OnClose,def,"수2");
}
Else
{
if 조건수식4-1 Then
exitlong("청산4-1",OnClose,def,"수2");
}
ExitLong("bp1",atlimit,AvgEntryPrice+PriceScale*익절틱수1,"매수1");
ExitLong("bl1",AtStop,AvgEntryPrice-PriceScale*손절틱수1,"매수1");
ExitLong("bp2",atlimit,AvgEntryPrice+PriceScale*익절틱수2,"수1");
ExitLong("bl2",AtStop,AvgEntryPrice-PriceScale*손절틱수2,"수1");
ExitLong("bp4",atlimit,AvgEntryPrice+PriceScale*익절틱수4,"수2");
ExitLong("bl4",AtStop,AvgEntryPrice-PriceScale*손절틱수4,"수2");
}
if IsEntryName("매수11") == true Then
{
if 조건수식3 Then
{
if CurrentContracts < 1 Then
buy("수11",OnClose,def,1);
}
Else
{
if 조건수식4 and CurrentContracts < 2 Then
buy("수12",OnClose,def,1);
}
if 조건수식1 Then
{
exitlong("청산11",OnClose,def,"매수11");
}
Else
{
if 조건수식1-2 Then
exitlong("청산11-1",OnClose,def,"매수11");
}
if 조건수식2 Then
{
exitlong("청산12",OnClose,def,"수11");
}
Else
{
if 조건수식2-1 Then
exitlong("청산12-1",OnClose,def,"수11");
}
if 조건수식4 Then
{
exitlong("청산14",OnClose,def,"수12");
}
Else
{
if 조건수식4-1 Then
exitlong("청산14-1",OnClose,def,"수12");
}
ExitLong("bp11",atlimit,AvgEntryPrice+PriceScale*익절틱수1,"매수11");
ExitLong("bl11",AtStop,AvgEntryPrice-PriceScale*손절틱수1,"매수11");
ExitLong("bp12",atlimit,AvgEntryPrice+PriceScale*익절틱수2,"수11");
ExitLong("bl12",AtStop,AvgEntryPrice-PriceScale*손절틱수2,"수11");
ExitLong("bp14",atlimit,AvgEntryPrice+PriceScale*익절틱수4,"수12");
ExitLong("bl14",AtStop,AvgEntryPrice-PriceScale*손절틱수4,"수12");
}
}
즐거운 하루되세요
> 남산 님이 쓴 글입니다.
> 제목 : 문의드립니다
>
1번 수식
if MarketPosition <= 0 Then
{
if 조건수식1 Then
{
if CurrentContracts < 1 Then
buy("매수1",OnClose,def,1);
}
}
if MarketPosition == 1 Then
{
if 조건수식3 Then
{
if CurrentContracts < 1 Then
buy("수1",OnClose,def,1);
}
Else
{
if 조건수식4 and CurrentContracts < 2 Then
buy("수2",OnClose,def,1);
}
}
if MarketPosition == 1 Then
{
if 조건수식1 Then
{
exitlong("청산1",OnClose,def,"매수1");
}
Else
{
if 조건수식1-2 Then
exitlong("청산1-1",OnClose,def,"매수1");
}
if 조건수식2 Then
{
exitlong("청산2",OnClose,def,"수1");
}
Else
{
if 조건수식2-1 Then
exitlong("청산2-1",OnClose,def,"수1");
}
if 조건수식4 Then
{
exitlong("청산4",OnClose,def,"수2");
}
Else
{
if 조건수식4-1 Then
exitlong("청산4-1",OnClose,def,"수2");
}
ExitLong("bp1",atlimit,AvgEntryPrice+PriceScale*익절틱수1,"매수1");
ExitLong("bl1",AtStop,AvgEntryPrice-PriceScale*손절틱수1,"매수1");
ExitLong("bp2",atlimit,AvgEntryPrice+PriceScale*익절틱수2,"수1");
ExitLong("bl2",AtStop,AvgEntryPrice-PriceScale*손절틱수2,"수1");
ExitLong("bp4",atlimit,AvgEntryPrice+PriceScale*익절틱수4,"수2");
ExitLong("bl4",AtStop,AvgEntryPrice-PriceScale*손절틱수4,"수2");
}
2번 수식
if MarketPosition <= 0 Then
{
if 조건수식1 Then
{
if CurrentContracts < 1 Then
buy("매수11",OnClose,def,1);
}
}
if MarketPosition == 1 Then
{
if 조건수식3 Then
{
if CurrentContracts < 1 Then
buy("수11",OnClose,def,1);
}
Else
{
if 조건수식4 and CurrentContracts < 2 Then
buy("수12",OnClose,def,1);
}
}
if MarketPosition == 1 Then
{
if 조건수식1 Then
{
exitlong("청산1",OnClose,def,"매수11");
}
Else
{
if 조건수식1-2 Then
exitlong("청산1-1",OnClose,def,"매수11");
}
if 조건수식2 Then
{
exitlong("청산2",OnClose,def,"수11");
}
Else
{
if 조건수식2-1 Then
exitlong("청산2-1",OnClose,def,"수11");
}
if 조건수식4 Then
{
exitlong("청산4",OnClose,def,"수12");
}
Else
{
if 조건수식4-1 Then
exitlong("청산4-1",OnClose,def,"수12");
}
ExitLong("bp1",atlimit,AvgEntryPrice+PriceScale*익절틱수1,"매수11");
ExitLong("bl1",AtStop,AvgEntryPrice-PriceScale*손절틱수1,"매수11");
ExitLong("bp2",atlimit,AvgEntryPrice+PriceScale*익절틱수2,"수11");
ExitLong("bl2",AtStop,AvgEntryPrice-PriceScale*손절틱수2,"수11");
ExitLong("bp4",atlimit,AvgEntryPrice+PriceScale*익절틱수4,"수12");
ExitLong("bl4",AtStop,AvgEntryPrice-PriceScale*손절틱수4,"수12");
}
1번 수식과 2번 수식을 1개 수식에 통합 운영하고자 할 때
즉
1번 조건만족 진입+추가진입+청산 운영
2번 조건만족 진입+추가진입+청산 운영
1번과 2번은 서로 별도로 운영하고자 할 때 수식을 어떻게 표기하나요
{
{
1번 수식
}
{
2번 수식
}
}
위와 같은 방법으로 사용할 수 있나요 어떤식으로 표기하여야 하는지 모르겠습니다.
1번 수식과 2번 수식을 이용하여 연결표기를 부탁합니다.
감사합니다.