Check horizontal lines' values and write to file

 

Hi All,

I was wondering if someone could point me in the right direction. I've got a chart with two horizontal lines I draw manually. The lines are called "up" and "down". Is there any easy way to run a script or indicator (not sure which one to use to be honest) which reads the current value of the line and saves it in a file ?

Any help much appreciated.

Best regards,

 
szatek:

Hi All,

I was wondering if someone could point me in the right direction. I've got a chart with two horizontal lines I draw manually. The lines are called "up" and "down". Is there any easy way to run a script or indicator (not sure which one to use to be honest) which reads the current value of the line and saves it in a file ?

Any help much appreciated.

Best regards,

A Script is intended to run,  do a task and then end.  An Indicator does a task repeatedly.  So if you want to get the levels of the line on an infrequent basis on demand you can use a script,  if you want the file updated in real time when you move the position of the lines then use an Indicator.

You need to familiarise yourself with 2 sets of functions,  File Functions - you will use these to write to the file and Object Functions -  you will use these to get the positions of the lines.  If it's too difficult or you don't have time to learn yu can get this coded for you for a small cost here:  MT4 and MT5 coding jobs
 
RaptorUK:
A Script is intended to run,  do a task and then end.  

That's right, but you can put a script in a continuous loop, so this would solve the problem, in my opinion, in an easier way than build an indicator.
 
figurelli:
That's right, but you can put a script in a continuous loop, so this would solve the problem, in my opinion, in an easier way than build an indicator.
And if you want to run a script in addition to this script ?  you cannot . . .  the code is virtually the same in both cases.
 
RaptorUK:
And if you want to run a script in addition to this script ?  you cannot . . .  the code is virtually the same in both cases.
No problem, just do it in another graph, since you can have several scripts running in the same terminal and account.