Stuck on retrieving previous bid prices by each second?
Because there is no way, ticks are not stored. If you want it you will have to store them (in a circular buffer:)
Not Compiled Not Tested
If you want price changes (not seconds) ago, use OnTick instead of OnTimer. You might want to store time stamp as well as bid.
#define MAX_BACK 60 double bids[MAX_BACK]; int lastBid=0; double getBid(int iPast){ return bids[ (lastBid + iPast) % MAX_BACK ]; } void putBid(double v){ lastBid = (lastBid-1+MAX_BACK)%MAX_BACK; bids[lastBid]=v; } void OnTimer(void){ putBid(Bid); } int OnInit(void){ EventSetTimer(1); } : double bid2SecondsAgo = bid(2);Not Compiled Not Tested
Hi, im stuck on how to retrieve previous bid prices by each second and then compare them for further use.
Using : double curBid = MarketInfo(_Symbol,MODE_BID);
I can find current bid of every second no problem but how can I find previous values like for example I can on the 1m timeframe using :
double high = High[iHighest(_Symbol,_Period,MODE_HIGH,3,0)]; It can only understand finding each previous bar but seconds i cant find a way?
Thanks for any help