I'm updating signal code that I used extensively in the past. It is a multiple entry system and it worked fine both in live trading and backtesting modes. In this test the number of entries is set to five.
This evening when I applied it to a chart to start working on it, the initial entry worked, the stop exit worked, and the target exit worked, but the intermediate entries would not execute.
To debug it, I placed the following diagnostic print block into the begin > end block where the follow-on entries should have triggered.
Code: Select all
if high >= Entry_Price[Entry_Index] then begin
buy ("LE_sc") myContracts shares next bar at market; { price breaks above entry trigger so enter at market }
Entry_Status[Entry_Index] = 2; { set entry status to "2" = filled }
Actual_Entry_Count = Actual_Entry_Count + 1; { accumulate entry counter }
Recalc_RiskReward = true; { new entry so have to recalc risk/reward }
Save_TL_Value[Entry_Index + 7] = 0; { entry price hit so move entry trendline to zero }
{************************* Diagnostic Print Section *****************************************}
once ClearPrintLog;
Print("myContracts= ", myContracts);
Print("Entry_Status[", Entry_Index:1:0, "]= ", Entry_Status[Entry_Index]);
Print("Actual_Entry_Count= ", Actual_Entry_Count);
Print("Why no follow-on entry?");
Print(" ");
{********************************************************************************************}
end;
myContracts= 2.00
Entry_Status[3]= 2.00
Actual_Entry_Count= 3.00
Why no follow-on entry?
myContracts= 2.00
Entry_Status[4]= 2.00
Actual_Entry_Count= 4.00
Why no follow-on entry?
myContracts= 2.00
Entry_Status[5]= 2.00
Actual_Entry_Count= 5.00
Why no follow-on entry?
So, what do I know from this?
- I know that the initial entry (Pic_2), stop exit (Pic_5), and target exit (Pic_4) work as expected
I know from the print diagnostic that he's entering the loop where the follow-on entries should be triggered and he's updating the various arrays and variables
I know that myContracts is <> zero so that isn't suppressing the entries
I know that the execution is not failing because it is out of the trading period (9:30 - 15:45 Eastern). All entry price levels were hit between 9:35 and 10:00 AM
-PDQ