Newbie needs help on Alert during CURRENT Bar coss

 
I'm writing an indicator with a moving average crossing a bar with an Alert. But, the Alert toggles on and off a number of times during the current bar. What could I do to prevent the alert to go off so many times while the moving average is crossing that bar? Or, maybe what function if any, can I use so that the Alert will go off only at the END of the current bar or After the moving average crossed the current bar. You help is appreciate it. Thank you.
 
tigger:
I'm writing an indicator with a moving average crossing a bar with an Alert. But, the Alert toggles on and off a number of times during the current bar. What could I do to prevent the alert to go off so many times while the moving average is crossing that bar? Or, maybe what function if any, can I use so that the Alert will go off only at the END of the current bar or After the moving average crossed the current bar. You help is appreciate it. Thank you.

I think the simplest thing to do is to send an alert when MA crossed previous bar- this will give you a signal but with lag. You can also define a static variable "Status=0" and add a condition that if a bar is crossed by MA then send alert and change Status to 1. The alert would go off only if Status = 0. Of course when next bar begins, the status would change from 1 to 0. But this method will send you false signals because during one bar the MA could cross it lets say upwards and then again downwards- like nothing happen. You can also try both methods, but on smaller time periods (multiplying MA value accordingly to time period decrease). I don't know if this helps you- I hope so.

Tom

 
ziebol1 wrote >>

I think the simplest thing to do is to send an alert when MA crossed previous bar- this will give you a signal but with lag. You can also define a static variable "Status=0" and add a condition that if a bar is crossed by MA then send alert and change Status to 1. The alert would go off only if Status = 0. Of course when next bar begins, the status would change from 1 to 0. But this method will send you false signals because during one bar the MA could cross it lets say upwards and then again downwards- like nothing happen. You can also try both methods, but on smaller time periods (multiplying MA value accordingly to time period decrease). I don't know if this helps you- I hope so.

Tom

Thanks Tom, can you provide me with a brief examples with using the Status=0 condition?

Reason: