Need other sets of eyes  [SOLVED]

Questions about MultiCharts and user contributed studies.
PD Quig
Posts: 191
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Need other sets of eyes

Postby PD Quig » 14 Sep 2017

Going a little crazy here.

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;
Here is the output I got:

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
I have checked strategy properties, the instrument, etc., and can't find anything unusual. Any ideas would be greatly appreciated.

-PDQ
Pic_1.png
(43.32 KiB) Downloaded 571 times
Pic_2.png
(50.2 KiB) Downloaded 571 times
Pic_3.png
(48.46 KiB) Downloaded 571 times
Pic_4.png
(48.96 KiB) Downloaded 571 times
Pic_5.png
(44.9 KiB) Downloaded 571 times
Last edited by PD Quig on 16 Sep 2017, edited 1 time in total.

User avatar
rrams
Posts: 128
Joined: 10 Feb 2011
Location: USA
Has thanked: 7 times
Been thanked: 70 times
Contact:

Re: Need other sets of eyes

Postby rrams » 16 Sep 2017

Either your Order and Position Tracker -> Positions History is showing rejected orders or the Strategy Properties are denying more entries.
The code loop with a market order gets executed as the print shows. Sorry, I can't help more.
I don't get why your 3 point Russell 2000 range bar chart has some candles that are larger than others.

PD Quig
Posts: 191
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Re: Need other sets of eyes

Postby PD Quig » 16 Sep 2017

Thanks for your response. I should have mentioned that these issues are in Sim001 account in backtest mode--not live. Haven't tried live orders since it's no longer working in backtest mode like it did when last used.

BTW: The candles that are larger than others are actually virtual renko candles. The system is based on renko bars and as you know MC doesn't allow tick-by-tick replay of Renko charts. So I wrote an indicator that simulates Renko bars (Renko 10) closely enough for my purposes. They are calculated and displayed--not actual data stream-based bars.

PD Quig
Posts: 191
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Re: Need other sets of eyes  [SOLVED]

Postby PD Quig » 16 Sep 2017

Mr. Potato Head. It had been long enough since I used this code that I had forgotten that to do multiple entry orders in the same direction, Strategy Properties>Position Limits setting has to be set in the chart. It is not stored in the PowerLanguage File>Properties. When I set that the code worked as expected.

PD Quig
Posts: 191
Joined: 27 Apr 2010
Location: San Jose
Has thanked: 67 times
Been thanked: 10 times

Re: Need other sets of eyes

Postby PD Quig » 16 Sep 2017

Pic_6.png
(48.36 KiB) Downloaded 530 times
Pic_7.png
(60.63 KiB) Downloaded 530 times


Return to “MultiCharts”