Welcome to the BEST forum for traders

Did you know we're sharing tons of exclusive content here?
Our community is growing quickly. Take a look around and say "Hello".

Adding alerts condition for Madrid Ribbon Moving Average

Dec 9, 2022 - 10:36 PM

Viewed 960 times

https://best-trading-indicator.com/community/bti/forums/4180/topics/1476513 COPY
  • Hello,
    I'm new to pinescript but I have some basics in other language codes. I wanted to ask if it possible to add an alertcondition when all the bars of the indicator become green or red. There are two conditions in the code for it to happen. I think it's the leadMAColor and maColor(ma, maRef) but I dont know how to put them both into the same alert condition.
    Thank you for responding

    Capture.jpg

    2.jpg

    0
  • You'll have to use the alert function
    https://www.tradingview.com/pine-script-reference/v5/#fun_alert

    0
    • Yes, I know, I used it but I dont know which variable to take for the maColor. If I understand the code well, first I have variable declaration and then the condition for them to change. So I would write : alertcondition(leadMAColor, title='Alerts' , message ='color change'). However the maColor function also participate in this change, I dont know how to put it in the same alert.
    • Second thing I dont understand the lines : plot( 10, color=maColor(ma10,ma100), style=columns, title=MMA10, linewidth=2, histbase=05). Is it the display ?
    • Also I have an error with my alert : Error: root_alert_cond expression of alert_0 has invalid type: series__color expected series. Is it a version problem ?

    Thank you.

    0
CONTENTS