int zigzag,xs;
double zigzagDown[];
intOnInit()
{
zigzag=iCustom(_Symbol,PERIOD_D1,"Examples\\ZigZag",12,5,3);
return(INIT_SUCCEEDED);
}
voidOnTick()
{
CopyBuffer(zigzag,0,0,Bars(_Symbol,PERIOD_D1),zigzagDown);
ArraySetAsSeries(zigzagDown,true);
//I Set xs as 1 in order to skip the current Candle in order if the trend is bearish it wont count itfor(xs=0; xs<Bars(_Symbol,PERIOD_D1); xs++)
{
if(zigzagDown[xs]!=PLOT_EMPTY_VALUE && zigzagDown[xs] < SymbolInfoDouble(_Symbol,SYMBOL_LAST))
break;
}
Print(zigzagDown[xs]);
}
indicator handle is not checked - indicator handle SHOULD BE CHECKED
in CopyBuffer, 0,0 is a very, very bad habit - you need to accurately write the values
Bars - error again: no check.
And the main question remains: WHY GET all the values from the time of birth of dinosaurs to the current moment, if you are essentially looking for the freshest value (on the graph this is the rightmost value)?
indicator handle is not checked - indicator handle SHOULD BE CHECKED
in CopyBuffer, 0,0 is a very, very bad habit - you need to accurately write the values
Bars - error again: no check.
And the main question remains: WHY GET all the values from the time of birth of dinosaurs to the current moment, if you are essentially looking for the freshest value (on the graph this is the rightmost value)?
I'm writing this code for a new born stock market which the entire history is not much bigger than a thousand bars whit lots of securities with less than a hundred bars- I mean the entire history. the entire code is much bigger than this and actually it's not gonna end with just the first extremum and it keeps going on and checks the last 5 or 6 highs and lows, my only problem is why on earth I can't get the values of ZigZag extremums with this code also I have other functions which sync the data before calling the ZigZag, and it Ioops through 660 securities which I save them before on an sql file. just wonder why this piece of code which it seems to be as easy as a piece of cake keeps returning me just 0.
By the way I edited the code for your Satisfaction
int zigzag,xs;
double zigzagDown[];
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+intOnInit()
{
zigzag=iCustom(_Symbol,PERIOD_D1,"Examples\\ZigZag",12,5,3);
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+//| |//+------------------------------------------------------------------+voidOnTick()
{
if(zigzag!=INVALID_HANDLE && Bars(_Symbol,PERIOD_D1)>0)
{
CopyBuffer(zigzag,0,TimeCurrent(),Bars(_Symbol,PERIOD_D1),zigzagDown);
ArraySetAsSeries(zigzagDown,true);
//I Set xs as 1 in order to skip the current Candle in order if the trend is bearish it wont count itfor(xs=0; xs<Bars(_Symbol,PERIOD_D1); xs++)
{
if(zigzagDown[xs]!=PLOT_EMPTY_VALUE && zigzagDown[xs] < SymbolInfoDouble(_Symbol,SYMBOL_LAST))
break;
}
}
Print(zigzagDown[xs]);
}
//+------------------------------------------------------------------+
240035
Still it doesn't run when the market is closed. There is no Price Ticking
Correct your mistake first.
Correct your mistake first.
Ok This would be how it looks.
240035
Ok This would be how it looks.
Errors:
Errors:
I'm writing this code for a new born stock market which the entire history is not much bigger than a thousand bars whit lots of securities with less than a hundred bars- I mean the entire history. the entire code is much bigger than this and actually it's not gonna end with just the first extremum and it keeps going on and checks the last 5 or 6 highs and lows, my only problem is why on earth I can't get the values of ZigZag extremums with this code also I have other functions which sync the data before calling the ZigZag, and it Ioops through 660 securities which I save them before on an sql file. just wonder why this piece of code which it seems to be as easy as a piece of cake keeps returning me just 0.
240035
By the way I edited the code for your Satisfaction
ZigZag can be not only 'PLOT_EMPTY_VALUE', ZigZag can be '0.0'.
ZigZag can be not only 'PLOT_EMPTY_VALUE', ZigZag can be '0.0'.
Oh Yesssss I Can see it now. it works as a charm. you are a life saver I can't tell how I'm thankful.
I wish you all the best