커뮤니티

문의 드립니다

프로필 이미지
탱탱볼
2025-12-02 14:47:10
30
글번호 228586
답변완료

input : P1(1),P2(2),P3(3); input : short1(1),long1(2),sig1(3); input : shor(1),long(2),sig(3); input : sho(1),lon(2),si(3); input : sho1(1),lon1(2),si1(3); input : evPeriod(1),Per(2); Input : Peri(1),OverSold(2); Input : Period(1), LPercent(2), SPercent(3);
Input : ATRLen(1), ATRMin(2), ATRMax(3.0); Input : ATRStop(1.5), ATRTake(3.0); var : mav1(0),mav2(0),mav3(0); var : macdv1(0),macdv2(0),macdv3(0),macdv4(0), macds1(0),macds2(0),macds3(0),macds4(0); var : evup(0),evdn(0); Var : par1(0), par2(0); Var : ATRVal(0), allowVol(false); Var : stopPrice(0), takePrice(0);
par1 = Disparity(Period); par2 = Disparity(Peri); mav1 = ma(C,P1); mav2 = ma(C,P2); mav3 = ma(C,P3); macdv1 = macd(short1,long1); macdv2 = macd(shor,long); macdv3 = macd(sho,lon); macdv4 = macd(sho1,lon1); macds1 = Ema(macdv1,sig1); macds2 = Ema(macdv2,sig); macds3 = Ema(macdv3,si); macds4 = Ema(macdv4,si1); evup = EnvelopeUp(evPeriod,Per); evdn = EnvelopeDown(evPeriod,Per);
ATRVal = AvgTrueRange(ATRLen); allowVol = (ATRVal > ATRMin) and (ATRVal < ATRMax);
if MarketPosition <= 0 and allowVol and CrossUp(macdv1,0) and macdv4 < 0 and macdv4 > macds4 and C < Evup and par1<LPercent Then { Buy("b0",AtMarket); } if MarketPosition <= 0 and allowVol and macdv4 > macds4 and macdv1 > 0 and macdv4 < 0 and CrossDown(macdv3, 0) and C < Evup and par1<LPercent Then { Buy("b1",AtMarket); } if MarketPosition <= 0 and allowVol and macdv4 > macds4 and macdv1 > 0 and macdv4 < 0 and CrossUp(macdv3,macds3) and C < Evup and par1<LPercent Then { Buy("b2",AtMarket); } if allowVol and CrossDown(OverSold,par2 ) Then { Buy("BBB",AtMarket); }
if MarketPosition == 1 and CrossDown(par1,LPercent ) Then { ExitLong("st"); }
if MarketPosition == 1 then begin stopPrice = EntryPrice(0) - ATRVal * ATRStop; takePrice = EntryPrice(0) + ATRVal * ATRTake; // ATR 손절 Sell("ATRStop") next bar at stopPrice stop; // ATR 익절 Sell("ATRTake") next bar at takePrice limit; end;
기존 수식에 ATR 을 추가 하려니 문법이 틀리다고 나오네요. 수정 부탁 드립니다.

시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2025-12-02 15:18:09

안녕하세요 예스스탁입니다. 예스랭귀지에는 함수명이 ATR입니다. 청산식도 예스랭귀지 문법과 달라 수정해 드립니다. input : P1(1),P2(2),P3(3); input : short1(1),long1(2),sig1(3); input : shor(1),long(2),sig(3); input : sho(1),lon(2),si(3); input : sho1(1),lon1(2),si1(3); input : evPeriod(1),Per(2); Input : Peri(1),OverSold(2); Input : Period(1), LPercent(2), SPercent(3); Input : ATRLen(1), ATRMin(2), ATRMax(3.0); Input : ATRStop(1.5), ATRTake(3.0); var : mav1(0),mav2(0),mav3(0); var : macdv1(0),macdv2(0),macdv3(0),macdv4(0), macds1(0),macds2(0),macds3(0),macds4(0); var : evup(0),evdn(0); Var : par1(0), par2(0); Var : ATRVal(0), allowVol(false); Var : stopPrice(0), takePrice(0); par1 = Disparity(Period); par2 = Disparity(Peri); mav1 = ma(C,P1); mav2 = ma(C,P2); mav3 = ma(C,P3); macdv1 = macd(short1,long1); macdv2 = macd(shor,long); macdv3 = macd(sho,lon); macdv4 = macd(sho1,lon1); macds1 = Ema(macdv1,sig1); macds2 = Ema(macdv2,sig); macds3 = Ema(macdv3,si); macds4 = Ema(macdv4,si1); evup = EnvelopeUp(evPeriod,Per); evdn = EnvelopeDown(evPeriod,Per); ATRVal = ATR(ATRLen); allowVol = (ATRVal > ATRMin) and (ATRVal < ATRMax); if MarketPosition <= 0 and allowVol and CrossUp(macdv1,0) and macdv4 < 0 and macdv4 > macds4 and C < Evup and par1<LPercent Then { Buy("b0",AtMarket); } if MarketPosition <= 0 and allowVol and macdv4 > macds4 and macdv1 > 0 and macdv4 < 0 and CrossDown(macdv3, 0) and C < Evup and par1<LPercent Then { Buy("b1",AtMarket); } if MarketPosition <= 0 and allowVol and macdv4 > macds4 and macdv1 > 0 and macdv4 < 0 and CrossUp(macdv3,macds3) and C < Evup and par1<LPercent Then { Buy("b2",AtMarket); } if allowVol and CrossDown(OverSold,par2 ) Then { Buy("BBB",AtMarket); } if MarketPosition == 1 and CrossDown(par1,LPercent ) Then { ExitLong("st"); } if MarketPosition == 1 then begin stopPrice = EntryPrice(0) - ATRVal * ATRStop; takePrice = EntryPrice(0) + ATRVal * ATRTake; // ATR 손절 Sell("ATRStop",AtStop,stopPrice); // ATR 익절 Sell("ATRTake",AtLimit,takePrice); end; 즐거운 하루되세요