커뮤니티

수식작성

프로필 이미지
푸른
2021-06-21 14:34:04
1693
글번호 150099
답변완료

첨부 이미지

input : StartTime(070000),EndTime(055000),Xtime(055500); var : Tcond(false),entry(0); var : B1(0),B2(0),BX1(0),BX2(0); var : S1(0),S2(0),SX1(0),SX2(0); var : B1entry(0),B2entry(0),S1entry(0),S2entry(0); if sdate != sDate[1] Then SetStopEndofday(Xtime); if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; SetStopEndofday(0); B1entry = 0; B2entry = 0; S1entry = 0; S2entry = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (CurrentContracts > CurrentContracts[1]) Then { if LatestEntryName(0) == "B1" Then b1entry = b1entry+1; if LatestEntryName(0) == "B2" Then b2entry = b2entry+1; if LatestEntryName(0) == "S1" Then s1entry = s1entry+1; if LatestEntryName(0) == "S2" Then s2entry = s2entry+1; } B1 = DayLow(1)+(DayHigh(1)-DayLow(1))*-0.118; B2 = DayLow(1)+(DayHigh(1)-DayLow(1))*-0.380; BX1 = DayLow(1)+(DayHigh(1)-DayLow(1))*1.000; BX2 = DayLow(1)+(DayHigh(1)-DayLow(1))*1.382; S1 = DayHigh(1)+(DayHigh(1)-DayLow(1))*-0.118; S2 = DayHigh(1)+(DayHigh(1)-DayLow(1))*-0.240; SX1 = DayLow(1)+(DayHigh(1)-DayLow(1))*-0.850; SX2 = DayLow(1)+(DayHigh(1)-DayLow(1))*-0.990; if Tcond == true Then { if (MarketPosition == 0 or (MarketPosition == 1 and MaxEntries == 1)) Then { if b1entry < 1 and L > B1 Then Buy("B1",AtLimit,B1); if b2entry < 1 and L > B2 Then Buy("B2",AtLimit,B2); } if MarketPosition == 1 Then { ExitLong("bx1",AtLimit,BX1,"B1"); ExitLong("bx2",AtLimit,BX2,"B2"); } if (MarketPosition == 0 or (MarketPosition == -1 and MaxEntries == 1)) Then { if s1entry < 1 and H < S1 Then Sell("S1",AtLimit,S1); if s2entry < 1 and H < S2 Then Sell("S2",AtLimit,S2); } if MarketPosition == -1 Then { ExitShort("sx1",AtLimit,SX1,"S1"); ExitShort("sx2",AtLimit,SX2,"S2"); } } SetStopProfittarget(PriceScale*150,PointStop); SetStopLoss(PriceScale*10,PointStop); ------------------------------------------------------ 늘 고맙습니다. 그래프에 당일 신호에 s1신호가 2회 뜸니다. 식에서 재진입 안되게 진입1회만 구현하고 싶습니다.
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2021-06-21 12:42:21

