Idea behind price change unlinked with the specific time & linked only to the prices

bettoro
13
bettoro  

A bit confusing thread title, but i could not define it better, sorry for that.


The question is:

1. I have a bid/ask price (actual or historic)

2. I want to find out (using mql4 or mql5 code) whether this price was reached by dropping by X amount of pips or by raising by X amount of pips. 


for example:

If my X is 10 pips and EUR/USD is traded at 1,2154 now.

Has this price arrived to this level after dropping  from 1,2164 or after gaining from 1,2144? In another words, when this price was taken(1,2154), which price is closer, 1,2164 or 1,2144 ?

Thanks 

Fernando Carreiro
5760
Fernando Carreiro  
bettoro:

A bit confusing thread title, but i could not define it better, sorry for that.


The question is:

1. I have a bid/ask price (actual or historic)

2. I want to find out (using mql4 or mql5 code) whether this price was reached by dropping by X amount of pips or by raising by X amount of pips. 


for example:

If my X is 10 pips and EUR/USD is traded at 1,2154 now.

Has this price arrived to this level after dropping  from 1,2164 or after gaining from 1,2144? In another words, when this price was taken(1,2154), which price is closer, 1,2164 or 1,2144 ?

Thanks 

Yes, it is confusing! And your text is confusing too!

If you take the current ask/bid price, you simply look at the previous tick ask/bid and you can calculate by how much the price has increased or decreased, both at the ask level or bid level. It can even be a combination of one price increasing while the other decreasing, or you can simple look at the mid price instead.

Is that what you are asking?

Fernando Carreiro
5760
Fernando Carreiro  

If you are asking how to this in MQL code, then the easiest and simplest way that will work on both MQL4 and MQL5, is simply to save the current Bid & Ask prices on every call to OnTick() event handler, and on the next tick event, simply compare the current to the previous prices, and repeat the process.

In MQL5 however, you can run over the tick history (using for example "CopyTicks()" and do something similar over the entire history data.

bettoro
13
bettoro  
Fernando Carreiro:

If you are asking how to this in MQL code, then the easiest and simplest way that will work on both MQL4 and MQL5, is simply to save the current Bid & Ask prices on every call to OnTick() event handler, and on the next tick event, simply compare the current to the previous prices, and repeat the process.

In MQL5 however, you can run over the tick history (using for example "CopyTicks()" and do something similar over the entire history data.

Alright, i will have to iterate then and once 10 pip difference is caught, that will be the answer.

Thanks Fernando!

Fernando Carreiro
5760
Fernando Carreiro  
bettoro: Alright, i will have to iterate then and once 10 pip difference is caught, that will be the answer. Thanks Fernando!
So, what you really want is the equivalent to Constant Range Bar chart, set to for example 10 pips! Do a search for "Constant Range Bars" or "Range Bars" and you should find several hits on that.
bettoro
13
bettoro  
Fernando Carreiro:
So, what you really want is the equivalent to Constant Range Bar chart, set to for example 10 pips! Do a search for "Constant Range Bars" or "Range Bars" and you should find several hits on that.
Cool, will do!!!