커뮤니티

문의 드립니다.

프로필 이미지
eiger
2020-10-05 23:51:45
888
글번호 142867
답변완료
안녕하세요. 아래에서 일목표 수익(200틱), 일손절(300틱) 추가해 주시고, 매수 진입후 청산시 매수 재진입은 하지 않고 매도 신호만 진입하고, 매도 진입후 청산시 매도 재진입은 하지 않고 매수 신호만 진입하도록 수정 부탁드립니다. // 매매시간 Input : starttime(90000),endtime(050000); Var : cond1(false),cond2(false); Var : Tcond(false); if (sdate != sdate[1] and stime >= starttime) or (sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then { Tcond = true; } if (sdate != sdate[1] and stime >= endtime) or (sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then { Tcond = false; } // 매매 Input : shortPeriod(12), longPeriod(26), ST(100), TP(100); Var : value(0); value = MACD(shortPeriod, longPeriod); # 매수/매도청산 If Tcond and CrossUP(value, 0) Then { Buy(); } # 매도/매수청산 If Tcond and CrossDown(value, 0) Then { Sell(); } //청산 If MarketPosition == 1 Then ExitLong("EB", AtStop, EntryPrice - ST*PriceScale); If MarketPosition == -1 then ExitShort("ES", AtStop, EntryPrice + ST*PriceScale); If MarketPosition == 1 Then Exitlong("XB", atlimit, EntryPrice + TP*PriceScale); If MarketPosition == -1 Then ExitShort("XS", atlimit, EntryPrice - TP*PriceScale); //종가청산 If (sdate != sdate[1] and stime >= endtime) or (sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then { if MarketPosition == 1 Then ExitLong("bx",AtMarket); if MarketPosition == -1 Then ExitShort("sx",AtMarket); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2020-10-06 13:56:26

안녕하세요 예스스탁입니다. // 매매시간 Input : starttime(90000),endtime(050000); Input : 당일수익틱수(80),당일손실틱수(80); Var : N1(0),dayPl(0),당일수익(0),당일손실(0),Xcond(false); Var : cond1(false),cond2(false); Var : Tcond(false),entry(0); if (sdate != sdate[1] and stime >= starttime) or (sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then { entry = 0; Tcond = true; Xcond = false; N1 = NetProfit; } if (sdate != sdate[1] and stime >= endtime) or (sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then { Tcond = false; } 당일수익 = PriceScale*당일수익틱수; 당일손실 = PriceScale*당일손실틱수; daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] then { if daypl >= 당일수익 or daypl <= -당일손실 Then Xcond = true; if (IsExitName("dbp",1) == true or IsExitName("dbl",1) == true or IsExitName("dsp",1) == true or IsExitName("dsl",1) == true) then Xcond = true; } if (MarketPosition != 0 and MarketPosition != MarketPosition[1]) or (MarketPosition == MarketPosition[1] and TotalTrades > TotalTrades[1]) Then entry = entry+1; // 매매 Input : shortPeriod(12), longPeriod(26), ST(100), TP(100); Var : value(0); value = MACD(shortPeriod, longPeriod); # 매수/매도청산 If Tcond and CrossUP(value, 0) and Xcond == false Then { if entry == 0 or (entry >= 1 and MarketPosition == 0 and MarketPosition(1) != 1) or (entry >= 1 and MarketPosition == -1) Then Buy(); } # 매도/매수청산 If Tcond and CrossDown(value, 0) and Xcond == false Then { if entry == 0 or (entry >= 1 and MarketPosition == 0 and MarketPosition(1) != -1) or (entry >= 1 and MarketPosition == 1) Then Sell(); } //청산 If MarketPosition == 1 Then ExitLong("EB", AtStop, EntryPrice - ST*PriceScale); If MarketPosition == -1 then ExitShort("ES", AtStop, EntryPrice + ST*PriceScale); If MarketPosition == 1 Then Exitlong("XB", atlimit, EntryPrice + TP*PriceScale); If MarketPosition == -1 Then ExitShort("XS", atlimit, EntryPrice - TP*PriceScale); //종가청산 If (sdate != sdate[1] and stime >= endtime) or (sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then { if MarketPosition == 1 Then ExitLong("bx",AtMarket); if MarketPosition == -1 Then ExitShort("sx",AtMarket); } if MarketPosition == 1 then{ ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts)); ExitLong("dbl",AtStop,EntryPrice-((당일손실+daypl)/CurrentContracts)); } if MarketPosition == -1 then{ ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts)); ExitShort("dsl",AtStop,EntryPrice+((당일손실+daypl)/CurrentContracts)); } 즐거운 하루되세요 > eiger 님이 쓴 글입니다. > 제목 : 문의 드립니다. > 안녕하세요. 아래에서 일목표 수익(200틱), 일손절(300틱) 추가해 주시고, 매수 진입후 청산시 매수 재진입은 하지 않고 매도 신호만 진입하고, 매도 진입후 청산시 매도 재진입은 하지 않고 매수 신호만 진입하도록 수정 부탁드립니다. // 매매시간 Input : starttime(90000),endtime(050000); Var : cond1(false),cond2(false); Var : Tcond(false); if (sdate != sdate[1] and stime >= starttime) or (sdate == sdate[1] and stime >= starttime and stime[1] < starttime) then { Tcond = true; } if (sdate != sdate[1] and stime >= endtime) or (sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then { Tcond = false; } // 매매 Input : shortPeriod(12), longPeriod(26), ST(100), TP(100); Var : value(0); value = MACD(shortPeriod, longPeriod); # 매수/매도청산 If Tcond and CrossUP(value, 0) Then { Buy(); } # 매도/매수청산 If Tcond and CrossDown(value, 0) Then { Sell(); } //청산 If MarketPosition == 1 Then ExitLong("EB", AtStop, EntryPrice - ST*PriceScale); If MarketPosition == -1 then ExitShort("ES", AtStop, EntryPrice + ST*PriceScale); If MarketPosition == 1 Then Exitlong("XB", atlimit, EntryPrice + TP*PriceScale); If MarketPosition == -1 Then ExitShort("XS", atlimit, EntryPrice - TP*PriceScale); //종가청산 If (sdate != sdate[1] and stime >= endtime) or (sdate == sdate[1] and stime >= endtime and stime[1] < endtime) then { if MarketPosition == 1 Then ExitLong("bx",AtMarket); if MarketPosition == -1 Then ExitShort("sx",AtMarket); }