Noggy: Where I am falling over is copying a row from a 2D array into the 1D array.
- Do it yourself.
enum preRows{ PR_M5, PR_M15, PR_M30, PR_H1, PR_H2}; double presets[5][6] = { 22,5,4,10,3,0.25, // M5 Index 0 6,33,13,11,11,0.02, // M15 Index 1 6,21,10,4,6,0.25, // M30 Index 2 5,33,15,6,3,0.25, // H1 Index 3 5,21,20,12,6,0.4, // H2 Index 4 }; if (_Period == PERIOD_M15) { for(int i=0; i <= 6; ++i) settings[i] = presets[PR_M15][i]; }
- Or don't do it at all:
#define settings(i) presets[iRow][i] int iRow; ⋮ if (_Period == PERIOD_M15) iRow=PR_M15;
Thanks, I was thinking that there may have been a simpler way than method 1 to do it.
Apologies for my lack of understanding, but I don't quite get method 2?
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
To keep things simple and rather than having to change some of my EA settings each time i change time frame, I was thinking of setting up some presets that automatically applied based on the _Period value. I don't know if i have taken the correct approach but i went down the path of multi dimensional array:
Where I am falling over is copying a row from a 2D array into the 1D array. From my reading in the guide regarding ArrayCopy, I thought I could do this via something like:
But I get a the following error:
Maybe it's my Python bias coming through but what am I doing wrong here?