TradingView
HPotter
10. Jun. 2020 09:56

Simple SMA Indicator 

E-mini S&P 500 FuturesCME

Beschreibung

I the this part we are creating first script with indicator logic.
Kommentare
ICEKI
The indicator name "Simple" I just love it. Sometime the easy and simple approach is always the best. Thank You so much HPotter for always create the indicators for us; appreciated <3
HPotter
@ICEKI, You are welcome.
stockplan
THANKS
HPotter
@stockplan, You are welcome.
czexodus
thx.

...... update Color

// This source code is subject to the terms of the Mozilla Public License 2.0 at mozilla.org/MPL/2.0/
// © HPotter
// Simple SMA strategy
//
// WARNING:
// - For purpose educate only
//@version=4

study(title="Simple SMA Indicator", shorttitle="S SMA I", precision=6, overlay=true)
Resolution = input(title="Resolution", type=input.resolution, defval="D")
Source = input(title="Source", type=input.source, defval=close)
xSeries = security(syminfo.tickerid, Resolution, Source)
Length = input(title="Length", type=input.integer, defval=14, minval=2)
xSMA = sma(xSeries, Length)
plot(xSMA, title='SMA',color=close >= xSMA ? #4CAF50 : #FF5252 , linewidth=2, style=plot.style_line)
//plot(xSMA, title='SMA', color=#00ffaa, linewidth=2, style=plot.style_line)
HPotter
Mehr