![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
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.
Also works on any chart, not just M15.
Guilty as charged :-(
I always forget there are poor unfortunates who have more than 5 days in their FOREX charts.
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.
Also works on any chart, not just M15.
If all you want is Hi/Lo then iHigh(D1) will work.
Guilty as charged :-(
I always forget there are poor unfortunates who have more than 5 days in their FOREX charts.
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)
This will probably be closer, but I haven't tried it ...
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 ?
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.
Also works on any chart, not just M15.
If all you want is Hi/Lo then iHigh(D1) will work.
thanks guys,
i find it solution.
double Toll.Pass(int whichday,double Toll){ int y=0,z=0; double LOWt=0; double HIGHt=0; double Dif=0; y=iBarShift(Symbol(),PERIOD_M15,iTime(Symbol(),PERIOD_D1,whichday)); z=iBarShift(Symbol(),PERIOD_M15,iTime(Symbol(),PERIOD_D1,(whichday+1))); int ds=z-y;//264 int cunt=ds; for (int u=1;u<cunt;u++){ LOWt=Low[iLowest(Symbol(),PERIOD_M15,MODE_LOW,u+1,y+ds-1)]; HIGHt=High[iHighest(Symbol(),PERIOD_M15,MODE_HIGH,u+1,y+(ds-1))]; if(((HIGHt-LOWt)/Point)>=Toll)break; ds--; } // Comment("Y: "+y+"\nZ: "+z+"\nds : "+(cunt)+"\ny+cunt"+(y+cunt-1)+"\ny: "+(y)+"\nToll: "+Toll+"\nHigh"+HIGHt+"\nLow"+LOWt); // return(901); }
thanks guys,
i find it solution.
Or you could have done this ? no ? doesn't it do what you want ?
Or you could have done this ? no ? doesn't it do what you want ?
You might like to consider using a different variable name when posting on an English speaking forum ...
int cunt=ds;
http://dictionary.reference.com/browse/cunt