[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Alert Trigger Coding Paradox



PureBytes Links

Trading Reference Links

I want to sound an alert whenever price touches a value I mathematically
calculate, MyAlertValue. That calculated value however may not exactly equal an
allowed price for a market. For example, MyAlertValue = 1110.17 in an Emini
chart but the Emini only trades in .25 increments. So the line (in an Update
Every Tick chart):
   if close = MyAlertValue 
does not work since price will never equal 1110.17 (only 1110.25 or 1110.0).
Nor can I use the line:
   if close >= MyAlertValue or close <= MyAlertValue
since the price will always be higher or lower than a given value and the alert
always triggers. Also, using close[1] and close to test price direction:
  close[1] < MyAlertValueand close >= MyAlertValue) or (close[1] > MyAlertValue
and close <= MyAlertValue)
doesn't work since close[1] is the close of the previous bar, not the previous
price tick of the current bar.

So how does one code an alert to trigger when price in a chart touches a given
price from above or below?

Thanks!