It is still just giving a flat line...Not to sure why.
Is it ? or does it just look like it is ? take a look at the buffer values using the Data Window (Ctrl + D) for a flatline the values will all be the same . . .
It is working GREAT.....Now I just need to get the BinSig = Previous value (either 1 or -1, instead of 0 at the end of the code).
Do I just make it BinSig[i+1]?
Have a quick look at the code again for me please.
Thank you again...YIPPEE...Brilliant!!! :)
Code below.
Tim
int start()
{
int limit;
int counted_bars=IndicatorCounted();
//---- last counted bar will be recountedif(counted_bars>0) counted_bars--;
limit=Bars-counted_bars;
///---- Close from Todayfor(int i=0; i<limit; i++)
HOURCLOSE0[i]=iClose(Symbol(),PERIOD_H1,i);
//---- Close from Yesterdayfor(i=0; i<limit; i++)
HOURCLOSE1[i]=iClose(Symbol(),PERIOD_H1,i);
//---- Close from 2 Days agofor(i=0; i<limit; i++)
HOURCLOSE2[i]=iClose(Symbol(),PERIOD_H1,i);
//---- Binary Trendfor(i=0; i<limit; i++)
if((HOURCLOSE1[i+1]>HOURCLOSE2[i+2])&&(HOURCLOSE0[i]>HOURCLOSE1[i+1]))
{
BinSig[i]=1;
}
elseif((HOURCLOSE1[i+1]<HOURCLOSE2[i+2])&&(HOURCLOSE0[i]<HOURCLOSE1[i+1]))
{
BinSig[i]=-1;
}
elseBinSig[i]=0;
//---- donereturn(0);
}
for(int i=0; i<limit; i++)
HOURCLOSE0[i]=iClose(Symbol(),PERIOD_H1,i);
//---- Close from Yesterdayfor(i=0; i<limit; i++)
HOURCLOSE1[i]=iClose(Symbol(),PERIOD_H1,i);
//---- Close from 2 Days agofor(i=0; i<limit; i++)
HOURCLOSE2[i]=iClose(Symbol(),PERIOD_H1,i);
You are assigning exactly the same value to each array
Not sure why it is just a flat line now....I think I have gone backwards in coding...lol
Do you understand why you need to make the change you have made ? please answer this Q.
If you do understand . . . why didnt you also change this loop ?
for(int i=0; i<limit; i++)
HOURCLOSE0[i]=Bid;
HOURCLOSEPAST1[i]=iClose(Symbol(),PERIOD_H1,i+1); // this line is not within the loop
HOURCLOSEPAST2[i]=iClose(Symbol(),PERIOD_H1,i+2); // this line is not within the loop
Why have you changed from using HOURCLOSE0 to using HOURCLOSE0, HOURCLOSE1 & HOURCLOSE2 ?
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.
Hi WHRoeder,
It is still just giving a flat line...Not to sure why.
YYYEEEEEAAAAHHHHH!!!!!!
It is working GREAT.....Now I just need to get the BinSig = Previous value (either 1 or -1, instead of 0 at the end of the code).
Do I just make it BinSig[i+1]?
Have a quick look at the code again for me please.
Thank you again...YIPPEE...Brilliant!!! :)
Code below.
Tim
Nope...I tried BinSig[i]=BinSig[i+1]; and leaves a dotted line. Not connected.
Bit Confused...lol
Thank you.
Tim.
You are assigning exactly the same value to each array
Hi Guys,
Thank you very much again for everything...Great learning curve...
GumRai: I think I have fixed the assigning of values....Have a look at code below.
I'm still struggling with the code for "instead of 0, then the last value that wasn't a 0(i.e 1 or -1)"
I tried "BinSig[i+1]" but that just gave the previous value of BinSig, even if the previous value was a 0.
Very confused...Need help big time with that code.
And I have no idea how to make the "BinSig" change its look with different time frames, but still keep the PERIOD_H1 signals.
I'm almost there.....I can smell it...I just need a bit of help to cross the finish line....lol... :)
Thanks again guys and gals!
Cheers,
Tim.
Hi Guys,
Thank you very much again for everything...Great learning curve...
GumRai: I think I have fixed the assigning of values....Have a look at code below.
I'm still struggling with the code for "instead of 0, then the last value that wasn't a 0(i.e 1 or -1)"
I tried "BinSig[i+1]" but that just gave the previous value of BinSig, even if the previous value was a 0.
Look at this section of code and work through the first few values in the loop manually to see if the code works . . .
. . . the first loop value is 0
the net loop value is 1HOURCLOSE[0] == Bid
HOURCLOSE[1], HOURCLOSE[2] have not been calculated yet . . .
HOURCLOSE[1] == Close for H1 Bar 1
HOURCLOSE[2], HOURCLOSE[3] have not been calculated yet . . . .
etc. do you see the issue ?
Now do the same with this modified for loop . . .
Hi Raptor,
Not sure why it is just a flat line now....I think I have gone backwards in coding...lol
Cheers,
Tim.
Hi Raptor,
Not sure why it is just a flat line now....I think I have gone backwards in coding...lol
Do you understand why you need to make the change you have made ? please answer this Q.
If you do understand . . . why didnt you also change this loop ?
Why have you changed from using HOURCLOSE0 to using HOURCLOSE0, HOURCLOSE1 & HOURCLOSE2 ?