커뮤니티

보완수정 부탁드립니다.

프로필 이미지
대구어린울프
2019-03-13 18:30:01
245
글번호 127046
답변완료
안녕하세요? 아래의 수식에서 진입횟수가 똑바로 작동이 안됩니다. 하루 3번하라고 변수에 넣으면 하루3회 매매를 해야하는데, 3번진입하라고하면 2번만 진입하는 형태로 돌아갑니다. 수정부탁드리겠습니다. 감사합니다. input : n1(1),n2(2), 익절틱수(10),손절틱수(10),당일진입횟수(3); var : T1(0),entry(0); if bdate != bdate[1] Then T1 = TotalTrades[1]; if MarketPosition == 0 Then entry = TotalTrades-t1; Else entry = TotalTrades-t1+1; if MarketPosition == 0 then { if (C > O and C == C[n1] and C[n1] < O[n1]) or (C > O and C == C[n2] and C[n2] < O[n2]) Then { if entry < 당일진입횟수 Then buy(); Else ExitShort(); } if (C < O and C == C[n1] and C[n1] > O[n1]) or (C < O and C == C[n2] and C[n2] > O[n2]) Then { if entry < 당일진입횟수 Then sell(); Else ExitLong(); } } SetStopProfittarget(익절틱수*PriceScale,PointStop); SetStopLoss(손절틱수*PriceScale,PointStop);
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2019-03-14 15:11:11

안녕하세요 예스스탁입니다. 이전일에 넘어온 포지션이 있으면 해당 포지션도 1회로 체크됩니다. 진입의 횟수만 체크하게 수정해 드립니다. input : n1(1),n2(2), 익절틱수(10),손절틱수(10),당일진입횟수(3); var : T1(0),entry(0); if bdate != bdate[1] Then { entry = 0; } if MarketPosition != 0 and MarketPosition != MarketPosition[1] Then entry = entry+1; if MarketPosition == 0 then { if (C > O and C == C[n1] and C[n1] < O[n1]) or (C > O and C == C[n2] and C[n2] < O[n2]) Then { if entry < 당일진입횟수 Then buy(); Else ExitShort(); } if (C < O and C == C[n1] and C[n1] > O[n1]) or (C < O and C == C[n2] and C[n2] > O[n2]) Then { if entry < 당일진입횟수 Then sell(); Else ExitLong(); } } SetStopProfittarget(익절틱수*PriceScale,PointStop); SetStopLoss(손절틱수*PriceScale,PointStop); 즐거운 하루되세요 > 대구어린울프 님이 쓴 글입니다. > 제목 : 보완수정 부탁드립니다. > 안녕하세요? 아래의 수식에서 진입횟수가 똑바로 작동이 안됩니다. 하루 3번하라고 변수에 넣으면 하루3회 매매를 해야하는데, 3번진입하라고하면 2번만 진입하는 형태로 돌아갑니다. 수정부탁드리겠습니다. 감사합니다. input : n1(1),n2(2), 익절틱수(10),손절틱수(10),당일진입횟수(3); var : T1(0),entry(0); if bdate != bdate[1] Then T1 = TotalTrades[1]; if MarketPosition == 0 Then entry = TotalTrades-t1; Else entry = TotalTrades-t1+1; if MarketPosition == 0 then { if (C > O and C == C[n1] and C[n1] < O[n1]) or (C > O and C == C[n2] and C[n2] < O[n2]) Then { if entry < 당일진입횟수 Then buy(); Else ExitShort(); } if (C < O and C == C[n1] and C[n1] > O[n1]) or (C < O and C == C[n2] and C[n2] > O[n2]) Then { if entry < 당일진입횟수 Then sell(); Else ExitLong(); } } SetStopProfittarget(익절틱수*PriceScale,PointStop); SetStopLoss(손절틱수*PriceScale,PointStop);