커뮤니티

문의 드립니다.

프로필 이미지
푸른
2022-12-16 06:15:50
1341
글번호 164625
답변완료

첨부 이미지

input : StartTime(90000),EndTime(60000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } Inputs: VtyPercent(0.05),ATRperiod(5); If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); 그래프의 형광색 체결데이터는 있는데 잔고가 없습니다. 수식이 잘못된건지 문의 드리고 당일 목표수익 100틱후 매매정지를 추가로 부탁드립니다.
시스템
답변 5
프로필 이미지

예스스탁 예스스탁 답변

2022-12-16 15:10:49

안녕하세요 예스스탁입니다. 1 해당식은 당일청산식이고 당일 첫신호를 제외하면 모두 반대방향으로 스위칭되는 전략내용입니다. 장시작부터 실계좌가 무포지션인 상태에서 자동매매를 시작하고 발생한 주문에 대해 미체결이 없으면 현재 매수 25계약을 가지고 있어야 합니다. 주문거부나 미체결이 있으면 계좌수량과 차트상 수량이 다를수 있습니다. 만약 장시작부터 자동매매를 시작하지 않고 첫진입신호 이후에 중간에 시작하셨다면 해당식은 스위칭신호입니다. 청산과 진입이 동시에 발생하는데 중간에 스위칭신호부터 자동매매를 시작하고 해당 신호에 대해 모두 주문을 내면 매도진입신호발생시 매수포지션청산을 위해 매도25계약, 매도진입을 위해 25계약 총 50계약 매도가 나가고 다음 매수진입신호 발생시에 매도포지션 청산을 위해 매수25계약, 매수진입을 위해 25계약 총 50계약 매수가 나가므로 실제 계좌는 50계약 매도상태에서 50계약 매수가 발생하므로 청산되서 0이 됩니다. 이렇게 중간에서 시작할때는 시스템 트레이딩 설정창의 주문시작신호를 모든신호로 하고자 하시면 차트포지션에 맞게 수동주문으로 수량을 맞춰놓으신 상태에서 시작하셔야 하고 아니면 주문시작신호를 진입신호로 설정해서 시스템 적용 후 첫진입부터 주문이 나가게 하셔야 합니다. 물론 이경우에도 주문중에 주문거부나 미체결이 있으면 달라지게 됩니다. 2 현재 수식에서 한봉에 여러번 봉미완성시 진입/청산이 발생할수 있는데 봉미완성시에 발생하는 거래까지 포함해서 미완성시에 제어할 수 없습니다. 지정한 수익에 도달하면 진입을 하지 말라는 내용은 if문으로 작성해야 하는데 if문이 봉완성시를 기준으로 하기 때문입니다. 아래 제어내용을 추가해 드리지만 봉완성시로 다음진입을 막게 되므로 미완성시에 추가적으로 신호가 발생할 수 있습니다. 즉 봉왕성기준으로 조건을 체크하고 완성봉 기준으로 지정한 수익이상이면 추가적인 진입을 막고 청산만 수행하게 됩니다. 해당 청산에 의해 수익에 차이가 발생 할 수 있습니다. input : StartTime(90000),EndTime(60000); Input : 당일수익틱수(100); var : Tcond(false); Var : N1(0),dayPl(0),당일수익(0),Xcond(false); 당일수익 = PriceScale*당일수익틱수; IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; Xcond = false; N1 = NetProfit; IF Endtime <= starttime Then { SetStopEndofday(0); } } daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] then { if daypl >= 당일수익 Then Xcond = true; if IsExitName("dbp",1) == true or IsExitName("dsp",1) == true then Xcond = true; } Inputs: VtyPercent(0.05),ATRperiod(5); if xcond == False Then { If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); } if xcond == true Then { If MarketPosition() == 1 Then ExitLong ("bx", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then ExitShort("sx)",AtStop, Close - (VtyPercent * ATR(ATRperiod))); } if MarketPosition == 1 then { ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts)); } 즐거운 하루되세요 > 푸른 님이 쓴 글입니다. > 제목 : 문의 드립니다. > input : StartTime(90000),EndTime(60000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } Inputs: VtyPercent(0.05),ATRperiod(5); If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); 그래프의 형광색 체결데이터는 있는데 잔고가 없습니다. 수식이 잘못된건지 문의 드리고 당일 목표수익 100틱후 매매정지를 추가로 부탁드립니다.
프로필 이미지

