help -I want to find out what the ask / bid price was 60 seconds or 600 seconds ago....

 

Hi


what functions can I use to get ask / bid price from the past in minutes or seconds ?

example:


I want to find out what the ask / bid price was 60 seconds or 600 seconds ago.


thanks

]

 

buju wrote >>

I want to find out what the ask / bid price was 60 seconds or 600 seconds ago.

double prevBid(int sec) {
  datetime when=curTime() - sec;
  int bar=0;
  while( Time[bar] > when && bar < Bars) bar++;
  return( bid[bar] );
}
 
WHRoeder:

thank you so very much

 
Just out of curiosity how would you get the ask price? The point of this question is where is the record of the spread for every tick held? If the spread is not available then the historical ask price cannot be found.
 
Ask is not stored.
 
phy:
Ask is not stored.

Could you elaborate on how to get previous tick ask values. If the spread isn't stored either then it is impossible to get the ask price history isn't it?.

 
buju:

thank you so very much

just a note here:

i tried every combination of the code but it would not compile, even in a very simple EA.

Ive since used another method to achieve the results i wanted.

but thanks anyway ....

 

"Could you elaborate on how to get previous tick ask values. If the spread isn't stored either then it is impossible to get the ask price history isn't it?."

Without some extra code and storage on your part, all you can get from MT4 for the past is OPEN HIGH LOW and CLOSE -- same as you see on the charts.

The data is not there unless you catch it and store it.

 

Thanks for the clarification Phy.

This means a scalper or any code that deals with small stops and takes cannot be tested on the back tester especially if your broker varies the spread between ticks.

Reason: