0 beğenilme 0 beğenilmeme
178 kez görüntülendi
Aşağıdaki indikatörü Matriks için indikatör ve AL-SAT haline getirme şansınız var mı?

// © Dreadblitz
//@version=4
study(shorttitle="FLI", title="Follow Line Indicator", overlay=true)
//
BBperiod      = input(defval = 21,     title = "BB Period",    type = input.integer, minval = 1)
BBdeviations  = input(defval = 1.00,     title = "BB Deviations",    type = input.float, minval = 0.1, step=0.05)
UseATRfilter  = input(defval = true, title = "ATR Filter",  type = input.bool)
ATRperiod     = input(defval = 5,     title = "ATR Period",    type = input.integer, minval = 1)
hl            = input(defval = false, title = "Hide Labels",  type = input.bool)
//
BBUpper=sma (close,BBperiod)+stdev(close, BBperiod)*BBdeviations
BBLower=sma (close,BBperiod)-stdev(close, BBperiod)*BBdeviations
//
TrendLine = 0.0
iTrend = 0.0
buy = 0.0
sell = 0.0
//
BBSignal = close>BBUpper? 1 : close<BBLower? -1 : 0
//
if BBSignal == 1 and UseATRfilter == 1
    TrendLine:=low-atr(ATRperiod)
    if TrendLine<TrendLine[1]
        TrendLine:=TrendLine[1]
if BBSignal == -1 and UseATRfilter == 1
    TrendLine:=high+atr(ATRperiod)
    if TrendLine>TrendLine[1]
        TrendLine:=TrendLine[1]
if BBSignal == 0 and UseATRfilter == 1
    TrendLine:=TrendLine[1]
//
if BBSignal == 1 and UseATRfilter == 0
    TrendLine:=low
    if TrendLine<TrendLine[1]
        TrendLine:=TrendLine[1]
if BBSignal == -1 and UseATRfilter == 0
    TrendLine:=high
    if TrendLine>TrendLine[1]
        TrendLine:=TrendLine[1]
if BBSignal == 0 and UseATRfilter == 0
    TrendLine:=TrendLine[1]
//
iTrend:=iTrend[1]
if TrendLine>TrendLine[1]
    iTrend:=1
if TrendLine<TrendLine[1]
    iTrend:=-1
//
buy:=iTrend[1]==-1 and iTrend==1 ? 1 : na
sell:=iTrend[1]==1 and iTrend==-1? 1 : na
//
plot(TrendLine, color=iTrend > 0?color.blue:color.red ,style=plot.style_line,linewidth=2,transp=0,title="Trend Line")
plotshape(buy == 1 and hl == false? TrendLine-atr(8) :na, text='', style= shape.labelup, location=location.absolute, color=color.blue, textcolor=color.white, offset=0, transp=0,size=size.auto)
plotshape(sell == 1 and hl == false ?TrendLine+atr(8):na, text='', style=shape.labeldown, location=location.absolute, color=color.red, textcolor=color.white, offset=0, transp=0,size=size.auto)
//
alertcondition(sell == 1 ,title="Sell",message="Sell")
alertcondition(buy == 1 ,title="Buy",message="Buy")
alertcondition(buy == 1 or sell == 1 ,title="Buy/Sell",message="Buy/Sell")
Diğer kategorisinde (90 puan) tarafından | 178 kez görüntülendi

1 cevap

0 beğenilme 0 beğenilmeme

AL

bb_period:=20;
bb_dev:=2;
pd:=20;
ust:=mov(c,bb_period,s)+STDEV(c,bb_period)*bb_dev;
alt:=mov(c,bb_period,s)-STDEV(c,bb_period)*bb_dev;
signal:=if(c>ust,1,if(c<alt,-1,0));
up:=H+(ATRE(pd));
down:=L-(ATRE(pd));
fl:=if(signal=1 and down>prev,down,if(signal=-1 and up<prev,up,prev));
cross(fl,ref(fl,-1))

SAT

bb_period:=20;
bb_dev:=2;
pd:=20;
ust:=mov(c,bb_period,s)+STDEV(c,bb_period)*bb_dev;
alt:=mov(c,bb_period,s)-STDEV(c,bb_period)*bb_dev;
signal:=if(c>ust,1,if(c<alt,-1,0));
up:=H+(ATRE(pd));
down:=L-(ATRE(pd));
fl:=if(signal=1 and down>prev,down,if(signal=-1 and up<prev,up,prev));
cross(ref(fl,-1),fl)

 

(57 puan) tarafından
Hoş geldiniz, Matriks Destek Platformu sizlere sorularınızın hızlıca cevaplanması için bir ortam sağlar. Sorduğunuz ve cevapladığınız soruların ve yorumlarınızın aldığı oylar üzerinden puan kazanırsınız. Puan sistemine bağlı kampanyamızla ücretsiz kullanım avantajlarından faydalanabilirsiniz.



8,340 soru
8,296 cevap
4,679 yorum
16,839 kullanıcı