Hello to the MQL community,
I'm using the ZigZag indicator for my strategy and building an EA for that porpuse. Is there a way for getting info. from this indicator?
The info. that i need, is the price at the last top "zigzag", and the price at the last bottom "zigzag".
Thank you for the help!
Hi,
in the codebase was an indicator called AutoFibAutoTrend.mq4 using the zigzag.
Will help you for your question, take care about repainting like brewmanz was telling you before !!1
Some things i notice during the developement of the AutoFibAutoTrend, the repainting in general is not an issue if you don't use the last value as the OP showed in the picutre. The biggest problem regarding the ZigZag is that in some cases it draws to bottom Zag's without a upper Zig in the middle,
I suggest to:
- use a non repainting zigzag from the codebase
- impelment a checkZZ() function wich makes sure that: ( (zz1>zz2 && zz2<zz3) || (zz1<zz2 && zz2>zz3) )
- I do think now, after i have done more work with the standart zz that it is not well coded, because we can life with some recalculations, but this indicator in also not always the same when we reattach it to the screen. This point makes it really hard to develope a system based on it.
- I made a "MA cross based ZigZag" which does not repaint. It might lag a bit. There was also released another really intersting ZigZag variation on the same day as mine. I suggest you try these two and the that one which fits better your tradingstyle.
- Attach the zigzag in Visual Tester mode to see how it behaves, this is always recommend when you test a "new" indicator.
i used this code for get price from high and low of zigzag
int zigZagHandle=INVALID_HANDLE; double ExtZigZagLowBuffer[]; int OnInit(){ if( (zigZagHandle=iCustom(_Symbol, _Period, "::Indicators\\Examples\\ZigZag.ex5", 5, 3, 3)) == INVALID_HANDLE ) return(INIT_FAILED); return(INIT_SUCCEEDED); } if(CopyBuffer(zigZagHandle, 2, 0, 100, ExtZigZagLowBuffer) <= 0) ArraySetAsSeries(ExtZigZagLowBuffer,true); void fn(){ double stopLoss; for(int i=0;i<99;i++){ if(ExtZigZagLowBuffer[i] > 0){ stopLoss = iLow(Symbol(), Period(), i); printf("stopLoss=" + stopLoss); break; } } }
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hello to the MQL community,
I'm using the ZigZag indicator for my strategy and building an EA for that porpuse. Is there a way for getting info. from this indicator?
The info. that i need, is the price at the last top "zigzag", and the price at the last bottom "zigzag".
Thank you for the help!