-
You know what the error is.
-
Perhaps you should read the manual. Program Running - MQL5 programs - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.What type does the documentation state the function must return?
-
You know what the error is.
-
Perhaps you should read the manual. Program Running - MQL5 programs - MQL5 Reference - Reference on algorithmic/automated trading language for MetaTrader 5
How To Ask Questions The Smart Way. (2004)
How To Interpret Answers.
RTFM and STFW: How To Tell You've Seriously Screwed Up.What type does the documentation state the function must return?
Hi
Use this, you have had missing one parameter in On Calculate function (volume) and On Calculate must be declared only in one way. Now it will work:
#property strict // Define indicator buffers #property indicator_chart_window #property indicator_buffers 3 #property indicator_color1 Blue #property indicator_color2 Red #property indicator_color3 Lime // Define indicator labels #property indicator_label1 "Doji" #property indicator_label2 "Exhaustion" #property indicator_label3 "Engulfing" // Declare indicator buffers double DojiBuffer[]; double ExhaustionBuffer[]; double EngulfingBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int OnInit() { // Set buffer arrays SetIndexBuffer(0, DojiBuffer); SetIndexBuffer(1, ExhaustionBuffer); SetIndexBuffer(2, EngulfingBuffer); return(INIT_SUCCEEDED); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int OnCalculate(const int rates_total, const int prev_calculated, const datetime &time[], const double &open[], const double &high[], const double &low[], const double &close[], const long &tick_volume[], const long &volume[], const int &spread[]) { int i; for(i = prev_calculated; i < rates_total; i++) { // Calculate candle range double candle_range = high[i] - low[i]; // Calculate upper shadow length double upper_shadow = high[i] - MathMax(open[i], close[i]); // Calculate lower shadow length double lower_shadow = MathMin(open[i], close[i]) - low[i]; // Check for Doji candle condition if (candle_range > 0 && upper_shadow < 0.05 * candle_range && lower_shadow < 0.05 * candle_range) { DojiBuffer[i] = low[i]; } else { DojiBuffer[i] = EMPTY_VALUE; } // Check for Exhaustion candle condition if (i > 0 && candle_range > 2 * MathAbs(close[i] - close[i - 1]) && upper_shadow < 0.15 * candle_range && lower_shadow < 0.15 * candle_range) { ExhaustionBuffer[i] = low[i]; } else { ExhaustionBuffer[i] = EMPTY_VALUE; } // Check for Engulfing candle condition if (i > 0 && close[i] > open[i] && open[i - 1] > close[i - 1] && close[i] > open[i - 1] && open[i] < close[i - 1] && (close[i] - open[i]) > 0.9 * (high[i] - low[i]) && (open[i - 1] - close[i - 1]) > 0.9 * (high[i - 1] - low[i - 1])) { EngulfingBuffer[i] = low[i]; } else { EngulfingBuffer[i] = EMPTY_VALUE; } } return(rates_total); }
Best Regards
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I am hoping you can help fix my code. I am trying to code a MT4 indicator to indicate a powerful downward bar.
No matter what I do, I still get :1 errors, 1 warnings
OnCalculate function declared with wrong type or/and parameters line 42 column 6
OnCalculate function not found in custom indicator line 1 column 1
Any suggestions?
Thanks!!!