By default, ProRealTime executes trading orders only at the close of each bar because it reads and processes the strategy code once per completed bar. This behavior can create delays in order execution, preventing real-time reactions to price movements. The main reasons for this issue are:
To execute orders immediately without waiting for the bar to close, you can use two effective approaches:
Instead of placing market orders, use STOP or LIMIT orders to enter trades as soon as price conditions are met:
<code class="!whitespace-pre language-pseudocode">BUY 1 CONTRACT AT 1500 STOP
SELLSHORT 1 CONTRACT AT 1490 STOP
TIMEFRAME Instruction for Intrabar ExecutionAnother way to get faster execution is to use a lower timeframe inside a strategy running on a higher timeframe. This method allows you to execute orders intrabar without waiting the bar to close:
TIMEFRAME(1 hour) // define the strategy indicator
ma = average[20]
TIMEFRAME(default) // Executes trades within the current bar on the current inferior timeframe
IF close crosses over ma THEN
BUY 1 CONTRACT AT MARKET
ENDIF