Daily Chart
1. Buy a number of shares at the opening.
2. Place a sell limit order at the price of (opening + 2.5% ).
3. Do the same operation every day bar.
It is assumed that the limit orders placed are in force till the end of strategy backtesting and should be filled at the prices set.
But I'm getting the following (please see a screenshot).
For some reason all my limit orders "accumulate" and fill at one bar for the price which is lower than expected...
Here is my code example:
Code: Select all
Var: StocksToBuy(0);
If (Barnumber>0) Then
Begin
StocksToBuy = 200;
Buy StocksToBuy shares Next Bar at Market;
Sell StocksToBuy shares Next Bar (close+0.025*close) Limit;
End;
Please advise.