vyacheslav.shindin

Turbo option strategy

Strategy for turbo option

Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?
study("One minut option strategy", overlay=true)

len = input(title="Length", type=integer, defval=3)

TrueRange = max(max(high-low, abs(high-nz(close[1]))), abs(low-nz(close[1])))
DirectionalMovementPlus = high-nz(high[1]) > nz(low[1])-low ? max(high-nz(high[1]), 0): 0
DirectionalMovementMinus = nz(low[1])-low > high-nz(high[1]) ? max(nz(low[1])-low, 0): 0

SmoothedTrueRange = nz(SmoothedTrueRange[1]) - (nz(SmoothedTrueRange[1])/len) + TrueRange
SmoothedDirectionalMovementPlus = nz(SmoothedDirectionalMovementPlus[1]) - (nz(SmoothedDirectionalMovementPlus[1])/len) + DirectionalMovementPlus
SmoothedDirectionalMovementMinus = nz(SmoothedDirectionalMovementMinus[1]) - (nz(SmoothedDirectionalMovementMinus[1])/len) + DirectionalMovementMinus

DIPlus = SmoothedDirectionalMovementPlus / SmoothedTrueRange * 100
DIMinus = SmoothedDirectionalMovementMinus / SmoothedTrueRange * 100
DX = abs(DIPlus-DIMinus) / (DIPlus+DIMinus)*100
ADX = sma(DX, len)

val = (DIPlus - DIMinus) * ADX
smaval = sma(val, 8)

//plot(val, color=val > 0 ? green : red, style=histogram, linewidth=4)
//plot(sma(val, 8), color=val > 0 ? green : red, style=histogram, linewidth=4)

source = close
fastLength = input(3, minval=1), slowLength=input(7,minval=1)

// TEMA
ema1 = ema(source, fastLength)
ema2 = ema(ema1, fastLength)
ema3 = ema(ema2, fastLength)
fastMA = 3 * (ema1 - ema2) + ema3

// DEMA
e1 = ema(source, slowLength)
e2 = ema(e1, slowLength)
slowMA = 2 * e1 - e2

hist = fastMA - slowMA

plotshape(hist > 0 and val > val[1] and smaval > smaval[1] ? 1 : na, color=lime, style=shape.arrowup, text="Buy")
plotshape(hist < 0 and val < val[1] and smaval < smaval[1] ? -1 : na, color=red, style=shape.arrowdown, text="Sell")