how to keep the distance between 2 prices in a variable?
-
how to keep the distance between 2 prices in a variable?
I want to put two horizontal lines on the graph and I want it to show me the distance between them in pips.
can someone give me an example of how to do this? -
You can do it by creating 2 variables. The first two ones are used to catch both price values and the third one to store the difference between them through a 'Formula' block.
-
@l-andorrà said in how to keep the distance between 2 prices in a variable?:
You can do it by creating 2 variables. The first two ones are used to catch both price values and the third one to store the difference between them through a 'Formula' block.

that's right?
But as I understand it he is measuring the distance of prices, how do I convert this to pips, to know how many pips of distance there is between them? -
I can't remember the exact mql order right now, but what you get in that way is the price fraction. Maybe that's enough for what you are looking for. Do you really need it to be transfored in to pips?
-
@l-andorrà said in how to keep the distance between 2 prices in a variable?:
I can't remember the exact mql order right now, but what you get in that way is the price fraction. Maybe that's enough for what you are looking for. Do you really need it to be transfored in to pips?
not necessarily, I now need it to create other lines with the same distance above or below, how can I do this, automate the creation of the lines.
Create a condition that when it is met it creates for example 3 lines above and 3 lines below with the same measure of these lines that were created? -
Could you please share your last version's project?
-
-
I recommend you to connect a 'Comment block at the bottom of both blocks like this:

Insert the three variable inside each blank box. That will shoe the values stored on each one. Check them out to be sure they are correct. As fas as I see, they should.