Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
You are mixing MQL4 and MQL5 code. "init()" and "deinit()" are an old MQL4 event handlers. Use "OnInit()" and "OnDeinit()" instead.
Also, on MQL5 the "OnCalculate()" parameters are treated as normal arrays and not as "series" arrays like in MQL4.
If you are going to use the OHLC values, then use the second version of the OnCalculate and access the data directly from the parameters.
int OnCalculate( const int rates_total, // size of input time series const int prev_calculated, // number of handled bars at the previous call const datetime& time{}, // Time array const double& open[], // Open array const double& high[], // High array const double& low[], // Low array const double& close[], // Close array const long& tick_volume[], // Tick Volume array const long& volume[], // Real Volume array const int& spread[] // Spread array );
Is this perhaps ChatGPT generated code? If it is then please, don't request help for ChatGPT (or other A.I.) generated code. It generates horrible code, mixing MQL4 and MQL5. Please use the Freelance section for such requests — https://www.mql5.com/en/job
![Trading applications for MetaTrader 5 to order Trading applications for MetaTrader 5 to order](https://c.mql5.com/36/80/trading-applications-for-metatrader.png)
- 2023.10.20
- www.mql5.com
You are mixing MQL4 and MQL5 code. "init()" and "deinit()" are an old MQL4 event handlers. Use "OnInit()" and "OnDeinit()" instead.
Also, on MQL5 the "OnCalculate()" parameters are treated as normal arrays and not as "series" arrays like in MQL4.
If you are going to use the OHLC values, then use the second version of the OnCalculate and access the data directly from the parameters.
Is this perhaps ChatGPT generated code? If it is then please, don't request help for ChatGPT (or other A.I.) generated code. It generates horrible code, mixing MQL4 and MQL5. Please use the Freelance section for such requests — https://www.mql5.com/en/job
hi thanks no i dont use chatgpt i have this in meta4 and i want to convert it to mql5. i did changes but it doesnt work again
#property indicator_separate_window #property indicator_minimum 0.0 #property indicator_maximum 100.0 #property indicator_buffers 1 #property indicator_color1 Yellow #property indicator_type1 DRAW_LINE double Line[2000]; //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnInit() { SetIndexBuffer(1,Line,INDICATOR_DATA); //--- indexes draw begin settings return (0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnDeinit() { return (0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int OnCalculate( const int rates_total, // size of input time series const int prev_calculated, // number of handled bars at the previous call const datetime& time[], // Time array const double& open[], // Open array const double& high[], // High array const double& low[], // Low array const double& close[], // Close array const long& tick_volume[], // Tick Volume array const long& volume[], // Real Volume array const int& spread[] // Spread array ) { for(int i =199; i >= 0; i--) { double mid= iHigh(NULL, Period(), i) + iLow(NULL, Period(), i) + iClose(NULL, Period(), i); Line[i] = mid; } return (0); } //+------------------------------------------------------------------+
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- 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 want to show pivots in histogram in seperated window.i want it shows only recent 100 candles.but it doesnt show anythinh