WHRoeder:
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.
WHRoeder:
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.
void Pass(int whichday,int Forecast){
int y=0;
int LOWt=0;
int HIGHt=0;
double Dif=0;
y=iBarShift(Symbol(),PERIOD_M15,iTime(Symbol(),PERIOD_D1,whichday));
int ds=y-96;
for (int u=y-1;u>ds;u--){
LOWt=Low[iLowest(Symbol(),PERIOD_M15,MODE_LOW,y,u)];
HIGHt=High[iHighest(Symbol(),PERIOD_M15,MODE_HIGH,y,u)];
Dif=(HIGHt-LOWt)/Point;
if(Dif>=Forecst)Break;
}
High.A=HIGHt;
Low.A=LOWt;
.
.
.
}
RaptorUK:
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)
void Pass(int whichday,int Forecast){
int y=0;
int LOWt=0;
int HIGHt=0;
double Dif=0;
y=iBarShift(Symbol(),PERIOD_M15,iTime(Symbol(),PERIOD_D1,whichday));
int ds=y-96;
for (int u=y-1;u>ds;u--){
LOWt=Low[iLowest(Symbol(),PERIOD_M15,MODE_LOW,y,u)];
HIGHt=High[iHighest(Symbol(),PERIOD_M15,MODE_HIGH,y,u)];
Dif=(HIGHt-LOWt)/Point;
if(Dif>=Forecst)Break;
}
High.A=HIGHt;
Low.A=LOWt;
.
.
.
}
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)
RaptorUK:
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 ?
WHRoeder:
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);
}
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
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