for(i = 0; i < limit; i++) { // start buffer for loop line[i] = pipsmoved(1,i); // formula for price pressure line2[i] = (Close[i] - Open[i])/point(); // open close line if(line[ArrayMaximum(line, peroid, i)] > 0)
On the first run you've filled in just line[0] only. So what is the value of ArrayMaximum(line, peroid, 0) BOGUS.
- You should count down.
- No need to initialize arrays to zero.
- Don't use arrays that have not been initialized.
SetIndexDrawBegin(2, peroid); SetIndexDrawBegin(3, peroid); : int limit = Bars -1 - counted_bars; for(i = limit; i >= 0; i--){ line[i] = pipsmoved(1,i); line2[i] = (Close[i] - Open[i])/point(); } if (counted_bars < peroid) limit = Bars - 1 - peroid; for(i = limit; i >= 0; i--){ line3[i] = (line[ArrayMaximum(line, peroid, i)]); line4[i] = (line[ArrayMinimum(line, peroid, i)]); }
- Why are you creating a million objects. That should be just another buffer. See Fractals - MQL4 Code Base
Thanks WHRoeder, I would have never figured that out myself. My newbieness must frustrate you lol .
You're right about the objects, I will have to switch that over to the indexstyle.
Thanks again Man.
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
Hey guys another question, I am trying to figure out the indicator side of programing. Having a few problems.
First Trouble is one of the indicator buffers doesn't draw properly. A problem with buffer 3&4 which I basically want to make a Highest and lowest channel out of the first buffer...
Here is the relevant code..
Second is the object placement. That doesn't seem to work very well. Any tips on what I have done wrong there would be appreciated.
Here is a shot of what it looks like when I first load it...
Then after it is loaded and I press compile while its still loaded it looks like this. Which is actually what it should look like...
Help lol - Dale