Download MetaTrader 5

[back testing] marketinfo mode_high return 0

To add comments, please log in or register
Millions of traders download codes from MQL5 library. Share your app with them!
phoenix1911
77
phoenix1911 2015.09.28 16:04 

Hi all,

Could anyone please help me!

When I am doing back testing using code:


   double TodayHighest = MarketInfo(Symbol(),MODE_HIGH);
   Print("TodayHighest is:  ",TodayHighest);
  

  double TodayLowest = MarketInfo(Symbol(),MODE_LOW);

Print("TodayLowest is:  ",TodayLowest);


All the values I got were "0.0"

But When I tried

double askprice = MarketInfo((Symbol(),MODE_ASK);

I can get a non-zero value.

phoenix1911
77
phoenix1911 2015.09.28 17:50  

However, when I click active EA trading button, it is showing "today's" high and low successfully.

Also I start wondering is this MarketInfo function able to get High and Low on previous day when doing the back test.

Can anyone help?

Marco vd Heijden
Moderator
4690
Marco vd Heijden 2015.09.28 18:08  

no marketinfo is not available.

use MT5 if you want more.

phoenix1911
77
phoenix1911 2015.09.28 19:03  
Marco vd Heijden:

no marketinfo is not available.

use MT5 if you want more.

Is there any alternative way to find day HIGH and day LOW when doing back testing?

My broker doesn't provide MT5

Marco vd Heijden
Moderator
4690
Marco vd Heijden 2015.09.28 23:15  

yes there is.

you do a loop scan over the last 24 Bars (assuming H1 frame) with the comparison if High[bar] > is larger then daily_high {daily_high=High[bar];} to end up with the daily high.

To add comments, please log in or register