예스스탁
예스스탁 답변
2022-12-12 15:38:02
안녕하세요
예스스탁입니다.
1 지표
input : Periods(10),Multiplier(3.0),changeATR(true),showsignals(true),highlighting(true);
var : src(0),ATr2(0),ATrv(0),up(0),up1(0),dn(0),dn1(0),trend(0);
src = (h+l)/2;
atr2 = ma(TrueRange, Periods);
atrv= IFf(changeATR ,atr(Periods) , atr2);
up = src-(Multiplier*atrv);
up1 = iff(IsNan(up[1])==False,up[1],up);
up = iff(close[1] > up1 , max(up,up1) , up);
dn = src+(Multiplier*atrv);
dn1 = iff(IsNan(dn[1])==False,dn[1],dn);
dn = iff(close[1] < dn1 , min(dn, dn1) , dn);
trend = 1;
trend = iff(trend[1] == False,trend[1], trend);
trend = iff(trend == -1 and close > dn1 , 1 , iff(trend == 1 and close < up1 , -1 , trend));
if trend == 1 Then
plot1(up,"Up Trend",green);
Else
NoPlot(1);
if trend == -1 Then
plot2(dn,"down Trend",Red);
Else
NoPlot(2);
2 시스템
input : Periods(10),Multiplier(3.0),changeATR(true),showsignals(true),highlighting(true);
var : src(0),ATr2(0),ATrv(0),up(0),up1(0),dn(0),dn1(0),trend(0);
src = (h+l)/2;
atr2 = ma(TrueRange, Periods);
atrv= IFf(changeATR ,atr(Periods) , atr2);
up = src-(Multiplier*atrv);
up1 = iff(IsNan(up[1])==False,up[1],up);
up = iff(close[1] > up1 , max(up,up1) , up);
dn = src+(Multiplier*atrv);
dn1 = iff(IsNan(dn[1])==False,dn[1],dn);
dn = iff(close[1] < dn1 , min(dn, dn1) , dn);
trend = 1;
trend = iff(trend[1] == False,trend[1], trend);
trend = iff(trend == -1 and close > dn1 , 1 , iff(trend == 1 and close < up1 , -1 , trend));
if trend == 1 and trend != trend[1] Then
Buy();
if trend == -1 and trend != trend[1] Then
Sell();
즐거운 하루되세요
> 장군 님이 쓴 글입니다.
> 제목 : 문의드립니다
> 1 study("Supertrend", overlay = true, format=format.price, precision=2, resolution="")
2 Periods = input(title="ATR Period", type=input.integer, defval=10)
3 src = input(hl2, title="Source")
4 Multiplier = input(title="ATR Multiplier", type=input.float, step=0.1, defval=3.0)
5 changeATR= input(title="Change ATR Calculation Method ?", type=input.bool, defval=true)
6 showsignals = input(title="Show Buy/Sell Signals ?", type=input.bool, defval=true)
7 highlighting = input(title="Highlighter On/Off ?", type=input.bool, defval=true)
8 atr2 = sma(tr, Periods)
9 atr= changeATR ? atr(Periods) : atr2
10 up=src-(Multiplier*atr)
11 up1 = nz(up[1],up)
12 up := close[1] > up1 ? max(up,up1) : up
13 dn=src+(Multiplier*atr)
14 dn1 = nz(dn[1], dn)
15 dn := close[1] < dn1 ? min(dn, dn1) : dn
16 trend = 1
17 trend := nz(trend[1], trend)
18 trend := trend == -1 and close > dn1 ? 1 : trend == 1 and close < up1 ? -1 : trend
19 upPlot = plot(trend == 1 ? up : na, title="Up Trend", style=plot.style_linebr, linewidth=2, color=color.green)
20 buySignal = trend == 1 and trend[1] == -1
21 plotshape(buySignal ? up : na, title="UpTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.green, transp=0)
22 plotshape(buySignal and showsignals ? up : na, title="Buy", text="Buy", location=location.absolute, style=shape.labelup, size=size.tiny, color=color.green, textcolor=color.white, transp=0)
23 dnPlot = plot(trend == 1 ? na : dn, title="Down Trend", style=plot.style_linebr, linewidth=2, color=color.red)
24 sellSignal = trend == -1 and trend[1] == 1
25 plotshape(sellSignal ? dn : na, title="DownTrend Begins", location=location.absolute, style=shape.circle, size=size.tiny, color=color.red, transp=0)
26 plotshape(sellSignal and showsignals ? dn : na, title="Sell", text="Sell", location=location.absolute, style=shape.labeldown, size=size.tiny, color=color.red, textcolor=color.white, transp=0)
27 mPlot = plot(ohlc4, title="", style=plot.style_circles, linewidth=0)
28 longFillColor = highlighting ? (trend == 1 ? color.green : color.white) : color.white
29 shortFillColor = highlighting ? (trend == -1 ? color.red : color.white) : color.white
30 fill(mPlot, upPlot, title="UpTrend Highligter", color=longFillColor)
31 fill(mPlot, dnPlot, title="DownTrend Highligter", color=shortFillColor)
32 alertcondition(buySignal, title="SuperTrend Buy", message="SuperTrend Buy!")
33 alertcondition(sellSignal, title="SuperTrend Sell", message="SuperTrend Sell!")
34 changeCond = trend != trend[1]
35 alertcondition(changeCond, title="SuperTrend Direction Change", message="SuperTrend has changed direction!")
위수식을예스트레이더로변경부탁드립니다~~