What`s the best way to code this ?

 

Hello,


What would be the best way to code an alert as follow :

After 3 RED bars if a BLUE Bar appears : Alert

After 3 BLUE bars if a RED Bar appears : Alert


Knowing that BLUE bars are "buffer0" and RED bars are "buffer1"


My main difficulty is that the colored bars are not following each other, therefore I have to record the sequence of the last 3, and I`ve got no idea on how to do it ...


Help ?


Ideally the alert would also look at what happened in the last 100 bars and not just record in "real time" .




3lb

 

well, i'm not sure how your indicator works, but i would do this way:

1. create int variables to count red and blue bars

2. when you count blue bars any appearance of red bar changes blue count to 0

3. when you reach blue count=3 then you can set something like bool RedAlert=true, and then after first red bar run alert


i'm sure there are many ways to make it in different way

hope it makes sense

regards

 
Yeah, it does make sense . Thanks for your help ! :)