푸른

2022-12-16 16:22:24

늘 감사드립니다. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 문의 드립니다. > 안녕하세요 예스스탁입니다. 1 해당식은 당일청산식이고 당일 첫신호를 제외하면 모두 반대방향으로 스위칭되는 전략내용입니다. 장시작부터 실계좌가 무포지션인 상태에서 자동매매를 시작하고 발생한 주문에 대해 미체결이 없으면 현재 매수 25계약을 가지고 있어야 합니다. 주문거부나 미체결이 있으면 계좌수량과 차트상 수량이 다를수 있습니다. 만약 장시작부터 자동매매를 시작하지 않고 첫진입신호 이후에 중간에 시작하셨다면 해당식은 스위칭신호입니다. 청산과 진입이 동시에 발생하는데 중간에 스위칭신호부터 자동매매를 시작하고 해당 신호에 대해 모두 주문을 내면 매도진입신호발생시 매수포지션청산을 위해 매도25계약, 매도진입을 위해 25계약 총 50계약 매도가 나가고 다음 매수진입신호 발생시에 매도포지션 청산을 위해 매수25계약, 매수진입을 위해 25계약 총 50계약 매수가 나가므로 실제 계좌는 50계약 매도상태에서 50계약 매수가 발생하므로 청산되서 0이 됩니다. 이렇게 중간에서 시작할때는 시스템 트레이딩 설정창의 주문시작신호를 모든신호로 하고자 하시면 차트포지션에 맞게 수동주문으로 수량을 맞춰놓으신 상태에서 시작하셔야 하고 아니면 주문시작신호를 진입신호로 설정해서 시스템 적용 후 첫진입부터 주문이 나가게 하셔야 합니다. 물론 이경우에도 주문중에 주문거부나 미체결이 있으면 달라지게 됩니다. 2 현재 수식에서 한봉에 여러번 봉미완성시 진입/청산이 발생할수 있는데 봉미완성시에 발생하는 거래까지 포함해서 미완성시에 제어할 수 없습니다. 지정한 수익에 도달하면 진입을 하지 말라는 내용은 if문으로 작성해야 하는데 if문이 봉완성시를 기준으로 하기 때문입니다. 아래 제어내용을 추가해 드리지만 봉완성시로 다음진입을 막게 되므로 미완성시에 추가적으로 신호가 발생할 수 있습니다. 즉 봉왕성기준으로 조건을 체크하고 완성봉 기준으로 지정한 수익이상이면 추가적인 진입을 막고 청산만 수행하게 됩니다. 해당 청산에 의해 수익에 차이가 발생 할 수 있습니다. input : StartTime(90000),EndTime(60000); Input : 당일수익틱수(100); var : Tcond(false); Var : N1(0),dayPl(0),당일수익(0),Xcond(false); 당일수익 = PriceScale*당일수익틱수; IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; Xcond = false; N1 = NetProfit; IF Endtime <= starttime Then { SetStopEndofday(0); } } daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] then { if daypl >= 당일수익 Then Xcond = true; if IsExitName("dbp",1) == true or IsExitName("dsp",1) == true then Xcond = true; } Inputs: VtyPercent(0.05),ATRperiod(5); if xcond == False Then { If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); } if xcond == true Then { If MarketPosition() == 1 Then ExitLong ("bx", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then ExitShort("sx)",AtStop, Close - (VtyPercent * ATR(ATRperiod))); } if MarketPosition == 1 then { ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts)); } 즐거운 하루되세요 > 푸른 님이 쓴 글입니다. > 제목 : 문의 드립니다. > input : StartTime(90000),EndTime(60000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } Inputs: VtyPercent(0.05),ATRperiod(5); If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); 그래프의 형광색 체결데이터는 있는데 잔고가 없습니다. 수식이 잘못된건지 문의 드리고 당일 목표수익 100틱후 매매정지를 추가로 부탁드립니다.
프로필 이미지

