(F1) Help : iHighest(...) & iLowest(...)

 
 int LOWt=0;
 int HIGHt=0;
 
 int y=iBarShift(Symbol(),PERIOD_M15,iTime(Symbol(),PERIOD_D1,1));
 LOWt=iLowest(Symbol(),PERIOD_M15,MODE_LOW,(y-1),(y-96));
 HIGHt=iHighest(Symbol(),PERIOD_M15,MODE_HIGH,(y-1),(y-96));

Comment("\ny: "+(y)+"\nHigh"+High[HIGHt]+"\nLow"+Low[LOWt]);


hi everybody

this is simple code, but i don't understand what's happening.

High[]==> Correct

Low[]==> Wrong


please help me .

 

This will probably be closer, but I haven't tried it ...

 int LOWt=0;
 int HIGHt=0;
 
 int y=iBarShift(Symbol(),PERIOD_M15,iTime(Symbol(),PERIOD_D1,1));
 LOWt=iLowest(Symbol(),PERIOD_M15,MODE_LOW,96,(y-1));
 HIGHt=iHighest(Symbol(),PERIOD_M15,MODE_HIGH,96,(y-1));

Comment("\ny: "+(y)+"\nHigh"+High[HIGHt]+"\nLow"+Low[LOWt]);

It is bound to be wrong by ±1 here and there :-)

And of course it will ONLY work on an M15 chart (since you are using High[] in your comment)

 
The size of your array is wrong . . . the High is correct by chance . . . not by design. I assume you are trying to get the high and low during a day ? why not just use iHigh and iLow and PERIOD_D1 ? or am I misunderstanding ?
 
dabbler:

This will probably be closer, but I haven't tried it ...

It is bound to be wrong by ±1 here and there :-)

Going by the Red and Blue lines drawn on the chart I think the (y-96) is correct . . .
 
RaptorUK:
Going by the Red and Blue lines drawn on the chart I think the (y-96) is correct . . .
No, I think the count needs to be 1 days worth= 96 M15 bars.
 
dabbler:
No, I think the count needs to be 1 days worth= 96 M15 bars.
Yes, but (y-96) is the starting point, not the count ;-)
 

okay,

I'm predicting movement value, for example (65 pip).

Now I want to know when price touch in my Forecast. (for back test)

Market maybe move over the my forecast .


(96 BARS in Period_M15 equal 1 day)

 
cisco:


(96 BARS in Period_M15 equal 1 day)

Yes . . . but what are you trying to get ? High and Low for a calendar day or for the last 24 hours ?
 
RaptorUK:
Yes, but (y-96) is the starting point, not the count ;-)
Ah, yes, but I couldn't be bothered to figure out which day was which, so I expected it to be wrong by ±1 day on the starting point. But I at least got the count right at 96 in my version :-)
 
dabbler:
No, I think the count needs to be 1 days worth= 96 M15 bars.
There are not 96 M15 bars in a day when your broker is GMT+0. If it's Sunday, only 8 bars. Don't hard code numbers.
datetime now = TimeCurrent(),
         bod = now - now % 86400,
         ltd = iTime(NULL,PERIOD_D1, 1); // Last trading day
int      iBod = iBarShift(NULL,0, bod),
         iLtd = iBarShift(NULL,0, ltd),
         nBars = iLtd - iBod + 1,
         iLL   = iLowest( NULL, MODE_LOW,  nBars-1, iBod+1),
         iHH   = iHighest(NULL, MODE_HIGH, nBars-1, iBod+1);
Comment("High", High[iHH]+"\nLow"+Low[iLL]);
Also works on any chart, not just M15.
RaptorUK:
why not just use iHigh and iLow and PERIOD_D1 ? or am I misunderstanding ?
If all you want is Hi/Lo then iHigh(D1) will work.
 
dabbler:
Ah, yes, but I couldn't be bothered to figure out which day was which, so I expected it to be wrong by ±1 day on the starting point. But I at least got the count right at 96 in my version :-)
Yep, I agree the count is probably going to be 96 . . . just not sure about the starting point . . . if it is (y-1) then he can use iHigh(NULL, PERIOD_D1, 1) and iLow (NULL, PERIOD_D1, 1)