커뮤니티

수식문의드립니다.

프로필 이미지
행복곰
2023-05-15 10:39:25
1667
글번호 168959
답변완료
항상 감사드립니다. 아래의 3 가지 수식에 이격도 (이평이 서로 너무 벌어지면 진입금지)를 추가해주시면 감사드리겠습니다, 저번처럼 외부변수로 해주시면 정말 감사드리겠습니다.(예 Input : p1(5), p2(20), Per(5);) [1번] Inputs: AvgLen1(10), AvgLen2(10), AvgLen3(10), AvgLen4(10), ARmult(4.5), Div(30); Vars: Avg1(0), Avg2(0), Avg3(0), Avg4(0), MP(0), StopPrice(0); Avg1 = ema(Close, AvgLen1); Avg2 = ema(Close, AvgLen2); Avg3 = ema(Close, AvgLen3); Avg4 = ema(Close, AvgLen4); If CrossUp(Avg1 , Avg2) AND (Avg2 > Avg3) AND (Avg3 > Avg4) then Buy("B",AtMarket); If CrossDown (Avg1 , Avg2) AND (Avg2 < Avg3) AND (Avg3 < Avg4) then Sell("S",AtMarket); If Avg1 < Avg2 then ExitLong("EL",AtMarket); If Avg1 > Avg2 then ExitShort("ES",AtMarket); MP = MarketPosition; if MP == 1 and MP[1] <> 1 then StopPrice = low - ma(range,40)*ARmult; if MP == -1 and MP[1] <> -1 then StopPrice = High + ma(range,40)*ARmult; If MP == 1 then { exitlong ("ExitLong", atstop, stopprice ); stopprice = stopprice + (low-stopprice)/Div; } If MP == -1 then { exitshort ("ExitShort",atstop, stopprice ); stopprice = stopprice - (stopprice-high)/Div; } [2번] Input: DMILen(70), ADXLen(20), entryPoint(0.2), ADXExit(30); Vars: BuySetup(false), SellSetup(false), BuyPrice(0), SellPrice(0), DPlus(0), DMin(0), ADXVal(0), ExitSPrc(0), ExitLPrc(0); DPlus = DIPlus(DMILen); DMin = DIMinus(DMILen); ADXVal = ADX(ADXLen); If DPlus > DMin AND CrossUp( ADXVal , DMin) and MarketPosition <> 1 then begin BuyPrice = High + entryPoint ; BuySetup = true; ExitLPrc = Low - entryPoint ; end; If ADXVal < DMin OR MarketPosition == 1 then BuySetup = False; If DPlus < DMin AND CrossUp( ADXVal , DPlus) and MarketPosition <> -1 then begin SellPrice = Low - entryPoint ; SellSetup = true; ExitSPrc = High + entryPoint ; end; If ADXVal < DPlus or MarketPosition == -1 then SellSetup = False; If BuySetup then Buy("B",atstop,BuyPrice); If SellSetup then Sell("S",atstop,SellPrice); /*If MarketPosition == 1 then Begin BuySetup = false; ExitLong("EL1",atstop,ExitLPrc); end; If MarketPosition == -1 then begin SellSetup = True; ExitShort("ES1",atstop,ExitSPrc); end; If ( ADXVal[1] >= ADXExit AND ADXVal < ADXVal[1] ) then Begin If MarketPosition == 1 and barssinceentry > 1 then ExitLong("EL2"); ; If MarketPosition == -1 and barssinceentry > 1 then ExitShort("ES2");; end; If DPlus < DMin and BarsSinceEntry > 1 then ExitLong("EL3"); If DPlus > Dmin and BarsSinceEntry > 1 then ExitShort("ES3");*/ [3번] Inputs: Length(300), Const(1.4), ChanPcnt(0.8), stopLen(40), stopper(1.0); Vars: KCU(0), KCL(0), ChanRng(0), AvgVal(0), AvgRange(0), SetBar(0), CountL(0), CountS(0); //Assignments of Keltner calculations AvgVal = ma(Close, Length); AvgRange = ma(TrueRange, Length); KCU = AvgVal + AvgRange * Const; KCL = AvgVal - AvgRange * Const; ChanRng = (KCU - KCL) / 2; //Accumulates to count the bars after the SetUps below CountL = CountL + 1; CountS = CountS + 1; //Buy Criteria Evaluation IF CrossUp(Close , KCU) Then Begin SetBar = High; CountL = 1; End; IF Close > KCU AND CountL <= 5 Then Buy("B",atstop,SetBar + (ChanRng * ChanPcnt)); //Sell Criteria Evaluation IF CrossDown(Close , KCL) Then Begin SetBar = Low; CountS = 1; End; IF Close < KCL AND CountS <= 5 Then Sell("S",atstop,SetBar - (ChanRng * ChanPcnt)); //System Stops IF CrossDown( Close , AvgVal) Then ExitLong(); IF CrossUP(Close , AvgVal) Then ExitShort(); //Trailing Stops ExitLong("EL2", atstop,Lowest(Low, StopLen) ); ExitShort("ES2", atstop,Highest(High, StopLen));
시스템
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-05-15 11:50:24