푸른

2022-12-16 20:44:54

볼바이 input : StartTime(140000),EndTime(40000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } Inputs: VtyPercent(0.04),ATRperiod(3); If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then ExitLong ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then ExitLong("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Buy ("Vty_LE2", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then ExitLong ("Vty_SE2)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Buy ("Vty_LE3", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then ExitLong ("Vty_SE3)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Buy ("Vty_LE4", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then ExitLong("Vty_SE4)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); 볼셀 input : StartTime(140000),EndTime(40000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } Inputs: VtyPercent(0.04),ATRperiod(3); If MarketPosition() <> 1 Then ExitShort ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then ExitShort ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then ExitShort ("Vty_LE2", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then Sell("Vty_SE2)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then ExitShort ("Vty_LE3", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Sell ("Vty_SE3)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then ExitShort ("Vty_LE4", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then Sell("Vty_SE4)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); > 푸른 님이 쓴 글입니다. > 제목 : Re : Re : 문의 드립니다. > 늘 감사드립니다. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 문의 드립니다. > 안녕하세요 예스스탁입니다. 1 해당식은 당일청산식이고 당일 첫신호를 제외하면 모두 반대방향으로 스위칭되는 전략내용입니다. 장시작부터 실계좌가 무포지션인 상태에서 자동매매를 시작하고 발생한 주문에 대해 미체결이 없으면 현재 매수 25계약을 가지고 있어야 합니다. 주문거부나 미체결이 있으면 계좌수량과 차트상 수량이 다를수 있습니다. 만약 장시작부터 자동매매를 시작하지 않고 첫진입신호 이후에 중간에 시작하셨다면 해당식은 스위칭신호입니다. 청산과 진입이 동시에 발생하는데 중간에 스위칭신호부터 자동매매를 시작하고 해당 신호에 대해 모두 주문을 내면 매도진입신호발생시 매수포지션청산을 위해 매도25계약, 매도진입을 위해 25계약 총 50계약 매도가 나가고 다음 매수진입신호 발생시에 매도포지션 청산을 위해 매수25계약, 매수진입을 위해 25계약 총 50계약 매수가 나가므로 실제 계좌는 50계약 매도상태에서 50계약 매수가 발생하므로 청산되서 0이 됩니다. 이렇게 중간에서 시작할때는 시스템 트레이딩 설정창의 주문시작신호를 모든신호로 하고자 하시면 차트포지션에 맞게 수동주문으로 수량을 맞춰놓으신 상태에서 시작하셔야 하고 아니면 주문시작신호를 진입신호로 설정해서 시스템 적용 후 첫진입부터 주문이 나가게 하셔야 합니다. 물론 이경우에도 주문중에 주문거부나 미체결이 있으면 달라지게 됩니다. 2 현재 수식에서 한봉에 여러번 봉미완성시 진입/청산이 발생할수 있는데 봉미완성시에 발생하는 거래까지 포함해서 미완성시에 제어할 수 없습니다. 지정한 수익에 도달하면 진입을 하지 말라는 내용은 if문으로 작성해야 하는데 if문이 봉완성시를 기준으로 하기 때문입니다. 아래 제어내용을 추가해 드리지만 봉완성시로 다음진입을 막게 되므로 미완성시에 추가적으로 신호가 발생할 수 있습니다. 즉 봉왕성기준으로 조건을 체크하고 완성봉 기준으로 지정한 수익이상이면 추가적인 진입을 막고 청산만 수행하게 됩니다. 해당 청산에 의해 수익에 차이가 발생 할 수 있습니다. input : StartTime(90000),EndTime(60000); Input : 당일수익틱수(100); var : Tcond(false); Var : N1(0),dayPl(0),당일수익(0),Xcond(false); 당일수익 = PriceScale*당일수익틱수; IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; Xcond = false; N1 = NetProfit; IF Endtime <= starttime Then { SetStopEndofday(0); } } daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] then { if daypl >= 당일수익 Then Xcond = true; if IsExitName("dbp",1) == true or IsExitName("dsp",1) == true then Xcond = true; } Inputs: VtyPercent(0.05),ATRperiod(5); if xcond == False Then { If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); } if xcond == true Then { If MarketPosition() == 1 Then ExitLong ("bx", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then ExitShort("sx)",AtStop, Close - (VtyPercent * ATR(ATRperiod))); } if MarketPosition == 1 then { ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts)); } 즐거운 하루되세요 > 푸른 님이 쓴 글입니다. > 제목 : 문의 드립니다. > input : StartTime(90000),EndTime(60000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } Inputs: VtyPercent(0.05),ATRperiod(5); If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); 그래프의 형광색 체결데이터는 있는데 잔고가 없습니다. 수식이 잘못된건지 문의 드리고 당일 목표수익 100틱후 매매정지를 추가로 부탁드립니다.
프로필 이미지

푸른

2022-12-19 23:05:14

input:length(5),a틱(20),b틱(20),c틱(5); Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),Text1(0),process(0),T(0); Array:HH[10,2](0),LL[10,2](0); input : StartTime(100000),EndTime(60000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } process = 0; If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then { If LL[1,1] > L Then process = -1; If HH[1,1] < H Then process = 1; } Else If Highest(H,length) == H and lastHiVal <> H Then process = 1; Else If Lowest(L,length) == L and lastLoVal <> L Then process = -1; If process == 1 Then { T = 1; lastHiVal = H; If HH[1,2] < LL[1,2] Then { For j = 10 DownTo 2 { HH[j,1] = HH[j-1,1]; HH[j,2] = HH[j-1,2]; } } If HH[1,2] < LL[1,2] or HH[1,1] < H Then { HH[1,1] = H; HH[1,2] = Index; sBar = Index - LL[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); } if LL[1,1] > 0 Then { TL1 = TL_New(sDate[sBar],sTime[sBar],LL[1,1],sDate[eBar],sTime[eBar],HH[1,1]); Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 1); } Else { Text_Delete(text1); Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,2)); Text_SetStyle(Text1, 2, 1); } Text_SetStyle(Text1, 2, 1); } if MarketPosition <= 0 and HH[2,1] >= LL[2,1]+PriceScale*a틱 and LL[1,1] <= HH[2,1]-PriceScale*b틱 and Tcond == true Then Buy("b",AtStop,HH[2,1]+PriceScale*c틱); } If process == -1 Then { T = -1; lastLoVal = L; If LL[1,2] < HH[1,2] Then { For j = 10 DownTo 2 { LL[j,1] = LL[j-1,1]; LL[j,2] = LL[j-1,2]; } } If LL[1,2] < HH[1,2] or LL[1,1] > L Then { LL[1,1] = L; LL[1,2] = Index; sBar = Index - HH[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); } if HH[1,1] > 0 Then { TL1 = TL_New(sDate[sBar],sTime[sBar],HH[1,1],sDate[eBar],sTime[eBar],LL[1,1]); Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 0); } Else { Text_Delete(text1); Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 0); } } if MarketPosition >= 0 and LL[2,1] <= HH[2,1]-PriceScale*a틱 and HH[1,1] >= LL[2,1]+PriceScale*b틱 and Tcond == true Then Sell("s",AtStop,LL[2,1]-PriceScale*c틱); } if MarketPosition == 1 and IsEntryName("b") == true Then Sell("bs",AtStop,EntryPrice-PriceScale*15); if MarketPosition == -1 and IsEntryName("s") == true Then Buy("sb",AtStop,EntryPrice+PriceScale*15); > 푸른 님이 쓴 글입니다. > 제목 : Re : Re : Re : 볼바이,셀 > 볼바이 input : StartTime(140000),EndTime(40000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } Inputs: VtyPercent(0.04),ATRperiod(3); If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then ExitLong ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then ExitLong("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Buy ("Vty_LE2", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then ExitLong ("Vty_SE2)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Buy ("Vty_LE3", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then ExitLong ("Vty_SE3)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Buy ("Vty_LE4", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then ExitLong("Vty_SE4)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); 볼셀 input : StartTime(140000),EndTime(40000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } Inputs: VtyPercent(0.04),ATRperiod(3); If MarketPosition() <> 1 Then ExitShort ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then ExitShort ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then ExitShort ("Vty_LE2", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then Sell("Vty_SE2)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then ExitShort ("Vty_LE3", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Sell ("Vty_SE3)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then ExitShort ("Vty_LE4", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then Sell("Vty_SE4)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); ----------------------------------------------------- > 푸른 님이 쓴 글입니다. > 제목 : Re : Re : 문의 드립니다. > 늘 감사드립니다. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 문의 드립니다. > 안녕하세요 예스스탁입니다. 1 해당식은 당일청산식이고 당일 첫신호를 제외하면 모두 반대방향으로 스위칭되는 전략내용입니다. 장시작부터 실계좌가 무포지션인 상태에서 자동매매를 시작하고 발생한 주문에 대해 미체결이 없으면 현재 매수 25계약을 가지고 있어야 합니다. 주문거부나 미체결이 있으면 계좌수량과 차트상 수량이 다를수 있습니다. 만약 장시작부터 자동매매를 시작하지 않고 첫진입신호 이후에 중간에 시작하셨다면 해당식은 스위칭신호입니다. 청산과 진입이 동시에 발생하는데 중간에 스위칭신호부터 자동매매를 시작하고 해당 신호에 대해 모두 주문을 내면 매도진입신호발생시 매수포지션청산을 위해 매도25계약, 매도진입을 위해 25계약 총 50계약 매도가 나가고 다음 매수진입신호 발생시에 매도포지션 청산을 위해 매수25계약, 매수진입을 위해 25계약 총 50계약 매수가 나가므로 실제 계좌는 50계약 매도상태에서 50계약 매수가 발생하므로 청산되서 0이 됩니다. 이렇게 중간에서 시작할때는 시스템 트레이딩 설정창의 주문시작신호를 모든신호로 하고자 하시면 차트포지션에 맞게 수동주문으로 수량을 맞춰놓으신 상태에서 시작하셔야 하고 아니면 주문시작신호를 진입신호로 설정해서 시스템 적용 후 첫진입부터 주문이 나가게 하셔야 합니다. 물론 이경우에도 주문중에 주문거부나 미체결이 있으면 달라지게 됩니다. 2 현재 수식에서 한봉에 여러번 봉미완성시 진입/청산이 발생할수 있는데 봉미완성시에 발생하는 거래까지 포함해서 미완성시에 제어할 수 없습니다. 지정한 수익에 도달하면 진입을 하지 말라는 내용은 if문으로 작성해야 하는데 if문이 봉완성시를 기준으로 하기 때문입니다. 아래 제어내용을 추가해 드리지만 봉완성시로 다음진입을 막게 되므로 미완성시에 추가적으로 신호가 발생할 수 있습니다. 즉 봉왕성기준으로 조건을 체크하고 완성봉 기준으로 지정한 수익이상이면 추가적인 진입을 막고 청산만 수행하게 됩니다. 해당 청산에 의해 수익에 차이가 발생 할 수 있습니다. input : StartTime(90000),EndTime(60000); Input : 당일수익틱수(100); var : Tcond(false); Var : N1(0),dayPl(0),당일수익(0),Xcond(false); 당일수익 = PriceScale*당일수익틱수; IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; Xcond = false; N1 = NetProfit; IF Endtime <= starttime Then { SetStopEndofday(0); } } daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] then { if daypl >= 당일수익 Then Xcond = true; if IsExitName("dbp",1) == true or IsExitName("dsp",1) == true then Xcond = true; } Inputs: VtyPercent(0.05),ATRperiod(5); if xcond == False Then { If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); } if xcond == true Then { If MarketPosition() == 1 Then ExitLong ("bx", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then ExitShort("sx)",AtStop, Close - (VtyPercent * ATR(ATRperiod))); } if MarketPosition == 1 then { ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts)); } 즐거운 하루되세요 > 푸른 님이 쓴 글입니다. > 제목 : 문의 드립니다. > input : StartTime(90000),EndTime(60000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } Inputs: VtyPercent(0.05),ATRperiod(5); If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); 그래프의 형광색 체결데이터는 있는데 잔고가 없습니다. 수식이 잘못된건지 문의 드리고 당일 목표수익 100틱후 매매정지를 추가로 부탁드립니다.
프로필 이미지

푸른

2022-12-21 08:22:21

input : StartTime(200000),EndTime(40000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } Inputs: VtyPercent(0.04),ATRperiod(3); If MarketPosition() <> 1 Then ExitShort ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then ExitShort ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then ExitShort ("Vty_LE2", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then Sell("Vty_SE2)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then ExitShort ("Vty_LE3", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Sell ("Vty_SE3)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then ExitShort ("Vty_LE4", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then Sell("Vty_SE4)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); input : StartTime(200000),EndTime(40000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } Inputs: VtyPercent(0.04),ATRperiod(3); If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then ExitLong ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then ExitLong("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Buy ("Vty_LE2", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then ExitLong ("Vty_SE2)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Buy ("Vty_LE3", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then ExitLong ("Vty_SE3)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Buy ("Vty_LE4", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then ExitLong("Vty_SE4)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); 안녕하세요 예스스탁입니다. input : N(3),N1(30),T1(10),T2(50); var : cnt(0),loss1(0); #최근 N개 거래에서 #s1매도진입후 손실난 횟수 loss1 = 0; for cnt = 1 to N { if IsEntryName("s1",cnt) == true and PositionProfit(cnt) < 0 Then loss1 = loss1+1; } # N봉연속 양봉이고 고가가 저가대비 T1틱이상이고 # 연속양봉의 첫봉저가보가 마지막봉 고가는 T2틱 이상이면 # 매도 if CountIf(C>O and H >= L+PriceScale*T1,N) == N and H >= L[n-1]+PriceScale*T2 Then Sell("s1"); #장시작후 n봉이후에 #3연속 음봉이고 #연속음봉 첫봉의 고가와 마지막음봉 저가가 차이가 n1틱이상이면 #매수 if Bdate == Bdate[n-1] and CountIf(C<O,3) == 3 and H[n-1] >= L+PriceScale*n1 Then Buy("b1"); 즐거운 하루되세요 > 예스요 님이 쓴 글입니다. > 제목 : 문의 드립니다.~~~~ > 수고하십니다. 다음식의 자세한 주석 부탁드립니다. input : N(3),N1(30),T1(10),T2(50); var : cnt(0),loss1(0); loss1 = 0; for cnt = 1 to N { if IsEntryName("s1",cnt) == true and PositionProfit(cnt) < 0 Then loss1 = loss1+1; } if CountIf(C>O and H >= L+PriceScale*T1,N) == N and H >= L[n-1]+PriceScale*T2 Then Sell("s1"); if Bdate == Bdate[n-1] and CountIf(C<O,3) == 3 and H[n-1] >= L+PriceScale*n1 Then Buy("b1") -------------------- > 푸른 님이 쓴 글입니다. > 제목 : Re : Re : Re : Re : 반대포지션 > input:length(5),a틱(20),b틱(20),c틱(5); Var:j(0),lastHiVal(0),lastLoVal(0),sBar(0),eBar(0),TL1(0),Text1(0),process(0),T(0); Array:HH[10,2](0),LL[10,2](0); input : StartTime(100000),EndTime(60000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } process = 0; If Highest(H,length) == H and lastHiVal <> H and Lowest(L,length) == L and lastLoVal <> L Then { If LL[1,1] > L Then process = -1; If HH[1,1] < H Then process = 1; } Else If Highest(H,length) == H and lastHiVal <> H Then process = 1; Else If Lowest(L,length) == L and lastLoVal <> L Then process = -1; If process == 1 Then { T = 1; lastHiVal = H; If HH[1,2] < LL[1,2] Then { For j = 10 DownTo 2 { HH[j,1] = HH[j-1,1]; HH[j,2] = HH[j-1,2]; } } If HH[1,2] < LL[1,2] or HH[1,1] < H Then { HH[1,1] = H; HH[1,2] = Index; sBar = Index - LL[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); } if LL[1,1] > 0 Then { TL1 = TL_New(sDate[sBar],sTime[sBar],LL[1,1],sDate[eBar],sTime[eBar],HH[1,1]); Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 1); } Else { Text_Delete(text1); Text1 = Text_New(sDate[eBar],sTime[eBar],HH[1,1],"+"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,2)); Text_SetStyle(Text1, 2, 1); } Text_SetStyle(Text1, 2, 1); } if MarketPosition <= 0 and HH[2,1] >= LL[2,1]+PriceScale*a틱 and LL[1,1] <= HH[2,1]-PriceScale*b틱 and Tcond == true Then Buy("b",AtStop,HH[2,1]+PriceScale*c틱); } If process == -1 Then { T = -1; lastLoVal = L; If LL[1,2] < HH[1,2] Then { For j = 10 DownTo 2 { LL[j,1] = LL[j-1,1]; LL[j,2] = LL[j-1,2]; } } If LL[1,2] < HH[1,2] or LL[1,1] > L Then { LL[1,1] = L; LL[1,2] = Index; sBar = Index - HH[1,2]; eBar = 0; If TL_GetBeginDate(TL1) == sDate[sBar] and TL_GetBeginTime(TL1) == sTime[sBar] Then { TL_Delete(TL1); Text_Delete(Text1); } if HH[1,1] > 0 Then { TL1 = TL_New(sDate[sBar],sTime[sBar],HH[1,1],sDate[eBar],sTime[eBar],LL[1,1]); Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 0); } Else { Text_Delete(text1); Text1 = Text_New(sDate[eBar],sTime[eBar],LL[1,1],"-"+NumToStr(abs(HH[1,1]-LL[1,1])/PriceScale,0)); Text_SetStyle(Text1, 2, 0); } } if MarketPosition >= 0 and LL[2,1] <= HH[2,1]-PriceScale*a틱 and HH[1,1] >= LL[2,1]+PriceScale*b틱 and Tcond == true Then Sell("s",AtStop,LL[2,1]-PriceScale*c틱); } if MarketPosition == 1 and IsEntryName("b") == true Then Sell("bs",AtStop,EntryPrice-PriceScale*15); if MarketPosition == -1 and IsEntryName("s") == true Then Buy("sb",AtStop,EntryPrice+PriceScale*15); > 푸른 님이 쓴 글입니다. > 제목 : Re : Re : Re : 볼바이,셀 > 볼바이 input : StartTime(140000),EndTime(40000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } Inputs: VtyPercent(0.04),ATRperiod(3); If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then ExitLong ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then ExitLong("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Buy ("Vty_LE2", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then ExitLong ("Vty_SE2)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Buy ("Vty_LE3", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then ExitLong ("Vty_SE3)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Buy ("Vty_LE4", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then ExitLong("Vty_SE4)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); 볼셀 input : StartTime(140000),EndTime(40000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } Inputs: VtyPercent(0.04),ATRperiod(3); If MarketPosition() <> 1 Then ExitShort ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then ExitShort ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then ExitShort ("Vty_LE2", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then Sell("Vty_SE2)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then ExitShort ("Vty_LE3", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Sell ("Vty_SE3)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then ExitShort ("Vty_LE4", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> 1 Then Sell("Vty_SE4)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); ----------------------------------------------------- > 푸른 님이 쓴 글입니다. > 제목 : Re : Re : 문의 드립니다. > 늘 감사드립니다. > 예스스탁 님이 쓴 글입니다. > 제목 : Re : 문의 드립니다. > 안녕하세요 예스스탁입니다. 1 해당식은 당일청산식이고 당일 첫신호를 제외하면 모두 반대방향으로 스위칭되는 전략내용입니다. 장시작부터 실계좌가 무포지션인 상태에서 자동매매를 시작하고 발생한 주문에 대해 미체결이 없으면 현재 매수 25계약을 가지고 있어야 합니다. 주문거부나 미체결이 있으면 계좌수량과 차트상 수량이 다를수 있습니다. 만약 장시작부터 자동매매를 시작하지 않고 첫진입신호 이후에 중간에 시작하셨다면 해당식은 스위칭신호입니다. 청산과 진입이 동시에 발생하는데 중간에 스위칭신호부터 자동매매를 시작하고 해당 신호에 대해 모두 주문을 내면 매도진입신호발생시 매수포지션청산을 위해 매도25계약, 매도진입을 위해 25계약 총 50계약 매도가 나가고 다음 매수진입신호 발생시에 매도포지션 청산을 위해 매수25계약, 매수진입을 위해 25계약 총 50계약 매수가 나가므로 실제 계좌는 50계약 매도상태에서 50계약 매수가 발생하므로 청산되서 0이 됩니다. 이렇게 중간에서 시작할때는 시스템 트레이딩 설정창의 주문시작신호를 모든신호로 하고자 하시면 차트포지션에 맞게 수동주문으로 수량을 맞춰놓으신 상태에서 시작하셔야 하고 아니면 주문시작신호를 진입신호로 설정해서 시스템 적용 후 첫진입부터 주문이 나가게 하셔야 합니다. 물론 이경우에도 주문중에 주문거부나 미체결이 있으면 달라지게 됩니다. 2 현재 수식에서 한봉에 여러번 봉미완성시 진입/청산이 발생할수 있는데 봉미완성시에 발생하는 거래까지 포함해서 미완성시에 제어할 수 없습니다. 지정한 수익에 도달하면 진입을 하지 말라는 내용은 if문으로 작성해야 하는데 if문이 봉완성시를 기준으로 하기 때문입니다. 아래 제어내용을 추가해 드리지만 봉완성시로 다음진입을 막게 되므로 미완성시에 추가적으로 신호가 발생할 수 있습니다. 즉 봉왕성기준으로 조건을 체크하고 완성봉 기준으로 지정한 수익이상이면 추가적인 진입을 막고 청산만 수행하게 됩니다. 해당 청산에 의해 수익에 차이가 발생 할 수 있습니다. input : StartTime(90000),EndTime(60000); Input : 당일수익틱수(100); var : Tcond(false); Var : N1(0),dayPl(0),당일수익(0),Xcond(false); 당일수익 = PriceScale*당일수익틱수; IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; Xcond = false; N1 = NetProfit; IF Endtime <= starttime Then { SetStopEndofday(0); } } daypl = NetProfit-N1; if TotalTrades > TotalTrades[1] then { if daypl >= 당일수익 Then Xcond = true; if IsExitName("dbp",1) == true or IsExitName("dsp",1) == true then Xcond = true; } Inputs: VtyPercent(0.05),ATRperiod(5); if xcond == False Then { If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); } if xcond == true Then { If MarketPosition() == 1 Then ExitLong ("bx", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then ExitShort("sx)",AtStop, Close - (VtyPercent * ATR(ATRperiod))); } if MarketPosition == 1 then { ExitLong("dbp",atlimit,EntryPrice+((당일수익-daypl)/CurrentContracts)); } if MarketPosition == -1 then { ExitShort("dsp",atlimit,EntryPrice-((당일수익-daypl)/CurrentContracts)); } 즐거운 하루되세요 > 푸른 님이 쓴 글입니다. > 제목 : 문의 드립니다. > input : StartTime(90000),EndTime(60000); var : Tcond(false); IF Endtime > starttime Then SetStopEndofday(Endtime); Else { if sDate != sDate[1] Then SetStopEndofday(Endtime); } 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; IF Endtime <= starttime Then { SetStopEndofday(0); } } Inputs: VtyPercent(0.05),ATRperiod(5); If MarketPosition() <> 1 Then Buy ("Vty_LE", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() <> -1 Then Sell ("Vty_SE)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); If MarketPosition() == 1 Then Buy ("Vty_LE1", AtStop, Close + (VtyPercent * ATR(ATRperiod))); If MarketPosition() == -1 Then Sell ("Vty_SE1)", AtStop, Close - (VtyPercent * ATR(ATRperiod))); 그래프의 형광색 체결데이터는 있는데 잔고가 없습니다. 수식이 잘못된건지 문의 드리고 당일 목표수익 100틱후 매매정지를 추가로 부탁드립니다.