简体   繁体   中英

Need Help for creating a Braid Filter alert by changing Color (pine Script)

can you help me with the Pine Script? The Braid Filter indicator is painting in 3 colors.

I need an alert for:

  1. green bars change in red
  2. red bars change in green
  3. gray bars change in red
  4. gray bars change in green

Thats my plot: BraidColor = ma01 > ma02 and dif > filter? color.green: ma02 > ma01 and dif > filter? color.red: color.gray

Thx for help.

I have tryed some thing alert from "https://stackoverflow.com/questions/71015467/how-to-create-alert-when-indicator-color-changes-pine-script "

but it doesn't work well.

Thx.

to make the code cleaner, separate the colors

bGreen   = (ma01 > ma02 and dif > filter)
bRed     = (ma02 > ma01 and dif > filter)
bGray    = not bGreen and not bRed

And now you can create clearer rules in your alerts

alertcondition((not bGreen[1] and bRed), "Green to Red", "Green to Red")
alertcondition((not bRed[1] and bGreen), "Red to Green", "Red to Green")
alertcondition((not bGray[1] and bRed), "Gray to Red", "Gray to Red")
alertcondition((not bGray[1] and bGreen), "Gray to Green", "Gray to Green")

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM