Forum

Reading the distance displayed by the crosshair

Using the crosshair functionality, one can click on a point in the chart, keep the button pressed and move the mouse. This will display a line a distance in points between the initial point and where the cursor is. I would like to read that distance in points (or to calculate it somehow) from my EA

EMA value as it was in the past while the bar was open

Is it possible to read the value of a EMA as it was at a certain point in the past, while the bar was still forming? For example, it is 16:05 and I am on TF M5. I would like to know what was the value of H1 EMA(20) at 14:35. Using iMA + iBarShift(14:35) will return the EMA for the now-closed H1 bar

Showing changed buffer data

In my indicator I change in OnCalculate the values of the buffer of the last 10 candles. MT4 always shows the old values values for the past candles, not the new values; only the value of the current candle is constantly refreshed. I added a call to WindowRedraw() after the buffer is updated but

How to detect changes to indicator's parameters in EA?

Is it possible inside an EA to detect that the user has changed the parameters of one of the indicators? My current solution is to embed the parameters in the short name of the indicator and then check every second inside OnTimer(). Is there a better way to detect changes to the indicator

Objects not being deleted?

In my indicator I create vertical lines with this code string line_name = INDI_NAME + "_" + ( string ) Period () + "_" + ( string )time[i]; ObjectCreate ( 0 , line_name, OBJ_VLINE , 0 , time[i], NULL ); ObjectSetInteger ( 0 , line_name, OBJPROP_STYLE , line_style); ObjectSetInteger ( 0 , line_name

How to draw disconnected lines?

I am creating an indicator where the values change dramatically then the day changes. The problem is that the lines drawn by MT4 with the values in the indicator buffers connect all the points, so the last value of day A is connected to the first value of day B and the result is ugly. Is it possible

ReInit indicator when account changes

Can MT4 deinit and reinit an indicator when one changes account or server? I have read around that there should an option for that, but I cannot find it

WebRequest always returns a 5203 error

I am not able to make web request to an API using WebRequest from a script, I always get back an error 5203. This is the code, that I think is as simple as it can get. I am using MT4 build 765. #property copyright "just a test" #property link "" #property version "1.00" #property strict void

Timezone of time[]? Local or Current (broker)?

What timezone is used for the dates in the time[] array passed to OnCalculate? Are those times in the Local zone (computer) or in the Current zone (the one set by the broker)