Download MetaTrader 5

Previous tick's value

To add comments, please log in or register
Are you a real pro? Share your knowledge with millions of traders!
Mac
183
Mac 2012.12.02 11:19 
I, a custom indicator, just got a new tick and am currently in Start already. I need to find out whether I am to move up from the previous tick or down. Where do I fetch this information?
Simon Gniadkowski
Moderator
17998
Simon Gniadkowski 2012.12.02 11:32  
Martinigue:
I, a custom indicator, just got a new tick and am currently in Start already. I need to find out whether I am to move up from the previous tick or down. Where do I fetch this information?
Remember the price for the last tick,  compare it to the price of the current tick . . .  if(Bid - LastTickPrice) > 0 price has gone up
Mac
183
Mac 2012.12.02 11:40  
Straightforward. Just wanted to make sure there is no inherent data structure for this that I am ommitting. Btw Raprtor, how do you do that that you always come first to respond and almost within minutes ...?:-)
Simon Gniadkowski
Moderator
17998
Simon Gniadkowski 2012.12.02 12:06  
Martinigue:
Straightforward. Just wanted to make sure there is no inherent data structure for this that I am ommitting. Btw Raprtor, how do you do that that you always come first to respond and almost within minutes ...?:-)
I am at one of my PCs most of the day . . .  I keep an active eye on the Forum.  Answering questions where I can helps me expand my knowledge . . .
whroeder1
14470
whroeder1 2012.12.02 13:51  
RaptorUK: Remember the price for the last tick,  compare it to the price of the current tick . . . 
int start(){
   static double tickCurrent; double tickPrevious = tickCurrent; tickCurrent = Bid;
   :
   if (tickCurrent > tickPrevious) ... // Up
Mac
183
Mac 2012.12.10 20:10  
Thanks guys.:-)
KingOfSand
58
KingOfSand 2015.12.03 15:40  
WHRoeder:


I am so sorry to bring such an old topic back to the surface but I need to know if it is possible to store more than 1 tick "in the memory". 

I would like to have the ability to know the price for:

Current tick
last tick
tick before last tick

and actually more if it is possible.

Thanks in advance :) 

Carl Schreiber
6580
Carl Schreiber 2015.12.03 16:37  
use array or for everything you want to keep an extra variable.
KingOfSand
58
KingOfSand 2015.12.03 16:44  
Thanks! Please give me an example of storing the last 5 ticks (prices)
Ex Ovo Omnia
3122
Ex Ovo Omnia 2015.12.03 18:17  

You cannot get recent ticks in MQL4, you have to remember them. Or you may move to MQL5, they have a rather fresh function for it : https://www.mql5.com/en/docs/series/copyticks 

KingOfSand
58
KingOfSand 2015.12.03 18:30  
So, it is possible to see last tick and the current tick but no more? Strange...
12
To add comments, please log in or register