iLowest() and iHighest don't work in Strategy Tester

 

Hi, all!

   I'm using Markets.com as Forex broker to test my EAs.

   I'm using iLowest() and iHighest() in my EA for the first time, this way:

   g_iMaxBar = iHighest(NULL, ANALYSIS_PERIOD, MODE_HIGH, 10, 1);
   g_iMinBar = iLowest(NULL, ANALYSIS_PERIOD, MODE_LOW , 10, 1);

   dMaxValue = iHigh(NULL, ANALYSIS_PERIOD, g_iMaxBar);
   dMinValue = iLow(NULL, ANALYSIS_PERIOD, g_iMinBar);


   In the ANALYSIS_PERIOD input parameter I select H1, and I run the EA in this period anyway, but the intention is to select any, independent of the chart.

   I have downloaded the data from the history center, as the attached document illustrates.

   However when I try to get the highest and lowest values the values gotten are wrong.

   Could anyone please help me?

Thanks and best regards.
Fabrizio.


 

  g_dMaxValue = High[ iHighest(NULL, ANALYSIS_PERIOD, MODE_HIGH, 10, 1)];


int  iHighest(
   string           symbol,          // symbol
   int              timeframe,       // timeframe
   int              type,            // timeseries
   int              count,           // cont
   int              start            // start
  );

 
ffoorr:   g_dMaxValue = High[ iHighest(NULL, ANALYSIS_PERIOD, MODE_HIGH, 10, 1)];
No ffoorr; High[] is the current chart only. If ANALYSIS_PERIOD is not _Period or zero using High[] is wrong.
OP is allowing different periods, so he must you iHigh(NULL,ANALYSIS_PERIOD, ...)
fabriziosartori: However when I try to get the highest and lowest values the values gotten are wrong.
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. "are wrong" "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  3. Print out the High, Low, Time, and bar numbers of your 10 bars. Print out your variables. Then you'll see the code is working and you can look at the correct chart bar (verify the time) and see the values in the data window
 

yes it work,

 the problem is that it cannot get the right index i on this one timeframe, so it has to use iHigh( ) thereafter


 
WHRoeder:
ffoorr:   g_dMaxValue = High[ iHighest(NULL, ANALYSIS_PERIOD, MODE_HIGH, 10, 1)];
No ffoorr; High[] is the current chart only. If ANALYSIS_PERIOD is not _Period or zero using High[] is wrong.
OP is allowing different periods, so he must you iHigh(NULL,ANALYSIS_PERIOD, ...)
fabriziosartori: However when I try to get the highest and lowest values the values gotten are wrong.

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. "are wrong" "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  3. Print out the High, Low, Time, and bar numbers of your 10 bars. Print out your variables. Then you'll see the code is working and you can look at the correct chart bar (verify the time) and see the values in the data window

Hi, WHRoeder and ffoorr.

   Thanks for your fast return!

   Sorry for the lack of information provided, so it's impossible to help me the way I need.

   As a matter of fact, I have a log file to my application, and I will include the information of each bar, as recommended. I only saved the data returned by iHighest() and iLowest(), and compared it to looking at the 10 bars on chart. That's why I opened this topic.

   Please I kindly ask you not to close this yet. I'm at work office (Forex is still not my main occupation) and I'll post new information as soon as possible.

Thanks again and best regards.

 

Hi, WHRoeder and ffoorr. How've you been?


   First of all, thanks for all the recommendation/suggestion about what I could do to solve the problem, that was solved indeed.

   The more we post, the more we learn. Next time, if needed, I'll post as much information as possible to be helped.

   I kindly ask you to close this issue.

Best regards,
Fabrizio. 

Reason: