order is filled "today" at 00:00 but executed "next day" at 00:00. Why is not executed the same day?
Second question: how can I open position not at open price but at open price-20pips? I tried with EnterShortLimit() but position is closing at price out of the bar few days later (at price from one before bar).
I work on daily bars for forex currency pair.
Below is code which opens short position - part on the OnBarUpdate() method:
if(Close[1] < SMA(Close, varSMA)[1] && Position.MarketPosition != MarketPosition.Short) // sygnał do shorta
{
sigPrice = Close[1] - varFilter; // cena zamknięcia z wczoraj minus filtr
Print ("Sygnał Short SMA, sigPrice = " + sigPrice);
if(Low[0] <= sigPrice && High[0] >= sigPrice) { // cena dziś jest w przedziale low-high ceny sygnału
EnterShort(DefaultQuantity, "Open Short"); // otwiera short market order i zamyka wszystkie otwarte longi
// TODO: po jakiej cenie otwiera? mnie interesuje cena Closes[0][1] - varFilter
//EnterShortLimit(DefaultQuantity, sigPrice, "Open Short Limit");
}
}

Comment