Relevent section from the code:
--------------------------------
======================
//on some condition
entryOrder = EnterLong(DefaultQuantity, "FAS Purchase");
In OnExecution()
buyprice=order.AvgFillPrice;
sellprice=buyprice*.996;
SetStopLoss("FAS Purchase", CalculationMode.Price, sellprice, false);
======================
I HAVE ATTACHED THE SECTION FROM THE TRACE FILE WHEN WRONG STOP WAS PLACED:
======================
1. Buy order was placed at 6:44:45 AM (PST) for 472 stocks of FAS. Fill price = $84.72. Order got filled in 4 partial fills of 100,200,100 and 72.
2. Stop sell SHOULD have been placed for $84.38
3. But the stop loss was placed for $85.05
4. Since stop was higher than the current price, it sold all the stocks at the market right away.
5. The next order was filled to buy 2033 stocks of FAZ. Fill price was $19.67 and filled in batches of 1200 and 833.
6. Trace shows 2 stop loss settings - one for $19.53 (incorrect) and $19.59 (correct).
your help will be highly appreciated.
Comment