Why is my automatic trading order executed at open of next candle, not immediatly?

FAQs - Category: Automated trading

In ProRealTime, strategy code is executed once per completed bar by default. This means that when a condition is met, the order is placed but is only executed at the open of the next bar rather than instantly within the current candle.

Solution

1. Use Pending Orders (STOP or LIMIT) Instead of Market Orders

To execute trades intrabar, use STOP or LIMIT orders instead of MARKET orders:

BUY 1 CONTRACT AT 1500 STOP
SELLSHORT 1 CONTRACT AT 1490 STOP
  • A STOP order triggers as soon as the price reaches your predefined level.
  • A LIMIT order ensures execution at your desired price or better.

2. Use the TIMEFRAME Instruction for Intrabar Execution

If you want to execute orders within the current bar while still analyzing a higher timeframe, use the TIMEFRAME instruction:

TIMEFRAME(1 Minute) // Execute orders intrabar
IF close > MovingAverage[20] THEN
BUY 1 CONTRACT AT MARKET
ENDIF
TIMEFRAME(DEFAULT) // Return to main timeframe analysis

This method allows orders to be placed within a candle based on lower timeframe data, making execution faster.

Back to FAQs
Logo Logo
Loading...