커뮤니티

매매 신호를 skip 할 수 있습니까?

프로필 이미지
피니트
2013-11-27 10:53:09
148
글번호 69855
답변완료
데이트레이딩입니다. " 직전의 신호가 손실일 경우만 이번 매매에 진입하고 싶습니다. " 가령 오늘 매매 신호가 1 -> 2 -> 3 -> 4 이렇게 4번 발생할 때 신호에 따라 거래했을 경우 각각 1:수익 -> 2:손실 -> 3:손실 -> 4:수익 이라고 한다면, 실제 매매는 1 , 3 , 4 만 발생하게 할 수 있나요? 추가규칙) 오늘의 첫번째 거래는 무조건 진입한다. 노고에 감사드립니다. // 변수 정의 input : Atrp(15),진입곱(3), 전날ATR이하진입(4),박스기간(15),하루진입횟수(4); var : ATRch(0), posHigh(0), posLow(0),cnt(0) , count(0); // 고가 , 저가 , ATR 계산 PosHigh = Highest(H,박스기간); PosLow = Lowest(L,박스기간); ATRch = ATR(Atrp) * 진입곱; /////////////////////////////////////////////////////// 진입 # 진입횟수 count = 0; for cnt = 0 to 10 { if sdate == EntryDate(cnt) Then count = count+1; }; # 진입조건 If stime < 120000 and count < 하루진입횟수 and Abs(DayHigh(1)-daylow(1)) < 전날ATR이하진입 then { if MarketPosition <= 0 and CrossUp(C, PosLow + ATRch) Then buy(); if MarketPosition >= 0 and CrossDown(C, PosHigh - ATRch) then sell(); }; #피라미딩(추가진입)--> 설정창에서 피라미딩을 다른진입신호만 허용 if MarketPosition == 1 Then{ buy("b2",AtStop,EntryPrice+1.0); buy("b3",AtStop,EntryPrice+1.5); buy("b4",AtStop,EntryPrice+2.0); } if MarketPosition == -1 Then{ Sell("s2",AtStop,EntryPrice-1.0); Sell("s3",AtStop,EntryPrice-1.5); Sell("s4",AtStop,EntryPrice-2.0); } ///////////////////////////////////////////////////////// 청산 If MarketPosition == 1 Then { ExitLong("매수끝", AtStop, PosHigh - ATRch); ExitLong("매수손절",AtStop,EntryPrice*0.99);#진입가 대비 1% 손실청산 } If MarketPosition == -1 Then { ExitShort("매도끝", AtStop, PosLow + ATRch); ExitLong("매도손절",AtStop,EntryPrice*1.01);#진입가 대비 1% 손실청산 } SetStopEndofday(144920);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2013-11-27 21:00:12

