RicardoSantos

[RS]Moving Average Cross System V0

moving average crossover with added functions:
if you want crossover with price set ma1 length to 1, or use as dual ma with both lengths, ability to turn ma's on and off leaving the crossover signals behind, ability to chose ma mode (sma, ema, rma, wma, vwma, swma and alma), ability to chose source (open, high, low, close, hl2, hlc3 or ohlc4).
Açık kaynak kodlu komut dosyası

Gerçek TradingView ruhuyla, bu betiğin yazarı, yatırımcının anlayabilmesi ve doğrulayabilmesi için onu açık kaynak olarak yayınladı. Yazarın eline sağlık! Bunu ücretsiz olarak kullanabilirsiniz, ancak bu kodun bir yayında yeniden kullanımı Kullanım Koşulları ile yönetilir. Bir grafikte kullanmak için favorilere ekleyebilirsiniz.

Feragatname

Bilgiler ve yayınlar, TradingView tarafından sağlanan veya onaylanan finansal, yatırım, işlem veya diğer türden tavsiye veya tavsiyeler anlamına gelmez ve teşkil etmez. Kullanım Şartları'nda daha fazlasını okuyun.

Bu komut dosyasını bir grafikte kullanmak ister misiniz?
study(title="[RS]Moving Average Cross System V0", shorttitle="[RS]MACS.V0", overlay=true)
matype = input("sma")
hidema = input(false)
sourcetype = input("close")
source = sourcetype == "open" ? open :
        sourcetype == "high" ? high :
        sourcetype == "low" ? low :
        sourcetype == "close" ? close :
        sourcetype == "hl2" ? hl2 :
        sourcetype == "hlc3" ? hlc3 :
        sourcetype == "ohlc4" ? ohlc4 : na

length1 = input(1)
length2 = input(10)

ma1 = matype == "sma" ? sma(source, length1) :
        matype == "ema" ? ema(source, length1) : 
        matype == "rma" ? rma(source, length1) :
        matype == "wma" ? wma(source, length1) :
        matype == "vwma" ? vwma(source, length1) :
        matype == "swma" ? sma(swma(source), length1) :
        matype == "alma" ? alma(source, length1, 0.85, 0) : na
ma2 = matype == "sma" ? sma(source, length2) :
        matype == "ema" ? ema(source, length2) : 
        matype == "rma" ? rma(source, length2) :
        matype == "wma" ? wma(source, length2) :
        matype == "vwma" ? vwma(source, length2) :
        matype == "swma" ? sma(swma(source), length2) :
        matype == "alma" ? alma(source, length1, 0.85, 0) : na

signal = cross(ma1, ma2) ? ma2 : na
signalcolor = source > ma2 ? green : maroon
plot(hidema ? na : ma1, color=gray, linewidth=1)
plot(hidema ? na : ma2, color=black, linewidth=1)
plot(signal, style=cross, color=signalcolor, linewidth=4)