can anyone help me to code the program below to execute trade immediately when the condition meet without waiting 2hrs period close for the price action.
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
indicator1 = Cycle(close)
c1 = (indicator1 CROSSES OVER -13)
indicator2 = CCI[20]
c2 = (indicator2 < 100)
IF c1 AND c2 THEN
BUY 2 CONTRACT AT MARKET
ENDIF
// Conditions to exit long positions
indicator3 = CCI[20]
c3 = (indicator3 CROSSES OVER 100)
IF c3 THEN
SELL AT MARKET
ENDIF
// Conditions to enter short positions
indicator4 = Cycle(close)
c4 = (indicator4 CROSSES UNDER 13)
indicator5 = CCI[20]
c5 = (indicator5 > -100)
IF c4 AND c5 THEN
SELLSHORT 2 CONTRACT AT MARKET
ENDIF
// Conditions to exit short positions
indicator6 = CCI[20]
c6 = (indicator6 CROSSES UNDER -100)
IF c6 THEN
EXITSHORT AT MARKET
ENDIF
// Stops and targets
SET STOP pLOSS 250
Until the new multi timeframe support to come, the only way to launch orders between 2 bars is to use pending orders. But in this case, we need to know at which price levels they need to be put at market and they do not be executed instantly also..
Because indicators are computed on Close (for most of them and that’s the case in your strategy), why do you want to take orders on not confirmed calculation? (when the candlestick is closed and the information is written in the marble 😉 )