답변완료
수식문의드립니다.
항상 감사드립니다.
아래의 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));
2023-05-15
1686
글번호 168959
시스템
답변완료
수식좀 요청 드립니다
* 항상 많은 도움에 고맙습니다.
* 아래 수식에서 점 이 다른데 찍히는데 2가지 요청 좀 드림니다.
1. 정배열 상태 에서만 점 찍히게 부탁 드립니다.
→ 정배열 기준 : VAR1 > VAR2 > VAR3 OR(또는) VAR1> VAR3 > VAR2
2. 역배열 상태 에서도 동일 하게 찍히게 작성 좀 요청 드립니다.
→ 역배열 기준 : VAR1 < VAR2 < VAR3 OR(또는) VAR1 < VAR3 < VAR2
## 아래 수식
VAR1 = MA(C,10) ;
VAR2 = MA(C,20) ;
VAR3 = MA(C,30) ;
Plot1(VAR1) ;
Plot2(VAR2) ;
Plot3(VAR3,"3",Black,DeF,1) ;
var : tx01(0);
if VAR1 > Var2 AND VAR1 >Var3 Then
{
if VAR1 > Var2 AND VAR1 > Var3 AND Var2 > Var3 Then
{
Tx01 = Text_New(sdate,stime,Var3,"■");
Text_SetStyle(Tx01,2,2);
Text_SetColor(Tx01,RED );
Text_SetSize(Tx01,12);
}
}
* 좋은 한주 되십시요.
2023-05-14
878
글번호 168945
강조