Hi all,
I am using BilingerBands in my EA but it is returning very big value as follows which is definitely not correct.
9.881312916824931e-324
Following is the code of OnTick method:
This value is EMPTY_VALUE, which is normal considering the way you coded it.
Please read the documentation. Get the handle in OnInit(). Check your returned value.
Yup, Alain is correct. Read the documentation. Here as a starter.
Try the following:
or
double lowerBollingerBandArray[]; int bollingerBandDefination; int OnInit() { //-Sorting array from current candle downward.. ArraySetAsSeries(lowerBollingerBandArray, true); //-Defining bollinger bands.. bollingerBandDefination = iBands("EURUSD", PERIOD_H1, 20, 0, 2, PRICE_CLOSE); return(INIT_SUCCEEDED); } void OnTick() { //-Copying lower bollinger band data into array.. if( CopyBuffer(bollingerBandDefination, 2, 0, 3, lowerBollingerBandArray) < 3 ) return; Print ( "EURUSD: " + DoubleToString(lowerBollingerBandArray[1], (int)SymbolInfoInteger("EURUSD", SYMBOL_DIGITS))); }
Constant | Description | Value |
EMPTY_VALUE | Empty value in an indicator buffer | DBL_MAX |
Constant | Description | Value |
DBL_MIN | Minimal positive value, which can be represented by double type | 2.2250738585072014e-308 |
DBL_MAX |
Maximal value, which can be represented by double type |
1.7976931348623158e+308 |
Not EV.
Constant | Description | Value |
EMPTY_VALUE | Empty value in an indicator buffer | DBL_MAX |
Constant | Description | Value |
DBL_MIN | Minimal positive value, which can be represented by double type | 2.2250738585072014e-308 |
DBL_MAX |
Maximal value, which can be represented by double type |
1.7976931348623158e+308 |
Thanks all of you for your help. One more question. I am trying to develop multi currency EA, do I need to declare separate variable for handler, and price array as I need to perform same analysis for all currency pairs.
If this is the case I have to write the code when ever I add new currency pair. Cant I use array for handler and an two dimensional array of price. I tried to do this but dint succeed.
Please help in this regards.
Thanks.
string symbols[3] = {"EURUSD", "GBPUSD", "USDCHF"}; struct BANDS { int digits, bollingerBandDefination; double lowerBollingerBandArray[]; } bands[3]; int OnInit() { for(int i=0; i<3; i++) { //-Sorting array from current candle downward.. ArraySetAsSeries(bands[i].lowerBollingerBandArray, true); bands[i].digits = (int)SymbolInfoInteger(symbols[i], SYMBOL_DIGITS); //-Defining bollinger bands.. bands[i].bollingerBandDefination = iBands(symbols[i], PERIOD_H1, 20, 0, 2, PRICE_CLOSE); } return(INIT_SUCCEEDED); } void OnTick() { for(int i=0; i<3; i++) if( CopyBuffer(bands[i].bollingerBandDefination, 2, 0, 3, bands[i].lowerBollingerBandArray) == 3 ) Print(symbols[i] + ": " + DoubleToString(bands[i].lowerBollingerBandArray[1], bands[i].digits)); }
- 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,
I am using BilingerBands in my EA but it is returning very big value as follows which is definitely not correct.
9.881312916824931e-324
Following is the code of OnTick method: