커뮤니티

atr구분청산

프로필 이미지
피카2
2023-02-27 18:05:26
1412
글번호 166757
답변완료
언제나 감사합니다. atr청산시 진입가격에 따라 봉수와 승수를 달리 적용하려 합니다 아래처럼 하면 결과값에 차이가 없어 착오인 듯, 식 부탁드립니다. 그리고 이때 atr(봉수) 계산시 당일 봉만 카운트하는식 부탁합니다.가령 5분봉 차트에서 전일 봉들은 카운트 제외. Input : AT(20),MUL(5) if 매수조건 then buy; #청산 if MarketPosition==1 Then{ ExitLong("tr청",atstop,highest(High,barsSinceEntry)-atr(at)*mul); } If EntryPrice>=1 and EntryPrice<2 Then{ at==20 and mul==5; //진입가1~2 } If EntryPrice>=2 and EntryPrice<3 Then{ at==25 and mul==4 //진입가2~3 } If EntryPrice>=3 Then{ at==30 and mul==3 //진입가 3 이상 }
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-02-28 14:39:19

안녕하세요 예스스탁입니다. var : tr(0),idx(0),sum(0); var : atrv(0),mul(0); if Bdate != Bdate[1] Then { tr = h-l; idx = 0; sum = 0; } Else tr = TrueRange; idx = idx + 1; sum = sum + tr; if 매수조건 then buy(); #청산 if MarketPosition==1 Then { If EntryPrice>=1 and EntryPrice<2 Then { if idx < 20 then atrv = sum/idx; Else atrv = ATR(20); mul = 5; } If EntryPrice>=2 and EntryPrice<3 Then { if idx < 25 then atrv = sum/idx; Else atrv = ATR(25); mul = 5; } If EntryPrice>=3 Then { if idx < 30 then atrv = sum/idx; Else atrv = ATR(30); mul = 3; } if ATRv > 0 and mul > 0 Then ExitLong("tr청",atstop,highest(High,barsSinceEntry)-atrv*mul); } Else { ATRV = 0; Mul = 0; } 즐거운 하루되세요 > 피카2 님이 쓴 글입니다. > 제목 : atr구분청산 > 언제나 감사합니다. atr청산시 진입가격에 따라 봉수와 승수를 달리 적용하려 합니다 아래처럼 하면 결과값에 차이가 없어 착오인 듯, 식 부탁드립니다. 그리고 이때 atr(봉수) 계산시 당일 봉만 카운트하는식 부탁합니다.가령 5분봉 차트에서 전일 봉들은 카운트 제외. Input : AT(20),MUL(5) if 매수조건 then buy; #청산 if MarketPosition==1 Then{ ExitLong("tr청",atstop,highest(High,barsSinceEntry)-atr(at)*mul); } If EntryPrice>=1 and EntryPrice<2 Then{ at==20 and mul==5; //진입가1~2 } If EntryPrice>=2 and EntryPrice<3 Then{ at==25 and mul==4 //진입가2~3 } If EntryPrice>=3 Then{ at==30 and mul==3 //진입가 3 이상 }