| / | Forum |
|
c0d3
2006.08.24 23:01
I'm trying to determine direction of zigzag indicator with the icustom command.
This is what i have so far: ZigZagHigh=iCustom(NULL,0,"ZigZag",MODE_HIGH,0); ZigZagLow=iCustom(NULL,0,"ZigZag",MODE_LOW,0); The lines are drawn on the chart, but both ZigZagHigh and ZigZagLow are equal to zero when I run the program. How would i determine the trend of the ZigZag indicator with the icustom function? Thanks |
|
In this statistical report, we analyze 25 of the most profitable Expert Advisors. The analyses are aimed at description of such characteristics of Expert Advisors as risk level and stability. |
|
zolero
2006.08.25 04:21
whatever you are trying to do, this is probably not the way to get it.
look at 'Custiom indicators, experts and strategy testing' -- I explained the way to use iCustom... I think you should have change the indicator and make two extra buffers to get those data. low value is for example LOWbuff[] high value is HIGHbuff[] now if you have a new high (inside indicator) then you check is this different from the value stored right now... if it is, you have a new value... 1.2815 ZigZag max for example bar1 bar2 bar3 ... barx new value comes as 1.2755 your will be something like HIGHBUFF[1.2815,1.2815,....,1.2815,1.2755,1.2755... . ] then you use Icustom(NULL,0,"ZigZag",3,0); --> and voila! you have your number Hope you can understand what I'm talkin' about... zolero |
|
c0d3
2006.08.29 03:04
zolero wrote: No, i actually do not get it, whatever you are trying to do, this is probably not the way to get it. look at 'Custiom indicators, experts and strategy testing' -- I explained the way to use iCustom... I think you should have change the indicator and make two extra buffers to get those data. low value is for example LOWbuff[] high value is HIGHbuff[] now if you have a new high (inside indicator) then you check is this different from the value stored right now... if it is, you have a new value... 1.2815 ZigZag max for example bar1 bar2 bar3 ... barx new value comes as 1.2755 your will be something like HIGHBUFF[1.2815,1.2815,....,1.2815,1.2755,1.2755... . ] then you use Icustom(NULL,0,"ZigZag",3,0); --> and voila! you have your number Hope you can understand what I'm talkin' about... zolero All i want is to make my EA know which way zigzag indicator is pointing (UP OR DOWN). HOW WOULD I GO ABOUT DOING THAT? |
|
zolero
2006.08.29 16:56
All i want is to make my EA know which way zigzag indicator is pointing (UP OR DOWN).
HOW WOULD I GO ABOUT DOING THAT? Probably you want to know was last two values (as zigzag doesn't have always a value).
So you have to read last two values of an indicator:int n, i; double zag, zig; i=0; while(n<2) { if(zig>0) zag=zig; zig=iCustom(NULL, 0, "ZigZag", 0, i); if(zig>0) n+=1; i++; }now you have two numbers zig -- last value and zag -- value before that if(zag>zig) indicator shows down if(zig>zag) indicator shows up zolero |
|
c0d3
2006.08.30 05:14
zolero wrote: THANKS, got it, works like a charmAll i want is to make my EA know which way zigzag indicator is pointing (UP OR DOWN).
HOW WOULD I GO ABOUT DOING THAT? Probably you want to know was last two values (as zigzag doesn't have always a value).
So you have to read last two values of an indicator:int n, i; double zag, zig; i=0; while(n<2) { if(zig>0) zag=zig; zig=iCustom(NULL, 0, "ZigZag", 0, i); if(zig>0) n+=1; i++; }now you have two numbers zig -- last value and zag -- value before that if(zag>zig) indicator shows down if(zig>zag) indicator shows up zolero |
|
c0d3
2006.08.30 22:46
c0d3 wrote:
zolero wrote: THANKS, got it, works like a charmAll i want is to make my EA know which way zigzag indicator is pointing (UP OR DOWN).
HOW WOULD I GO ABOUT DOING THAT? Probably you want to know was last two values (as zigzag doesn't have always a value).
So you have to read last two values of an indicator:int n, i; double zag, zig; i=0; while(n<2) { if(zig>0) zag=zig; zig=iCustom(NULL, 0, "ZigZag", 0, i); if(zig>0) n+=1; i++; }now you have two numbers zig -- last value and zag -- value before that if(zag>zig) indicator shows down if(zig>zag) indicator shows up zolero AFTER TESTING IT, if(zag<zig) indicator shows down if(zig<zag) indicator shows up i THINK THAT IS CORRECT, IT WAS GIVING OPPOSITE DIRECTION WITH (zag>zig), (zig>zag) |
|
zolero
2006.09.01 17:13
c0d3 wrote: I was looking last line already on the chart. this means that last line was looking
down [or up]. It should mean that right now up [or down] movement is expected.
But there is a little problem with taking it as up or down signal: zigzag can [and
often do] redraw itself. this means that if the line between two points is showing
south (from 1.2900 to 1.2850) then it doesn't mean that the price goes up. It will
probably go up but there is a big chance that after some movement down you have
new line down (from 1.2900 to 1.2820) and so on. My point is that having a line
on chart doesn't mean that movement to this direction is over.i THINK THAT IS CORRECT, IT WAS GIVING OPPOSITE DIRECTION WITH (zag>zig), (zig>zag)
|
|
malamoudi
2006.09.08 03:47
int n, i; double zag, zig; i=0; while(n<2) { if(zig>0) zag=zig; zig=iCustom(NULL, 0, "ZigZag", 0, i); if(zig>0) n+=1; i++; } |
|
malamoudi
2006.09.08 03:50
&nbint n, i; double zag, zig; i=0; while(n<2) { if(zig>0) zag=zig; zig=iCustom(NULL, 0, "ZigZag", 0, i); if(zig>0) n+=1; i++; }sp;int n, i; double zag, zig; i=0; while(n<2) { if(zig>0) zag=zig; zig=iCustom(NULL, 0, "ZigZag", 0, i); if(zig>0) n+=1; i++; } |
|
zolero
2006.09.09 12:36
I modified a little bit zigzag code to show what I mean by false signal. like they
say: one picture can tell more than 1000 words....
![]() The red line is original zigzag and it goes from bottom to top and back again in best moments... at least seems like this. But if you are coding an ea then ea get's signals which are close to yellow line. it can be even worse as I made really quick hack... the code is redrawing up or down line until next line has been drawed and so step by step changing yellow line (deleting max and min values) until you get a red line... |
|
zsqabca
2007.07.26 11:18
|