Skip to main content
Compare Moving Averages With Price

Check real time prices agains a moving average for prompt executions

Oleg Giberstein avatar
Written by Oleg Giberstein
Updated over 10 months ago

How To Compare Moving Averages With Price

When using "MA greater than / lower than price" the bot compares the value of the most-recently available moving average with the last traded price.

If your rule features an “MA greater than or lower than price” condition and specifies 1-hour timeframe, the rule will use the previous 1 hour MA close as a reference price for the following 1 hour. If at any time, within this timeframe, the price is greater than or lower than the MA close, the rule will execute.

The rule has one hour to use this close price and if the condition is not met until the hourly candles closes, the MA close price for this period will then be the new reference.

This logic provides traders more flexibility when creating rules and setting conditions. It provides the ability to use real-time data, opposed to using candle close against candle close as seen in the crossing below or above logic.

"BUY… IF MA (50) lower than price in a timeframe of one hour."

Example 1 (Execution) :

MA 50 closes at 100 USD at 12:59. 100 USD is the close price and the reference price.

From 13:00 - 13:59, the price has to increase to over 100 USD in order for the Rule to Execute.

13:43, the price hits 102 USD. The Rule Executes and a BUY order is complete.

Example 2 (No Execution) :

MA 50 closes at 100 USD at 12:59. 100 USD is the close price and the reference price.

From 13:00 - 13:59, the price has to increase to over 100 USD in order for the Rule to Execute.

Price continues dropping and does not manage to exceed 100 USD. The MA 50 now follows price downwards and closes at 98 USD 13:59. This is the new reference point.

The new candle opens (14:00) and from 14:00 - 14:59, the price has to increase to over 98 USD in order for the Rule to Execute.

Did this answer your question?