커뮤니티

부탁드립니다

프로필 이미지
매치다2
2023-06-21 13:41:48
1374
글번호 169946
답변완료
//@version=5 indicator("Super Secret 200 EMA", overlay=true) length = input(10, "Supertrend Length") multiplier = input.float(3.0, "Supertrend Multiplier") emaPeriod = input(200, "EMA Period") // Calculate Supertrend var float supertrend = na var float highestHigh = na var float lowestLow = na for i = length to 1 if ta.change(close[i]) > 0 highestHigh := math.max(highestHigh, high[i]) else lowestLow := math.min(lowestLow, low[i]) supertrend := ta.change(close) > 0 ? lowestLow + multiplier * ta.atr(length) : highestHigh - multiplier * ta.atr(length) supertrendColor = supertrend > ta.ema(close, emaPeriod) ? color.green : color.red // Calculate 200 EMA ema200 = ta.ema(close, emaPeriod) emaColor = close > ema200 ? color.green : color.red // Plot Supertrend and EMA plot(supertrend, color=supertrendColor, title="Supertrend") plot(ema200, color=emaColor, title="200 EMA") // Determine Buy and Sell Conditions buyCondition = ta.crossover(close, ema200) and close > supertrend sellCondition = ta.crossunder(close, ema200) and close < supertrend // Plot Buy and Sell Signals plotshape(buyCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="Buy") plotshape(sellCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="Sell")
지표
답변 1
프로필 이미지

예스스탁 예스스탁 답변

2023-06-21 18:02:58

안녕하세요 예스스탁입니다. 1 지표 input : length(10),multiplier(3.0),emaPeriod(200); var : supertrend(0),highestHigh(0),lowestLow(0); var : atrv(0),ii(0),supertrendcolor(0); var : ema200(0),emaColor(0); ATRV = ATR(length); supertrend = 0; highestHigh = 0; lowestLow = 0; for ii = length downto 1 { if close[ii] > close[ii+1] Then { if highestHigh == 0 or (highestHigh > 0 and high[ii] > highestHigh) Then highestHigh = high[ii]; } else { if lowestLow == 0 or (lowestLow > 0 and low[ii] < lowestLow) Then lowestLow = low[ii]; } } supertrend = iff(close > close[1] , lowestLow + multiplier * ATRV, highestHigh - multiplier * ATRV); supertrendColor = iff(supertrend > ema(close, emaPeriod) , green , red); ema200 = ema(close, emaPeriod); emaColor = iff(close > ema200 , green , red); plot1(supertrend, "Supertrend",supertrendColor); plot2(ema200,"200 EMA",emaColor); 2 시스템 //@version=5 input : length(10),multiplier(3.0),emaPeriod(200); var : supertrend(0),highestHigh(0),lowestLow(0); var : atrv(0),ii(0),supertrendcolor(0); var : ema200(0),emaColor(0); ATRV = ATR(length); supertrend = 0; highestHigh = 0; lowestLow = 0; for ii = length downto 1 { if close[ii] > close[ii+1] Then { if highestHigh == 0 or (highestHigh > 0 and high[ii] > highestHigh) Then highestHigh = high[ii]; } else { if lowestLow == 0 or (lowestLow > 0 and low[ii] < lowestLow) Then lowestLow = low[ii]; } } supertrend = iff(close > close[1] , lowestLow + multiplier * ATRV, highestHigh - multiplier * ATRV); supertrendColor = iff(supertrend > ema(close, emaPeriod) , green , red); ema200 = ema(close, emaPeriod); emaColor = iff(close > ema200 , green , red); if CrossUp(c,Ema200) and c > SuperTrend Then Buy(); if CrossDown(c,Ema200) and c < SuperTrend Then Sell(); 즐거운 하루되세요 > 매치다2 님이 쓴 글입니다. > 제목 : 부탁드립니다 > //@version=5 indicator("Super Secret 200 EMA", overlay=true) length = input(10, "Supertrend Length") multiplier = input.float(3.0, "Supertrend Multiplier") emaPeriod = input(200, "EMA Period") // Calculate Supertrend var float supertrend = na var float highestHigh = na var float lowestLow = na for i = length to 1 if ta.change(close[i]) > 0 highestHigh := math.max(highestHigh, high[i]) else lowestLow := math.min(lowestLow, low[i]) supertrend := ta.change(close) > 0 ? lowestLow + multiplier * ta.atr(length) : highestHigh - multiplier * ta.atr(length) supertrendColor = supertrend > ta.ema(close, emaPeriod) ? color.green : color.red // Calculate 200 EMA ema200 = ta.ema(close, emaPeriod) emaColor = close > ema200 ? color.green : color.red // Plot Supertrend and EMA plot(supertrend, color=supertrendColor, title="Supertrend") plot(ema200, color=emaColor, title="200 EMA") // Determine Buy and Sell Conditions buyCondition = ta.crossover(close, ema200) and close > supertrend sellCondition = ta.crossunder(close, ema200) and close < supertrend // Plot Buy and Sell Signals plotshape(buyCondition, title="Buy Signal", location=location.belowbar, color=color.green, style=shape.labelup, text="Buy") plotshape(sellCondition, title="Sell Signal", location=location.abovebar, color=color.red, style=shape.labeldown, text="Sell")