0% found this document useful (0 votes)
7 views2 pages

99

Uploaded by

samenictv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

99

Uploaded by

samenictv
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

//@version=5

indicator(title='Combined EMA Scalping Strategy', overlay=true)

// EMA Inputs
default_ema_period = input.int(70, title='Default EMA')
fast_ema_period = input.int(43, title='Fast EMA')
slow_ema7_period = input.int(30, title='Slow EMA 7')
slow_ema8_period = input.int(35, title='Slow EMA 8')
slow_ema9_period = input.int(40, title='Slow EMA 9')
slow_ema10_period = input.int(45, title='Slow EMA 10')
slow_ema11_period = input.int(50, title='Slow EMA 11')
slow_ema12_period = input.int(60, title='Slow EMA 12')

// Calculate EMAs
fast_ema = ta.ema(close, fast_ema_period)
slow_ema7 = ta.ema(close, slow_ema7_period)
slow_ema8 = ta.ema(close, slow_ema8_period)
slow_ema9 = ta.ema(close, slow_ema9_period)
slow_ema10 = ta.ema(close, slow_ema10_period)
slow_ema11 = ta.ema(close, slow_ema11_period)
slow_ema12 = ta.ema(close, slow_ema12_period)
default_ema = ta.ema(close, default_ema_period)

// Determine Uptrend, Downtrend


is_uptrend = slow_ema7 > slow_ema8 and slow_ema8 > slow_ema9 and slow_ema9 >
slow_ema10 and slow_ema10 > slow_ema11 and slow_ema11 > slow_ema12 and slow_ema12 >
default_ema
is_downtrend = slow_ema7 < slow_ema8 and slow_ema8 < slow_ema9 and slow_ema9 <
slow_ema10 and slow_ema10 < slow_ema11 and slow_ema11 < slow_ema12 and slow_ema12 <
default_ema

// Trend Colors
downtrend_color = #4682B4
uptrend_color = #00FFFF
neutral_color = #e9112e

// Function to determine color based on market trend


get_ema_color() =>
is_uptrend ? uptrend_color : is_downtrend ? downtrend_color : neutral_color

// Plot EMAs with trend-based colors


plot(series=slow_ema7, title='Slow EMA 7', color=get_ema_color(), linewidth=3)
plot(series=slow_ema8, title='Slow EMA 8', color=get_ema_color(), linewidth=3)
plot(series=slow_ema9, title='Slow EMA 9', color=get_ema_color(), linewidth=3)
plot(series=slow_ema10, title='Slow EMA 10', color=get_ema_color(), linewidth=3)
plot(series=slow_ema11, title='Slow EMA 11', color=get_ema_color(), linewidth=3)
plot(series=slow_ema12, title='Slow EMA 12', color=get_ema_color(), linewidth=3)

// Simplified Buy and Sell Conditions


long_condition = ta.crossover(fast_ema, default_ema)
short_condition = ta.crossunder(fast_ema, default_ema)

// Plot Buy and Sell Signals


plotshape(series=long_condition, style=shape.labelup, color=#00CCCC, text='BUY',
textcolor=color.white, location=location.belowbar, size=size.normal)
plotshape(series=short_condition, style=shape.labeldown, color=#4682B4,
text='SELL', textcolor=color.white, location=location.abovebar, size=size.normal)

// Custom Candlestick Coloring


plotcandle(open, high, low, close, color=is_uptrend ? color.rgb(0, 255, 255) :
is_downtrend ? color.rgb(70, 130, 180) : na,
wickcolor=is_uptrend ? color.rgb(0, 255, 255) : is_downtrend ? color.rgb(70, 130,
180) : na,
bordercolor=is_uptrend ? color.rgb(0, 255, 255) : is_downtrend ? color.rgb(70,
130, 180) : na)

You might also like