Hi all,
So i'm having issues passing the pair string input for an indicator im trying to use within EA. When using the indicator directly on a chart and entering the required symbols as inputs I have no issues and the indicator displays as expected, however when calling the indicator via iCustom the exact same symbols cannot be found. The indicator does contain a check to ensure the symbols are available using SymbolSelect which is currently returning false only when used in an EA, otherwise works fine when just using the indicator.
I have tried a few different ways and even hard coded the symbols just to see if that helps but still no success. My indicator inputs:
my inputs defined in the EA:
the icustom call in my EA using the above inputs:
Any guidance on the matter would be much appreciated, thank you in advance
You should post the relevant code. If your problem is "symbols cannot be found"...show the code with SymbolSelect().
Probably not related but why the MAmethod parameter which is ENUM_MA_METHOD becomes an int in the EA ?
input int MAmethod =5; //MA methodWhat MA are you using?
ID |
Value |
Description |
MODE_SMA |
0 |
Simple averaging |
MODE_EMA |
1 |
Exponential averaging |
MODE_SMMA |
2 |
Smoothed averaging |
MODE_LWMA |
3 |
Linear-weighted averaging |
Smoothing Methods - Indicator Constants - Constants, Enumerations and Structures - MQL4 Reference
hi guys,
absolutely right, typo on my part for the mamethod of 5, should be 0.
re the point of 'No Symbol Found', below is the code in the indicator causing this message when trying to use within my EA.
//+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ sinput string Pair1 ="EURUSD"; //Pair #1 sinput string Pair2 ="EURJPY"; //Pair #2 input int MAperiod =8; //MA period input ENUM_MA_METHOD MAmethod =MODE_SMA; //MA method input double DEVperiod =2.0; //StDev level input int CorD =100; //Corelation depth (bars) //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ double point; double Cor[],MA[],Up[],Dn[],Pr1[],Pr2[]; double Dev[]; double P1[],P2[]; //--- #include <MovingAverages.mqh> //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { Comment(""); if(!LicenseValidation()) return(INIT_FAILED); if(!SymbolSelect(Pair1,true) || !SymbolSelect(Pair2,true)) { Comment("Symbol is Not Found!"); return(INIT_FAILED); }
Change your comment to print "Pair1" and "Pair2", to check they are correct.
values seem to look ok
SymbolSelect() doesn't work in the Strategy Tester. Check the error returned with GetLastError() and you will see it returns error 4014 (according to my memory as I didn't check).
of course, i will have to remove SymbolSelect() for the purpose of back testing. Thank you for your help
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi all,
So i'm having issues passing the pair string input for an indicator im trying to use within EA. When using the indicator directly on a chart and entering the required symbols as inputs I have no issues and the indicator displays as expected, however when calling the indicator via iCustom the exact same symbols cannot be found. The indicator does contain a check to ensure the symbols are available using SymbolSelect which is currently returning false only when used in an EA, otherwise works fine when just using the indicator.
I have tried a few different ways and even hard coded the symbols just to see if that helps but still no success. My indicator inputs:
my inputs defined in the EA:
the icustom call in my EA using the above inputs:
Any guidance on the matter would be much appreciated, thank you in advance