You don't need to use the "OnChartEvent". You can just draw the invisible "reverse line" for it.
#property indicator_type2 DRAW_LINE #property indicator_color2 clrNONE double Linebuffer[]; //Indicator buffer double ReverseLine[]; SetIndexBuffer(0, Linebuffer); SetIndexBuffer(1, ReverseLine); : : for (i = limit; i >= 0; i--) { Linebuffer[i] = ...................; ReverseLine[i] = -Linebuffer[i]; }
By the way, is this an MQL4 code? It looks different from MQL5.
Pilot65:
Yes mql4.
In future please post in the correct section.
I will move your topic to the MQL4 and Metatrader 4 section.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Hi, got this indicator code working somewhat, it is run even when mouse scrolling the chart.
The indicator data has a wide range, something like +/- 0.1...+/-5.0, depending of chart scale, TF and instrument.
The goal is to improve readability by:
A) "0" in the center of the indicator window at all times
B) Auto scale the indicator window (the visible part of it) so that
the largest indicator line peak, either pos or neg, fills the window without clipping.
See picture for current problem, the 0 is all over the scale