ML2

SMA

4750 obejrzeń
794
SMA 100 200 10 20 50
Usuń z Ulubionych Skryptów Dodaj do Ulubionych Skryptów

Komentarze

::Update ::
- Change -
Remove MA 10
Remove MA20
Add MA 9
Add MA 21
Add Crossing MA 9&21 indicator
Converting to V4

///////////////////////////////////////////////////////SCRIPT//////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////
//Free to use and modifie, like always appreciated :) //
//Review commentary welcome
// © ML2 //
//////////////////////////////////////////////////////
//@version=4

strategy("MA", overlay=true)
//
src = input(close, title="Source")

//Volume

//SMA
plot(sma(close, 9), color=color.orange, linewidth=4, title='9')
plot(sma(close, 21), color=color.gray, linewidth=4, title='21')
plot(sma(close, 50), color=color.aqua, linewidth=3, title='50')
plot(sma(close, 100), color=color.green, linewidth=4, title='100')
plot(sma(close, 200), color=color.purple, linewidth=3, title='200')
plot(sma(close, 500), color=color.olive, linewidth=4, title='500')
plot(sma(close, 730), color=color.navy, linewidth=5, title='2YEARS')

//SMA High Low
//plot(sma(high,10),color = gray,linewidth=1, title = '10 High')
//plot(sma(low,200),color = red,linewidth=1, title = '200 Low')

//Golden Cross MA 50 & 200
ma50 = input(50, minval=1, title="Moving Average 50")
ma200 = input(200, minval=1, title="Moving Average 200")

exponential = input(false, title="Exponential MA")
ema_1 = ema(src, ma50)
sma_1 = sma(src, ma50)
select1 = exponential ? ema_1 : sma_1
ema_2 = ema(src, ma200)
sma_2 = sma(src, ma200)
select2 = exponential ? ema_2 : sma_2

golden_cross() =>
select1 > select2
death_cross() =>
select1 < select2

Golden() =>
golden_cross() and death_cross()
Death() =>
death_cross() and golden_cross()
Death_1 = Death()
bgcolor(Golden() ? #FFD700 : Death_1 ? #D3D3D3 : na, transp=0, title="Golden & Death Cross Background Color")

//Golden Cross MA 9 & 21
ma9 = input(9, minval=1, title="Moving Average 9")
ma21 = input(21, minval=1, title="Moving Average 2")

exponential1 = input(false, title="Exponential MA")
ema_9 = ema(src, ma9)
sma_9 = sma(src, ma9)
select9 = exponential ? ema_9 : sma_9
ema_21 = ema(src, ma21)
sma_21 = sma(src, ma21)
select21 = exponential ? ema_21 : sma_21

MA_9_21_cross() =>
select9 > select21
MA_21_9_cross() =>
select9 < select21

Cross1() =>
MA_9_21_cross() and MA_21_9_cross()
Cross2() =>
MA_21_9_cross() and MA_9_21_cross()
Cross219 = Cross1()
bgcolor(Cross2() ? #FF9800 : Cross219 ? #00E676 : na, transp=0, title="MA 21 9 cross")

//////////////////////////////////////////////////////
//Free to use and modifie, like always appreciated :) //
//Review commentary welcome //
//////////////////////////////////////////////////////
Odpowiedz
Update with MA 500 et 2years

//@version=4
strategy("MA", overlay=true)
//
src = input(close, title="Source")

//Volume

//SMA
plot(sma(close, 10), color=color.orange, linewidth=4, title='10')
plot(sma(close, 20), color=color.gray, linewidth=4, title='20')
plot(sma(close, 50), color=color.aqua, linewidth=3, title='50')
plot(sma(close, 100), color=color.green, linewidth=4, title='100')
plot(sma(close, 200), color=color.purple, linewidth=3, title='200')
plot(sma(close, 500), color=color.olive, linewidth=4, title='500')
plot(sma(close, 730), color=color.navy, linewidth=5, title='2YEARS')

//SMA High Low
//plot(sma(high,10),color = gray,linewidth=1, title = '10 High')
//plot(sma(low,200),color = red,linewidth=1, title = '200 Low')

//Golden Cross MA 50 & 200
ma50 = input(50, minval=1, title="Moving Average 50")
ma200 = input(200, minval=1, title="Moving Average 200")

exponential = input(false, title="Exponential MA")
ema_1 = ema(src, ma50)
sma_1 = sma(src, ma50)
select1 = exponential ? ema_1 : sma_1
ema_2 = ema(src, ma200)
sma_2 = sma(src, ma200)
select2 = exponential ? ema_2 : sma_2

golden_cross() =>
select1 > select2
death_cross() =>
select1 < select2

Golden() =>
golden_cross() and death_cross()
Death() =>
death_cross() and golden_cross()
Death_1 = Death()
bgcolor(Golden() ? #FFD700 : Death_1 ? #D3D3D3 : na, transp=0, title="Golden & Death Cross Background Color")

plotshape(Golden(), color=color.black, style=shape.xcross, text="Golden Cross", location=location.top)
plotshape(Death(), color=color.black, style=shape.xcross, text="Death Cross", location=location.top)
Odpowiedz
Strona główna Skaner akcji Skaner Forex Skaner Krypto Kalendarz ekonomiczny Jak to działa Funkcje wykresów Cennik Poleć przyjaciela Dobre Praktyki Centrum Pomocy Rozwiązania internetowe i brokerskie Widżety Wykresy Lekka Biblioteka Wykresów Blog i wiadomości Twitter
Profil Ustawienia profilu Konto i płatności Poleceni znajomi Monety Wiadomości do działu obsługi Centrum Pomocy Opublikowane Pomysły Obserwujący Obserwujesz Wiadomość prywatna Czat Wyloguj