Hi,

I want to partially exit trades at limit (Profit Target) so I save the trade information and use ExitLong() to exit.

For some reason (probably my mistake) the trade is executed not in the current bar at the price I enter but at the open of the next bar (market order).

Next is the logic to close the trade. According to the manual it should enter a limit order at the given price. What am I doing wrong?

Code
   if (tp_pos == LONG)
   {
      if (priceH(0) >= tp_value)
      {
         exitLong("", tp_value, 0);
         tp_pos = NEUTRAL;
      }
   }


Thank you,
Jaime