I made an EA with the following...
extern int IntIndTF1 = 4;
extern int IntInd1S1 = 2;
extern int IntInd1S2 = 14;
extern int IntIndTF2 = 1;
extern int IntInd2S1 = 3;
extern int IntInd2S2 = 9;
It worked great until I started testing other symbols with it, then came the dreaded Array out of range error, so I changed it to this...
The array out of range errors appears to have diminished. HOWEVER, now I can not get it to simulate the previous settings which were doing well...
extern int IntIndTF1 = 4;
extern int IntInd1S1 = 2;
extern int IntInd1S2 = 14;
extern int IntIndTF2 = 1;
extern int IntInd2S1 = 3;
extern int IntInd2S2 = 9;
I've tested +1 and -1 ranges but the EA is now not returning to the same calculated values for the same bars. How can I change the code to eliminate the errors yet maintain the previously tested values and results.
This is in a EA not using an indicator. The values for the HHLLs are in the EA itself. I want it to be able to read and get the same results for the extern variable on the bar that triggers the signal.
extern int IntIndTF1 = 4;
extern int IntInd1S1 = 2;
extern int IntInd1S2 = 14;
extern int IntIndTF2 = 1;
extern int IntInd2S1 = 3;
extern int IntInd2S2 = 9;
Inserted Code
PerH1 = High[iHighest(SymbolToManage,IntIndTF1,MODE_HIGH,IntInd1S2,IntInd1S1)]; PerL1 = Low[iLowest(SymbolToManage,IntIndTF1,MODE_LOW,IntInd1S2,IntInd1S1)]; PerM1 = NormalizeDouble((PerH1+PerL1)/2,Digits); PerH2 = High[iHighest(SymbolToManage,IntIndTF2,MODE_HIGH,IntInd2S2,IntInd2S1)]; PerL2 = Low[iLowest(SymbolToManage,IntIndTF2,MODE_LOW,IntInd2S2,IntInd2S1)]; PerM2 = NormalizeDouble((PerH2+PerL2)/2,Digits);
It worked great until I started testing other symbols with it, then came the dreaded Array out of range error, so I changed it to this...
Inserted Code
int BarCount = Bars; if (BarCount < 1) BarCount = 1; for (int i=0; i>Bars; i--) { PerH1 = High[iHighest(SymbolToManage,IntIndTF1,MODE_HIGH,IntInd1S2,i+IntInd1S1)]; PerL1 = Low[iLowest(SymbolToManage,IntIndTF1,MODE_LOW,IntInd1S2,i+IntInd1S1)]; PerM1 = NormalizeDouble((PerH1+PerL1)/2,Digits); PerH2 = High[iHighest(SymbolToManage,IntIndTF2,MODE_HIGH,IntInd2S2,i+IntInd2S1)]; PerL2 = Low[iLowest(SymbolToManage,IntIndTF2,MODE_LOW,IntInd2S2,i+IntInd2S1)]; PerM2 = NormalizeDouble((PerH2+PerL2)/2,Digits); }
extern int IntIndTF1 = 4;
extern int IntInd1S1 = 2;
extern int IntInd1S2 = 14;
extern int IntIndTF2 = 1;
extern int IntInd2S1 = 3;
extern int IntInd2S2 = 9;
I've tested +1 and -1 ranges but the EA is now not returning to the same calculated values for the same bars. How can I change the code to eliminate the errors yet maintain the previously tested values and results.
This is in a EA not using an indicator. The values for the HHLLs are in the EA itself. I want it to be able to read and get the same results for the extern variable on the bar that triggers the signal.