커뮤니티

swing

프로필 이미지
코퍼
2023-08-25 13:31:01
1125
글번호 171845
답변완료
안녕하세요? SwingHigh(1,H,3,3,20)를 사용해 보려는데 어렵네요 SL1, SH1 : 진입으로부터 0~5개사이에 발생 SL2, SH2 : 진입으로부터 6~20개사이에 발생 하는 조건 추가 부탁드립니다. 안녕하세요 예스스탁입니다. input : left(3),right(3); var : sl1(0),sl2(0),sh1(0),sh2(0); if SwingLow(1,L,Left,right,Left+right+1) != -1 Then { sl1 = l[right]; sl2 = sl1[1]; #최근저점이 전저점보다 크면 매수 if SL1 > SL2 and SL2 > 0 Then buy(); } if SwingHigh(1,H,Left,right,Left+right+1) != -1 Then { sh1 = h[right]; sh2 = sh1[1]; #최근고점이 전고점보다 작으면 매도 if SH1 < SH2 and SH2 > 0 Then sell(); } if MarketPosition == 1 Then ExitLong("bx",AtStop,SL2[BarsSinceEntry]); if MarketPosition == -1 Then ExitShort("sx",AtStop,SH2[BarsSinceEntry]);
시스템
답변 2
프로필 이미지

예스스탁 예스스탁 답변

2023-08-25 15:03:41

안녕하세요 예스스탁입니다. 2번 조건만 추가해 드립니다. 해당 식에서 스윙하이와 스윙로우의 우측 봉수가 right이고 스윙하이나 스윙로우가 발생하면 이전값과 비교해 신호가 발생합니다. 그러므로 SL1, SH1은 항상 right봉전으로 고정값입니다. input : left(3),right(3); var : sl1(0),sl2(0),sh1(0),sh2(0); if SwingLow(1,L,Left,right,Left+right+1) != -1 Then { sl1 = l[right]; sl2 = sl1[1]; #최근저점이 전저점보다 크면 매수 if SL1 > SL2 and SL2 > 0 and sh2 >= Index-20 and sh2 <= Index+6 Then buy(); } if SwingHigh(1,H,Left,right,Left+right+1) != -1 Then { sh1 = h[right]; sh2 = sh1[1]; #최근고점이 전고점보다 작으면 매도 if SH1 < SH2 and SH2 > 0 and sh2 >= Index-20 and sh2 <= Index+6 Then sell(); } if MarketPosition == 1 Then ExitLong("bx",AtStop,SL2[BarsSinceEntry]); if MarketPosition == -1 Then ExitShort("sx",AtStop,SH2[BarsSinceEntry]); input : SL(70),SPR(1.2); SetStopContract; SetStopLoss(SL,PointStop); SetStopProfittarget(SL*SPR,PointStop); 즐거운 하루되세요 > 코퍼 님이 쓴 글입니다. > 제목 : swing > 안녕하세요? SwingHigh(1,H,3,3,20)를 사용해 보려는데 어렵네요 SL1, SH1 : 진입으로부터 0~5개사이에 발생 SL2, SH2 : 진입으로부터 6~20개사이에 발생 하는 조건 추가 부탁드립니다. 안녕하세요 예스스탁입니다. input : left(3),right(3); var : sl1(0),sl2(0),sh1(0),sh2(0); if SwingLow(1,L,Left,right,Left+right+1) != -1 Then { sl1 = l[right]; sl2 = sl1[1]; #최근저점이 전저점보다 크면 매수 if SL1 > SL2 and SL2 > 0 Then buy(); } if SwingHigh(1,H,Left,right,Left+right+1) != -1 Then { sh1 = h[right]; sh2 = sh1[1]; #최근고점이 전고점보다 작으면 매도 if SH1 < SH2 and SH2 > 0 Then sell(); } if MarketPosition == 1 Then ExitLong("bx",AtStop,SL2[BarsSinceEntry]); if MarketPosition == -1 Then ExitShort("sx",AtStop,SH2[BarsSinceEntry]);
프로필 이미지

코퍼

2023-08-25 16:20:57

코퍼 님에 의해 삭제된 답변입니다.