I would like to have have a bubble show on my chart when the 50MA crosses below the 100MA; the bubble text will be state "Short". Can anyone help me with this?
# Moving Average Crossover With Arrows, Alerts, Crossing Count and Bubble at Cross # Mobius # Chat Room Request 01.25.2017 input price = close; input fastLength = 20; input slowLength = 50; input averageType = AverageType.EXPONENTIAL; plot FastMA = MovingAverage(averageType, price, fastLength); plot SlowMA = MovingAverage(averageType, price, slowLength); FastMA.SetDefaultColor(GetColor(1)); SlowMA.SetDefaultColor(GetColor(2)); plot ArrowUp = if FastMA crosses above SlowMA then low else double.nan; ArrowUP.SetPaintingStrategy(PaintingStrategy.Arrow_UP); ArrowUP.SetLineWeight(3); ArrowUP.SetDefaultColor(Color.Green); plot ArrowDN = if FastMA crosses below SlowMA then high else double.nan; ArrowDN.SetPaintingStrategy(PaintingStrategy.Arrow_DOWN); ArrowDN.SetLineWeight(3); ArrowDN.SetDefaultColor(Color.Red); Alert(ArrowUp, " ", Alert.Bar, Sound.Chimes); Alert(ArrowDN, " ", Alert.Bar, Sound.Bell); def countUP = if FastMA crosses above SlowMA then 1 else if FastMA > SlowMA then countUP + 1 else if ArrowDN then 0 else countUP; AddLabel(1, "Count UP = " + countUP, color.white); def CrossBar = if FastMA crosses SlowMa then barNumber() else double.nan; AddChartBubble(barNumber() == HighestAll(CrossBar), FastMA, "Cross", color.cyan); # End Code
You said you wanted to be taught. So look where averagetype is used in the study. And change the averagtype for the plot you want to change. Looks like you wanted a 50 EMA cross of 75 SMA. So think how you would do that.
|Thread starter||Similar threads||Forum||Replies||Date|
|T||Add Chart Bubble On Previous Candle||Questions||12|
|G||ripster watchlist using ema bands with macd been looking for a complete tos script i got ttm and macd but not sure how to add his chart logic||Questions||4|
|B||Is it possible to add more than 1 color to a comparison chart?||Questions||0|
|Daily MA on 1m chart need to add some code for additional adjustments||Questions||1|
|K||Possible to add smaller timeframe to chart?||Questions||1|