안녕하세요 예스스탁입니다. 각 진입별로 1회씩만 진입하게 작성해 드립니다. input : StartTime(070000),EndTime(055000),Xtime(055500); var : Tcond(false),entry(0); var : B1(0),B2(0),BX1(0),BX2(0); var : S1(0),S2(0),SX1(0),SX2(0); var : B1entry(0),B2entry(0),S1entry(0),S2entry(0); if sdate != sDate[1] Then SetStopEndofday(Xtime); if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; SetStopEndofday(0); B1entry = 0; B2entry = 0; S1entry = 0; S2entry = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (CurrentContracts > CurrentContracts[1]) Then { if LatestEntryName(0) == "B1" Then b1entry = b1entry+1; if LatestEntryName(0) == "B2" Then b2entry = b2entry+1; if LatestEntryName(0) == "S1" Then s1entry = s1entry+1; if LatestEntryName(0) == "S2" Then s2entry = s2entry+1; } B1 = DayLow(1)+(DayHigh(1)-DayLow(1))*-0.250; B2 = DayLow(1)+(DayHigh(1)-DayLow(1))*-0.500; BX1 = DayLow(1)+(DayHigh(1)-DayLow(1))*0.800; BX2 = DayLow(1)+(DayHigh(1)-DayLow(1))*0.990; S1 = DayHigh(1)+(DayHigh(1)-DayLow(1))*-0.660; S2 = DayHigh(1)+(DayHigh(1)-DayLow(1))*-4.382; SX1 = DayLow(1)+(DayHigh(1)-DayLow(1))*-0.150; SX2 = DayHigh(1); if Tcond == true Then { if (MarketPosition == 0 or (MarketPosition == 1 and MaxEntries == 1)) Then { if b1entry < 1 and L > B1 Then Buy("B1",AtLimit,B1); if b2entry < 1 and L > B2 Then Buy("B2",AtLimit,B2); } if MarketPosition == 1 Then { ExitLong("bx1",AtLimit,BX1,"B1"); ExitLong("bx2",AtLimit,BX2,"B2"); } if (MarketPosition == 0 or (MarketPosition == -1 and MaxEntries == 1)) Then { if s1entry < 1 and H < S1 Then Sell("S1",AtLimit,S1); if s2entry < 1 and H < S2 Then Sell("S2",AtLimit,S2); } if MarketPosition == -1 Then { ExitShort("sx1",AtLimit,SX1,"S1"); ExitShort("sx2",AtLimit,SX2,"S2"); } } SetStopProfittarget(PriceScale*150,PointStop); SetStopLoss(PriceScale*20,PointStop); 즐거운 하루되세요 > 푸른 님이 쓴 글입니다. > 제목 : 수식작성 > input : StartTime(070000),EndTime(055000),Xtime(055500); var : Tcond(false),entry(0); var : B1(0),B2(0),BX1(0),BX2(0); var : S1(0),S2(0),SX1(0),SX2(0); if sdate != sDate[1] Then SetStopEndofday(Xtime); if (sdate != sdate[1] and stime >= EndTime) or (sdate == sdate[1] and stime >= EndTime and stime[1] < EndTime) Then Tcond = False; if (sdate != sdate[1] and stime >= StartTime) or (sdate == sdate[1] and stime >= StartTime and stime[1] < StartTime) Then { Tcond = true; SetStopEndofday(0); entry = 0; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; B1 = DayLow(1)+(DayHigh(1)-DayLow(1))*-0.250; B2 = DayLow(1)+(DayHigh(1)-DayLow(1))*-0.500; BX1 = DayLow(1)+(DayHigh(1)-DayLow(1))*0.800; BX2 = DayLow(1)+(DayHigh(1)-DayLow(1))*0.990; S1 = DayHigh(1)+(DayHigh(1)-DayLow(1))*-0.660; S2 = DayHigh(1)+(DayHigh(1)-DayLow(1))*-4.382; SX1 = DayLow(1)+(DayHigh(1)-DayLow(1))*-0.150; SX2 = DayHigh(1); if Tcond == true Then { if (MarketPosition == 0 or (MarketPosition == 1 and MaxEntries == 1)) Then { if entry < 5 and L > B1 Then Buy("b1",AtLimit,B1); if entry < 5 and L > B2 Then Buy("b2",AtLimit,B2); } if MarketPosition == 1 Then { ExitLong("bx1",AtLimit,BX1,"B1"); ExitLong("bx2",AtLimit,BX2,"B2"); } if (MarketPosition == 0 or (MarketPosition == -1 and MaxEntries == 1)) Then { if entry < 5 and H < S1 Then Sell("S1",AtLimit,S1); if entry < 5 and H < S2 Then Sell("S2",AtLimit,S2); } if MarketPosition == -1 Then { ExitShort("sx1",AtLimit,SX1,"S1"); ExitShort("sx2",AtLimit,SX2,"S2"); } } SetStopProfittarget(PriceScale*150,PointStop); SetStopLoss(PriceScale*20,PointStop); ------------------------------------------------------ 늘 고맙습니다. 그래프에 당일 신호에 s1신호가 2회 뜸니다. 식에서 재진입 안되게 진입1회만 구현하고 싶습니다.