Thanks. Below is my code:
I want the highest value of last_bars' High and lowest value of last_bars' Low.
range_high=High[0];
for(i=1;i<last_bars;i++)
{
range_high=MathMax(range_high, High[i]);
}
range_low=Low[0];
for(i=1;i<last_bars;i++)
{
range_low=MathMin(range_low, Low[i]);
}
Print(range_high," ",Low[0]," ",range_low);
The result of range_high is correct. But the result of range_low is not.
Low[0] and High[0] are referencing the current Bar, which hasn't completed yet. So, by definition, they will be changing all the time.
But more likely as you found out, if there is a trend, then one of them will be changing while the other is static. If the price is moving downwards for eg, then Low[0] will be changing all the time.
int start() { int i; double range_high=High[0]; for(i=1;i<20;i++) { range_high=MathMax(range_high, High[i]); } double range_low=Low[0]; for(i=1;i<20;i++) { range_low=MathMin(range_low, Low[i]); } Print(range_high," ",Low[0]," ",range_low); return(0); }Everything's working:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I use Low[], but the result is Open[], why?
Anybody can help me with this?