initial commit
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
//@version=5
|
||||
indicator("TTM Trend + SMA Crossover + 100 SMA", overlay=true)
|
||||
|
||||
// Trend baseline
|
||||
length = input.int(20, "Trend Length")
|
||||
ma = ta.sma(close, length)
|
||||
|
||||
// Candle colors (TTM Trend)
|
||||
trendColor = close > ma ? color.blue : close < ma ? color.red : color.gray
|
||||
plotcandle(open, high, low, close,
|
||||
color=trendColor,
|
||||
wickcolor=trendColor,
|
||||
bordercolor=trendColor,
|
||||
title="TTM Trend Candles")
|
||||
|
||||
// SMA crossover logic
|
||||
fastLen = input.int(8, "Fast SMA")
|
||||
slowLen = input.int(18, "Slow SMA")
|
||||
|
||||
fastMA = ta.sma(close, fastLen)
|
||||
slowMA = ta.sma(close, slowLen)
|
||||
|
||||
plot(fastMA, color=color.yellow, title="8 SMA")
|
||||
plot(slowMA, color=color.purple, title="18 SMA")
|
||||
|
||||
// Add 100 SMA in white
|
||||
sma100 = ta.sma(close, 100)
|
||||
plot(sma100, color=color.white, title="100 SMA")
|
||||
|
||||
// Detect crossovers
|
||||
bullCross = ta.crossover(fastMA, slowMA)
|
||||
bearCross = ta.crossunder(fastMA, slowMA)
|
||||
|
||||
// Print buy/sell labels
|
||||
plotshape(bullCross, title="Buy Signal", text="BUY", style=shape.labelup,
|
||||
location=location.belowbar, color=color.green, textcolor=color.white, size=size.tiny)
|
||||
|
||||
plotshape(bearCross, title="Sell Signal", text="SELL", style=shape.labeldown,
|
||||
location=location.abovebar, color=color.red, textcolor=color.white, size=size.tiny)
|
||||
Reference in New Issue
Block a user