yerb

4x MA cross script, i need some help

BTCE:BTCUSD   Bitcoin / U.S. Dollar
200 views
0
200 2
I would like to have a yellow dot on all crosses. Please share it if you add the feature. Thanx.
With configurable EMA lengths

//----------- start copying here -----------------------------------------------------------------
study(title="4x MA Cross", overlay=true)
ma1_p=input(8, title="EMA1 Length")
ma2_p=input(20, title="EMA2 Length")
ma3_p=input(50, title="EMA3 Length")
ma4_p=input(200, title="EMA4 Length")
ma1 = ema(close, ma1_p)
ma2 = sma(close, ma2_p)
ma3 = sma(close, ma3_p)
ma4 = sma(close, ma4_p)
plot(ma1, color = #00ffff, linewidth = 2)
plot(ma2, color = #ff9800, linewidth = 2)
plot(ma3, color = #cc4125, linewidth = 2)
plot(ma4, color = #00ff00, linewidth = 2)
plot(cross(ma1, ma2) or cross(ma1, ma3) or cross(ma1, ma4) ? ma1 : na, style = circles, linewidth = 4 , color = #ffaa00)
plot(cross(ma2, ma3) or cross(ma2, ma4) ? ma2 : na, style = circles, linewidth = 4 , color = lime)
plot(cross(ma3, ma4) ? ma3 : na, style = circles, linewidth = 4 , color = aqua)
//--------------------- end_copy ------------------------------------------------------------------
+1 Reply
Try this.

study(title="4x MA Cross", overlay=true)
ma1 = ema(close, 8)
ma2 = sma(close, 20)
ma3 = sma(close, 50)
ma4 = sma(close, 200)
plot(ma1, color = #00ffff, linewidth = 2)
plot(ma2, color = #ff9800, linewidth = 2)
plot(ma3, color = #cc4125, linewidth = 2)
plot(ma4, color = #00ff00, linewidth = 2)
plot(cross(ma1, ma2) or cross(ma1, ma3) or cross(ma1, ma4) ? ma1 : na, style = circles, linewidth = 4 , color = #ffaa00)
plot(cross(ma2, ma3) or cross(ma2, ma4) ? ma2 : na, style = circles, linewidth = 4 , color = lime)
plot(cross(ma3, ma4) ? ma3 : na, style = circles, linewidth = 4 , color = aqua)
+1 Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Charting Solutions Get Help Feature Request Blog & News FAQ Wiki Twitter
Profile Profile Settings Account and Billing Get Help Ideas Published Followers Following Private Messages Chat Sign Out