커뮤니티

목표수익 달성 또는 손실시 진입제한 수식 부탁합니다.

프로필 이미지
참새사냥꾼
2015-07-07 00:15:42
117
글번호 88062
답변완료
크루드 오일 거래시스템을 만들려고합니다. 거래시간은 아침9시부터 다음날 새벽2시까지이고요... 거래시간동안 누적수익이 20틱이상 발생하거나, 누적손실이 30틱 발생하면 진입을 중단시키고 싶습니다. 수식 수정 부탁드립니다. Input : shortPeriod(5), longPeriod(20), period(15); Input : 거래시간1(1), 시작시간1(090000), 끝시간1(020000); value1 = ma(C, shortPeriod); value2 = ma(C, longPeriod); value3 = ma(C, Period); Value4 = C/Value1*100; Value5 = PositionProfit; condition2 = IsExitName("stoploss",1); condition3 = 거래시간1==1 and (stime>=시작시간1 or stime<끝시간1); if condition3==true then { If condition2 == false then {IF 매수조건 Then Buy("매수"); } Else { IF BarsSinceExit(1) >= 3 and 매수조건 Then Buy("매수진입"); } IF BarsSinceEntry > 3 and 청산조건 Then ExitLong("매도"); } SetStopTrailing(0.1,0.35,PointStop); SetStopLoss(0.10,PointStop); # 새벽2시50에 모두 청산하고자 하시면 아래 내용도 추가하시면 됩니다. if stime == 025000 or (stime > 025000 and stime[1] < 025000) Then { exitlong(); }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2015-07-07 10:45:11

안녕하세요 예스스탁입니다. Input : shortPeriod(5), longPeriod(20), period(15); Input : 거래시간1(1), 시작시간1(090000), 끝시간1(020000); var : NP(0),preNP(0),dayPl(0); value1 = ma(C, shortPeriod); value2 = ma(C, longPeriod); value3 = ma(C, Period); Value4 = C/Value1*100; Value5 = PositionProfit; condition2 = IsExitName("stoploss",1); condition3 = 거래시간1==1 and (stime>=시작시간1 or stime<끝시간1); NP = NetProfit; if stime == 시작시간1 or (stime > 시작시간1 and stime[1] < 시작시간1) Then{ preNP = NP; } DayPl = NP-PreNP; if condition3==true then { If condition2 == false then {IF 매수조건 and (daypl < PriceScale*20 and daypl > -PriceScale*30) Then Buy("매수"); } Else { IF BarsSinceExit(1) >= 3 and 매수조건 and (daypl < PriceScale*20 and daypl > -PriceScale*30) Then Buy("매수진입"); } IF BarsSinceEntry > 3 and 청산조건 Then ExitLong("매도"); } SetStopTrailing(0.1,0.35,PointStop); SetStopLoss(0.10,PointStop); # 새벽2시50에 모두 청산하고자 하시면 아래 내용도 추가하시면 됩니다. if stime == 025000 or (stime > 025000 and stime[1] < 025000) Then { exitlong(); } 즐거운 하루되세요 > 참새사냥꾼 님이 쓴 글입니다. > 제목 : 목표수익 달성 또는 손실시 진입제한 수식 부탁합니다. > 크루드 오일 거래시스템을 만들려고합니다. 거래시간은 아침9시부터 다음날 새벽2시까지이고요... 거래시간동안 누적수익이 20틱이상 발생하거나, 누적손실이 30틱 발생하면 진입을 중단시키고 싶습니다. 수식 수정 부탁드립니다. Input : shortPeriod(5), longPeriod(20), period(15); Input : 거래시간1(1), 시작시간1(090000), 끝시간1(020000); value1 = ma(C, shortPeriod); value2 = ma(C, longPeriod); value3 = ma(C, Period); Value4 = C/Value1*100; Value5 = PositionProfit; condition2 = IsExitName("stoploss",1); condition3 = 거래시간1==1 and (stime>=시작시간1 or stime<끝시간1); if condition3==true then { If condition2 == false then {IF 매수조건 Then Buy("매수"); } Else { IF BarsSinceExit(1) >= 3 and 매수조건 Then Buy("매수진입"); } IF BarsSinceEntry > 3 and 청산조건 Then ExitLong("매도"); } SetStopTrailing(0.1,0.35,PointStop); SetStopLoss(0.10,PointStop); # 새벽2시50에 모두 청산하고자 하시면 아래 내용도 추가하시면 됩니다. if stime == 025000 or (stime > 025000 and stime[1] < 025000) Then { exitlong(); }