ubuntuboy
My question is: if I take Low[0], will this give me the current Low for 5:05
This... 0 indexes the currently forming bar.
Also, this might be better than doing the loop.
double low=iLow(NULL,0,iLowest(NULL,0,MODE_LOW,5,1)); double high=iHigh(NULL,0,iHighest(NULL,MODE_HIGH,5,1));
HTH
V
Thanks V! So for the last five completed bars, I'd want 1...5, inclusive? I'll keep the loop, but thanks for the information about the functions. I assume the functions simply do the loop anyways. More important to me, though, is readability. Sooner or later I'll want to come back and edit this code (for whatever reason), and a simple for loop is easier to interpret than a function within a function, not to mention the enums! Thanks again for the speedy reply.
No probs.... yes, you would want 1-5, but it's easy enough to experiment with.... and if readability's the game... :)
int lowestbar=iLowest(NULL,0,MODE_LOW,5,1); double low = Low[lowestbar];V
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
Hi all, since trading is closed with my broker for the weekend, I have no way to test this reliably. I want to draw horizontal lines at the highest high and lowest low of the last five completed bars while the 6th bar is in progress. In other words, I want to draw the lines for data from times, say, 5:00, 5:01, 5:02, 5:03, and 5:04 during 5:05. I wrote an EA for this (intend to write a script but since I've only coded EAs, this'll do for now).
My question is: if I take Low[0], will this give me the current Low for 5:05 (in the example above, subject to change) or the last completed bar Low (as in 5:04 in the example above)?
The code:
Only the init() function has code.