안녕하세요 예스스탁입니다. 청산이 된 이후에 최종 손익을 알수 있는 부분이므로 아래와 같이 작성하시면 당일 첫번째는 조건없이 진입하고 두번째 부터는 이전거래가 손실이면 진입하는 식이 됩니다. // 변수 정의 input : Atrp(15),진입곱(3), 전날ATR이하진입(4),박스기간(15),하루진입횟수(4); var : ATRch(0), posHigh(0), posLow(0),cnt(0) , count(0); // 고가 , 저가 , ATR 계산 PosHigh = Highest(H,박스기간); PosLow = Lowest(L,박스기간); ATRch = ATR(Atrp) * 진입곱; /////////////////////////////////////////////////////// 진입 # 진입횟수 count = 0; for cnt = 0 to 10{ if sdate == EntryDate(cnt) Then count = count+1; } # 진입조건 If stime < 120000 and count < 하루진입횟수 and Abs(DayHigh(1)-daylow(1)) < 전날ATR이하진입 then { if MarketPosition == 0 and count == 0 and CrossUp(C, PosLow + ATRch) Then buy(); if MarketPosition == 0 and count >= 1 and PositionProfit(1) < 0 and CrossUp(C, PosLow + ATRch) Then buy(); if MarketPosition == -1 and count >= 1 and CrossUp(C, PosLow + ATRch) Then{ if PositionProfit < 0 Then buy(); Else ExitShort(); } if MarketPosition == 0 and count == 0 and CrossDown(C, PosHigh - ATRch) then sell(); if MarketPosition == 0 and count >= 1 and PositionProfit(1) < 0 and CrossDown(C, PosHigh - ATRch) then sell(); if MarketPosition == 1 and count >= 0 and CrossDown(C, PosHigh - ATRch) then{ if PositionProfit < 0 Then sell(); Else ExitLong(); } } #피라미딩(추가진입)--> 설정창에서 피라미딩을 다른진입신호만 허용 if MarketPosition == 1 Then{ buy("b2",AtStop,EntryPrice+1.0); buy("b3",AtStop,EntryPrice+1.5); buy("b4",AtStop,EntryPrice+2.0); } if MarketPosition == -1 Then{ Sell("s2",AtStop,EntryPrice-1.0); Sell("s3",AtStop,EntryPrice-1.5); Sell("s4",AtStop,EntryPrice-2.0); } ///////////////////////////////////////////////////////// 청산 If MarketPosition == 1 Then { ExitLong("매수끝", AtStop, PosHigh - ATRch); ExitLong("매수손절",AtStop,EntryPrice*0.99);#진입가 대비 1% 손실청산 } If MarketPosition == -1 Then { ExitShort("매도끝", AtStop, PosLow + ATRch); ExitLong("매도손절",AtStop,EntryPrice*1.01);#진입가 대비 1% 손실청산 } SetStopEndofday(144920); 즐거운 하루되세요 > 피니트 님이 쓴 글입니다. > 제목 : 매매 신호를 skip 할 수 있습니까? > 데이트레이딩입니다. " 직전의 신호가 손실일 경우만 이번 매매에 진입하고 싶습니다. " 가령 오늘 매매 신호가 1 -> 2 -> 3 -> 4 이렇게 4번 발생할 때 신호에 따라 거래했을 경우 각각 1:수익 -> 2:손실 -> 3:손실 -> 4:수익 이라고 한다면, 실제 매매는 1 , 3 , 4 만 발생하게 할 수 있나요? 추가규칙) 오늘의 첫번째 거래는 무조건 진입한다. 노고에 감사드립니다. // 변수 정의 input : Atrp(15),진입곱(3), 전날ATR이하진입(4),박스기간(15),하루진입횟수(4); var : ATRch(0), posHigh(0), posLow(0),cnt(0) , count(0); // 고가 , 저가 , ATR 계산 PosHigh = Highest(H,박스기간); PosLow = Lowest(L,박스기간); ATRch = ATR(Atrp) * 진입곱; /////////////////////////////////////////////////////// 진입 # 진입횟수 count = 0; for cnt = 0 to 10 { if sdate == EntryDate(cnt) Then count = count+1; }; # 진입조건 If stime < 120000 and count < 하루진입횟수 and Abs(DayHigh(1)-daylow(1)) < 전날ATR이하진입 then { if MarketPosition <= 0 and CrossUp(C, PosLow + ATRch) Then buy(); if MarketPosition >= 0 and CrossDown(C, PosHigh - ATRch) then sell(); }; #피라미딩(추가진입)--> 설정창에서 피라미딩을 다른진입신호만 허용 if MarketPosition == 1 Then{ buy("b2",AtStop,EntryPrice+1.0); buy("b3",AtStop,EntryPrice+1.5); buy("b4",AtStop,EntryPrice+2.0); } if MarketPosition == -1 Then{ Sell("s2",AtStop,EntryPrice-1.0); Sell("s3",AtStop,EntryPrice-1.5); Sell("s4",AtStop,EntryPrice-2.0); } ///////////////////////////////////////////////////////// 청산 If MarketPosition == 1 Then { ExitLong("매수끝", AtStop, PosHigh - ATRch); ExitLong("매수손절",AtStop,EntryPrice*0.99);#진입가 대비 1% 손실청산 } If MarketPosition == -1 Then { ExitShort("매도끝", AtStop, PosLow + ATRch); ExitLong("매도손절",AtStop,EntryPrice*1.01);#진입가 대비 1% 손실청산 } SetStopEndofday(144920);