thank you for feed back.
if i replace with close, is still 1 bar late.
i would like to enter position on market open.
i attach screen shot of graph showing that MACD histogram positive on oct 1 but position doesnt open till nov 1.
how do i trigger open on oct 1 when macd is positive?
// Definition of code parameters
DEFPARAM CumulateOrders = False // Cumulating positions deactivated
// Conditions to enter long positions
indicator1 = MACD[12,26,9](close)
c1 = (indicator1 >= 0)
IF c1 THEN
BUY 1 PERPOINT AT MARKET
ENDIF
// Conditions to exit long positions
indicator2 = MACD[12,26,9](close)
c2 = (indicator2 < 0)
IF c2 THEN
SELL AT MARKET
ENDIF