Hello Spikehog,
Our engineers have added debugging logic to your code:
Code: Select all
IF MP = 1 and PositionFlag and Date > 1110306 and Time > 0930 and Time < 2300 then Begin
if date=1150916 and time>1448 and time<1500 then
begin
print(datetimetostring(datetime), " ; ", avgentryprice, " ; ", entryprice(0), " ; ", PosTradeEntryPrice(0,0), " ; BAR OPEN: ", open);
IF currentcontracts=1 then print("send BUY next bar order LE2ndEntry at STOP ", avgentryprice + 65);
IF currentcontracts=2 then print("send BUY next bar order LE3rdEntry at STOP ", entryprice(0) + 130);
IF currentcontracts=3 and (barnumber - PosTradeExitBar(0,3) > 5) then print("send BUY next bar order LE4rdEntry at STOP ",PosTradeEntryPrice(0, 0) + 190);
print("---------------");
end;
End;
The following output has been generated:
9/16/2015 2:49:00 PM ; 21650.00 ; 21650.00 ; 21650.00 ; BAR OPEN: 22031.00
send BUY next bar order LE2ndEntry at STOP 21715.00
---------------
9/16/2015 2:50:00 PM ; 21835.00 ; 21650.00 ; 21650.00 ; BAR OPEN: 22020.00
send BUY next bar order LE3rdEntry at STOP 21780.00
---------------
9/16/2015 2:51:00 PM ; 21891.00 ; 21650.00 ; 21650.00 ; BAR OPEN: 22003.00
send BUY next bar order LE4rdEntry at STOP 21840.00
---------------
9/16/2015 2:52:00 PM ; 21905.75 ; 21650.00 ; 21650.00 ; BAR OPEN: 21950.00
The following orders have been generated:
send BUY next bar order LE2ndEntry at STOP 21715.00
send BUY next bar order LE3rdEntry at STOP 21780.00
send BUY next bar order LE4rdEntry at STOP 21840.00
The orders executed at the Open prices of the bars as these prices satisfy the order execution logic.
1st entry is at 21650, 2nd entry is at 22020, 3rd entry is at 22003 and the 4th entry was at 21950
Therefore the signal works as expected.