커뮤니티
수식 부탁합니다
2017-04-17 21:00:48
206
글번호 108869
안녕하세요!
#,Input:per2(38.2)
var3 = dayclose(1)+abs(S3-S4)*(Per2/100);
var4 = dayclose(1)-abs(S3-S4)*(Per2/100);
를 아래수식에 추가하면 좋겠습니다 (매매시간15:00~익일03:00,다른조건은 동일)
#,언제나 수식완성에 도움주심을 늘 감사합니다.
------------------------- 아 래 ----------------------------------
input : Per1(18.2),시작시간(103000),종료시간(230000),당일최대진입횟수(7),x(2),x1(15);
Var : S1(0),S2(1),S3(1),S4(1),Tcond(false),T1(0),entry(0);
if 시작시간 == 0 and sdate != sdate[1] Then{
Tcond = true;
T1 = TotalTrades;
}
if 시작시간 > 0 and (stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간)) Then{
Tcond = true;
T1 = TotalTrades;
}
if 종료시간 == 0 and sdate != sdate[1] Then{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if 종료시간 > 0 and (stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간)) Then{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if MarketPosition == 0 Then
entry = TotalTrades -T1;
Else
entry = (TotalTrades -T1)+1;
S1 = (dayhigh(0)+daylow(0))/2;
S2 = (dayhigh(1)+daylow(1))/2;
S3 = dayhigh(1);
S4 = daylow(1);
var1 = dayclose(1)+abs(S3-S4)*(Per1/100);
var2 = dayclose(1)-abs(S3-S4)*(Per1/100);
if MarketPosition == 0 and Tcond == true and entry < 당일최대진입횟수 Then{
if NextBarOpen <= var2 Then
buy("b1",AtStop,var2,2);
Else
buy("b2",Atlimit,var2,2);
if NextBarOpen >= var1 Then
sell("s1",AtStop,var1,2);
Else
sell("s2",Atlimit,var1,2);
}
if MarketPosition == 0 and Tcond == true and entry >= 1 and entry < 3 and (IsExitName("bx",1) or IsExitName("sx",1)) Then{
if NextBarOpen <= var2 Then
buy("b11",AtStop,var2,2);
Else
buy("b22",Atlimit,var2,2);
if NextBarOpen >= var1 Then
sell("s11",AtStop,var1,2);
Else
sell("s22",Atlimit,var1,2);
}
if MarketPosition == 1 Then{
if CurrentContracts == MaxContracts and highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*15 Then
exitlong("bx",AtStop,EntryPrice+x*PriceScale);
exitlong("bx1",atlimit,EntryPrice+PriceScale*27,"",1,1);
exitlong("bx2",atlimit,var1,"",1,1);
if CurrentContracts < MaxContracts Then
exitlong("bx3",AtStop,EntryPrice+x1*PriceScale,"",1,1);
}
if MarketPosition == -1 Then{
if CurrentContracts == MaxContracts and Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*15 Then
ExitShort("sx",AtStop,EntryPrice-x*PriceScale);
ExitShort("sx1",atlimit,EntryPrice-PriceScale*27,"",1,1);
ExitShort("sx2",atlimit,var2,"",1,1);
if CurrentContracts < MaxContracts Then
ExitShort("sx3",AtStop,EntryPrice-x1*PriceScale,"",1,1);
}
SetStopLoss(PriceScale*15,PointStop);
답변 1
예스스탁 예스스탁 답변
2017-04-18 16:52:49
안녕하세요
예스스탁입니다.
input : Per1(18.2),시작시간(103000),종료시간(230000),당일최대진입횟수(7),x(2),x1(15);
input : Per2(38.2),시작시간1(150000),종료시간1(30000);
Var : S1(0),S2(1),S3(1),S4(1),Tcond(false),T1(0),entry(0),Tcond1(false);
if 시작시간 == 0 and sdate != sdate[1] Then{
Tcond = true;
T1 = TotalTrades;
}
if 시작시간 > 0 and (stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간)) Then{
Tcond = true;
T1 = TotalTrades;
}
if 종료시간 == 0 and sdate != sdate[1] Then{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if 종료시간 > 0 and (stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간)) Then{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if 시작시간1 == 0 and sdate != sdate[1] Then{
Tcond1 = true;
}
if 시작시간1 > 0 and (stime == 시작시간1 or (stime > 시작시간1 and stime[1] < 시작시간1)) Then{
Tcond1 = true;
}
if 종료시간1 == 0 and sdate != sdate[1] Then{
Tcond1 = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if 종료시간1 > 0 and (stime == 종료시간1 or (stime > 종료시간1 and stime[1] < 종료시간1)) Then{
Tcond1 = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if MarketPosition == 0 Then
entry = TotalTrades -T1;
Else
entry = (TotalTrades -T1)+1;
S1 = (dayhigh(0)+daylow(0))/2;
S2 = (dayhigh(1)+daylow(1))/2;
S3 = dayhigh(1);
S4 = daylow(1);
var1 = dayclose(1)+abs(S3-S4)*(Per1/100);
var2 = dayclose(1)-abs(S3-S4)*(Per1/100);
var3 = dayclose(1)+abs(S3-S4)*(Per2/100);
var4 = dayclose(1)-abs(S3-S4)*(Per2/100);
if MarketPosition == 0 and Tcond == true and entry < 당일최대진입횟수 Then{
if NextBarOpen <= var2 Then
buy("b1",AtStop,var2,2);
Else
buy("b2",Atlimit,var2,2);
if NextBarOpen >= var1 Then
sell("s1",AtStop,var1,2);
Else
sell("s2",Atlimit,var1,2);
}
if MarketPosition == 0 and Tcond == true and entry >= 1 and entry < 3 and (IsExitName("bx",1) or IsExitName("sx",1)) Then{
if NextBarOpen <= var2 Then
buy("b11",AtStop,var2,2);
Else
buy("b22",Atlimit,var2,2);
if NextBarOpen >= var1 Then
sell("s11",AtStop,var1,2);
Else
sell("s22",Atlimit,var1,2);
}
if MarketPosition == 0 and Tcond1 == true and entry < 당일최대진입횟수 Then{
if NextBarOpen <= var4 Then
buy("b3",AtStop,var4,2);
Else
buy("b4",Atlimit,var4,2);
if NextBarOpen >= var3 Then
sell("s3",AtStop,var3,2);
Else
sell("s4",Atlimit,var3,2);
}
if MarketPosition == 0 and Tcond1 == true and entry >= 1 and entry < 3 and (IsExitName("bx",1) or IsExitName("sx",1)) Then{
if NextBarOpen <= var4 Then
buy("b33",AtStop,var4,2);
Else
buy("b44",Atlimit,var4,2);
if NextBarOpen >= var3 Then
sell("s33",AtStop,var3,2);
Else
sell("s44",Atlimit,var3,2);
}
if MarketPosition == 1 Then{
if CurrentContracts == MaxContracts and highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*15 Then
exitlong("bx",AtStop,EntryPrice+x*PriceScale);
exitlong("bx1",atlimit,EntryPrice+PriceScale*27,"",1,1);
exitlong("bx2",atlimit,var1,"",1,1);
if CurrentContracts < MaxContracts Then
exitlong("bx3",AtStop,EntryPrice+x1*PriceScale,"",1,1);
}
if MarketPosition == -1 Then{
if CurrentContracts == MaxContracts and Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*15 Then
ExitShort("sx",AtStop,EntryPrice-x*PriceScale);
ExitShort("sx1",atlimit,EntryPrice-PriceScale*27,"",1,1);
ExitShort("sx2",atlimit,var2,"",1,1);
if CurrentContracts < MaxContracts Then
ExitShort("sx3",AtStop,EntryPrice-x1*PriceScale,"",1,1);
}
SetStopLoss(PriceScale*15,PointStop);
즐거운 하루되세요
> 골든키 님이 쓴 글입니다.
> 제목 : 수식 부탁합니다
> 안녕하세요!
#,Input:per2(38.2)
var3 = dayclose(1)+abs(S3-S4)*(Per2/100);
var4 = dayclose(1)-abs(S3-S4)*(Per2/100);
를 아래수식에 추가하면 좋겠습니다 (매매시간15:00~익일03:00,다른조건은 동일)
#,언제나 수식완성에 도움주심을 늘 감사합니다.
------------------------- 아 래 ----------------------------------
input : Per1(18.2),시작시간(103000),종료시간(230000),당일최대진입횟수(7),x(2),x1(15);
Var : S1(0),S2(1),S3(1),S4(1),Tcond(false),T1(0),entry(0);
if 시작시간 == 0 and sdate != sdate[1] Then{
Tcond = true;
T1 = TotalTrades;
}
if 시작시간 > 0 and (stime == 시작시간 or (stime > 시작시간 and stime[1] < 시작시간)) Then{
Tcond = true;
T1 = TotalTrades;
}
if 종료시간 == 0 and sdate != sdate[1] Then{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if 종료시간 > 0 and (stime == 종료시간 or (stime > 종료시간 and stime[1] < 종료시간)) Then{
Tcond = false;
if MarketPosition == 1 Then
exitlong();
if MarketPosition == -1 Then
ExitShort();
}
if MarketPosition == 0 Then
entry = TotalTrades -T1;
Else
entry = (TotalTrades -T1)+1;
S1 = (dayhigh(0)+daylow(0))/2;
S2 = (dayhigh(1)+daylow(1))/2;
S3 = dayhigh(1);
S4 = daylow(1);
var1 = dayclose(1)+abs(S3-S4)*(Per1/100);
var2 = dayclose(1)-abs(S3-S4)*(Per1/100);
if MarketPosition == 0 and Tcond == true and entry < 당일최대진입횟수 Then{
if NextBarOpen <= var2 Then
buy("b1",AtStop,var2,2);
Else
buy("b2",Atlimit,var2,2);
if NextBarOpen >= var1 Then
sell("s1",AtStop,var1,2);
Else
sell("s2",Atlimit,var1,2);
}
if MarketPosition == 0 and Tcond == true and entry >= 1 and entry < 3 and (IsExitName("bx",1) or IsExitName("sx",1)) Then{
if NextBarOpen <= var2 Then
buy("b11",AtStop,var2,2);
Else
buy("b22",Atlimit,var2,2);
if NextBarOpen >= var1 Then
sell("s11",AtStop,var1,2);
Else
sell("s22",Atlimit,var1,2);
}
if MarketPosition == 1 Then{
if CurrentContracts == MaxContracts and highest(H,BarsSinceEntry) >= EntryPrice+PriceScale*15 Then
exitlong("bx",AtStop,EntryPrice+x*PriceScale);
exitlong("bx1",atlimit,EntryPrice+PriceScale*27,"",1,1);
exitlong("bx2",atlimit,var1,"",1,1);
if CurrentContracts < MaxContracts Then
exitlong("bx3",AtStop,EntryPrice+x1*PriceScale,"",1,1);
}
if MarketPosition == -1 Then{
if CurrentContracts == MaxContracts and Lowest(L,BarsSinceEntry) <= EntryPrice-PriceScale*15 Then
ExitShort("sx",AtStop,EntryPrice-x*PriceScale);
ExitShort("sx1",atlimit,EntryPrice-PriceScale*27,"",1,1);
ExitShort("sx2",atlimit,var2,"",1,1);
if CurrentContracts < MaxContracts Then
ExitShort("sx3",AtStop,EntryPrice-x1*PriceScale,"",1,1);
}
SetStopLoss(PriceScale*15,PointStop);