안녕하세요 예스스탁입니다. 1 Inputs: AvgLen1(10), AvgLen2(10), AvgLen3(10), AvgLen4(10), ARmult(4.5), Div(30); Input : p1(5), p2(20), Per(5); Vars: Avg1(0), Avg2(0), Avg3(0), Avg4(0), MP(0), StopPrice(0); var1 = ma(C,P1); Var2 = ma(C,P2); Avg1 = ema(Close, AvgLen1); Avg2 = ema(Close, AvgLen2); Avg3 = ema(Close, AvgLen3); Avg4 = ema(Close, AvgLen4); If CrossUp(Avg1 , Avg2) AND (Avg2 > Avg3) AND (Avg3 > Avg4) and max(var1,Var2) <= min(var1,Var2)*(1+Per/100) then Buy("B",AtMarket); If CrossDown (Avg1 , Avg2) AND (Avg2 < Avg3) AND (Avg3 < Avg4) and max(var1,Var2) <= min(var1,Var2)*(1+Per/100) then Sell("S",AtMarket); If Avg1 < Avg2 then ExitLong("EL",AtMarket); If Avg1 > Avg2 then ExitShort("ES",AtMarket); MP = MarketPosition; if MP == 1 and MP[1] <> 1 then StopPrice = low - ma(range,40)*ARmult; if MP == -1 and MP[1] <> -1 then StopPrice = High + ma(range,40)*ARmult; If MP == 1 then { exitlong ("ExitLong", atstop, stopprice ); stopprice = stopprice + (low-stopprice)/Div; } If MP == -1 then { exitshort ("ExitShort",atstop, stopprice ); stopprice = stopprice - (stopprice-high)/Div; } 2 Input: DMILen(70), ADXLen(20), entryPoint(0.2), ADXExit(30); Input : p1(5), p2(20), Per(5); Vars: BuySetup(false), SellSetup(false), BuyPrice(0), SellPrice(0), DPlus(0), DMin(0), ADXVal(0), ExitSPrc(0), ExitLPrc(0); var1 = ma(C,P1); Var2 = ma(C,P2); DPlus = DIPlus(DMILen); DMin = DIMinus(DMILen); ADXVal = ADX(ADXLen); If DPlus > DMin AND CrossUp( ADXVal , DMin) and MarketPosition <> 1 then begin BuyPrice = High + entryPoint ; BuySetup = true; ExitLPrc = Low - entryPoint ; end; If ADXVal < DMin OR MarketPosition == 1 then BuySetup = False; If DPlus < DMin AND CrossUp( ADXVal , DPlus) and MarketPosition <> -1 then begin SellPrice = Low - entryPoint ; SellSetup = true; ExitSPrc = High + entryPoint ; end; If ADXVal < DPlus or MarketPosition == -1 then SellSetup = False; If BuySetup and max(var1,Var2) <= min(var1,Var2)*(1+Per/100) then Buy("B",atstop,BuyPrice); If SellSetup and max(var1,Var2) <= min(var1,Var2)*(1+Per/100) then Sell("S",atstop,SellPrice); /*If MarketPosition == 1 then Begin BuySetup = false; ExitLong("EL1",atstop,ExitLPrc); end; If MarketPosition == -1 then begin SellSetup = True; ExitShort("ES1",atstop,ExitSPrc); end; If ( ADXVal[1] >= ADXExit AND ADXVal < ADXVal[1] ) then Begin If MarketPosition == 1 and barssinceentry > 1 then ExitLong("EL2"); ; If MarketPosition == -1 and barssinceentry > 1 then ExitShort("ES2");; end; If DPlus < DMin and BarsSinceEntry > 1 then ExitLong("EL3"); If DPlus > Dmin and BarsSinceEntry > 1 then ExitShort("ES3");*/ 3 Inputs: Length(300), Const(1.4), ChanPcnt(0.8), stopLen(40), stopper(1.0); Input : p1(5), p2(20), Per(5); Vars: KCU(0), KCL(0), ChanRng(0), AvgVal(0), AvgRange(0), SetBar(0), CountL(0), CountS(0); var1 = ma(C,P1); Var2 = ma(C,P2); //Assignments of Keltner calculations AvgVal = ma(Close, Length); AvgRange = ma(TrueRange, Length); KCU = AvgVal + AvgRange * Const; KCL = AvgVal - AvgRange * Const; ChanRng = (KCU - KCL) / 2; //Accumulates to count the bars after the SetUps below CountL = CountL + 1; CountS = CountS + 1; //Buy Criteria Evaluation IF CrossUp(Close , KCU) Then Begin SetBar = High; CountL = 1; End; IF Close > KCU AND CountL <= 5 and max(var1,Var2) <= min(var1,Var2)*(1+Per/100) Then Buy("B",atstop,SetBar + (ChanRng * ChanPcnt)); //Sell Criteria Evaluation IF CrossDown(Close , KCL) Then Begin SetBar = Low; CountS = 1; End; IF Close < KCL AND CountS <= 5 and max(var1,Var2) <= min(var1,Var2)*(1+Per/100) Then Sell("S",atstop,SetBar - (ChanRng * ChanPcnt)); //System Stops IF CrossDown( Close , AvgVal) Then ExitLong(); IF CrossUP(Close , AvgVal) Then ExitShort(); //Trailing Stops ExitLong("EL2", atstop,Lowest(Low, StopLen) ); ExitShort("ES2", atstop,Highest(High, StopLen)); 즐거운 하루되세요 > 행복곰 님이 쓴 글입니다. > 제목 : 수식문의드립니다. > 항상 감사드립니다. 아래의 3 가지 수식에 이격도 (이평이 서로 너무 벌어지면 진입금지)를 추가해주시면 감사드리겠습니다, 저번처럼 외부변수로 해주시면 정말 감사드리겠습니다.(예 Input : p1(5), p2(20), Per(5);) [1번] Inputs: AvgLen1(10), AvgLen2(10), AvgLen3(10), AvgLen4(10), ARmult(4.5), Div(30); Vars: Avg1(0), Avg2(0), Avg3(0), Avg4(0), MP(0), StopPrice(0); Avg1 = ema(Close, AvgLen1); Avg2 = ema(Close, AvgLen2); Avg3 = ema(Close, AvgLen3); Avg4 = ema(Close, AvgLen4); If CrossUp(Avg1 , Avg2) AND (Avg2 > Avg3) AND (Avg3 > Avg4) then Buy("B",AtMarket); If CrossDown (Avg1 , Avg2) AND (Avg2 < Avg3) AND (Avg3 < Avg4) then Sell("S",AtMarket); If Avg1 < Avg2 then ExitLong("EL",AtMarket); If Avg1 > Avg2 then ExitShort("ES",AtMarket); MP = MarketPosition; if MP == 1 and MP[1] <> 1 then StopPrice = low - ma(range,40)*ARmult; if MP == -1 and MP[1] <> -1 then StopPrice = High + ma(range,40)*ARmult; If MP == 1 then { exitlong ("ExitLong", atstop, stopprice ); stopprice = stopprice + (low-stopprice)/Div; } If MP == -1 then { exitshort ("ExitShort",atstop, stopprice ); stopprice = stopprice - (stopprice-high)/Div; } [2번] Input: DMILen(70), ADXLen(20), entryPoint(0.2), ADXExit(30); Vars: BuySetup(false), SellSetup(false), BuyPrice(0), SellPrice(0), DPlus(0), DMin(0), ADXVal(0), ExitSPrc(0), ExitLPrc(0); DPlus = DIPlus(DMILen); DMin = DIMinus(DMILen); ADXVal = ADX(ADXLen); If DPlus > DMin AND CrossUp( ADXVal , DMin) and MarketPosition <> 1 then begin BuyPrice = High + entryPoint ; BuySetup = true; ExitLPrc = Low - entryPoint ; end; If ADXVal < DMin OR MarketPosition == 1 then BuySetup = False; If DPlus < DMin AND CrossUp( ADXVal , DPlus) and MarketPosition <> -1 then begin SellPrice = Low - entryPoint ; SellSetup = true; ExitSPrc = High + entryPoint ; end; If ADXVal < DPlus or MarketPosition == -1 then SellSetup = False; If BuySetup then Buy("B",atstop,BuyPrice); If SellSetup then Sell("S",atstop,SellPrice); /*If MarketPosition == 1 then Begin BuySetup = false; ExitLong("EL1",atstop,ExitLPrc); end; If MarketPosition == -1 then begin SellSetup = True; ExitShort("ES1",atstop,ExitSPrc); end; If ( ADXVal[1] >= ADXExit AND ADXVal < ADXVal[1] ) then Begin If MarketPosition == 1 and barssinceentry > 1 then ExitLong("EL2"); ; If MarketPosition == -1 and barssinceentry > 1 then ExitShort("ES2");; end; If DPlus < DMin and BarsSinceEntry > 1 then ExitLong("EL3"); If DPlus > Dmin and BarsSinceEntry > 1 then ExitShort("ES3");*/ [3번] Inputs: Length(300), Const(1.4), ChanPcnt(0.8), stopLen(40), stopper(1.0); Vars: KCU(0), KCL(0), ChanRng(0), AvgVal(0), AvgRange(0), SetBar(0), CountL(0), CountS(0); //Assignments of Keltner calculations AvgVal = ma(Close, Length); AvgRange = ma(TrueRange, Length); KCU = AvgVal + AvgRange * Const; KCL = AvgVal - AvgRange * Const; ChanRng = (KCU - KCL) / 2; //Accumulates to count the bars after the SetUps below CountL = CountL + 1; CountS = CountS + 1; //Buy Criteria Evaluation IF CrossUp(Close , KCU) Then Begin SetBar = High; CountL = 1; End; IF Close > KCU AND CountL <= 5 Then Buy("B",atstop,SetBar + (ChanRng * ChanPcnt)); //Sell Criteria Evaluation IF CrossDown(Close , KCL) Then Begin SetBar = Low; CountS = 1; End; IF Close < KCL AND CountS <= 5 Then Sell("S",atstop,SetBar - (ChanRng * ChanPcnt)); //System Stops IF CrossDown( Close , AvgVal) Then ExitLong(); IF CrossUP(Close , AvgVal) Then ExitShort(); //Trailing Stops ExitLong("EL2", atstop,Lowest(Low, StopLen) ); ExitShort("ES2", atstop,Highest(High, StopLen));