Vladislav Boyko #: I attached AutoScaleZZ2_fixed.mq5
Apparently, in AutoScaleZZ2_fixed.mq5 in MT5 the highlighted line does not work correctly. Because when moving a high point, the previous value of the point remains in the buffer (but must be cleared).
I don't know why this is happening. I couldn't figure out the reason quickly, I don't have enough free time to figure out the reason, sorry.
//+------------------------------------------------------------------+//| Calculation High ZZ Point |//+------------------------------------------------------------------+void HighZZPoint(constint index, constdouble &high[], constdouble &low[]){
double PriceHigh = high[index]; // Current maximum price valuedouble PriceLow = low[index]; // Current minimum price valuedouble EventHigh = False; // High point ZZ update eventdouble EventLow = False; // Low point ZZ update eventdouble R_Step = MathAbs((ArrayHighLast[index + 1] - PriceLow)/PriceLow) * 100.0; // Price range in percentdouble StepDownLevel = PriceLow/SpecDivSymb/ZZScale; // Step to form a segment down// Updating and redrawing the maximum extremumif(PriceHigh > ArrayHighLast[index + 1]){
EventHigh = True;
ArrayTypeZZ[index] = 1;
ArrayHighZZ[(int)ArrayHighBarZZ[index + 1]] = 0.0;
Vladislav Boyko #: Apparently, in AutoScaleZZ2_fixed.mq5 in MT5 the highlighted line does not work correctly. Because when moving a high point, the previous value of the point remains in the buffer (but must be cleared).
Here's a visual demonstration. See the data window - multiple values in a row in the "High Point ZZ" buffer. That's why it's not displaying correctly.
that line you highlighted is indeed not working as it should, it caused an exception every time for me. You can force it to work by insuring the previous bar index is always a positive number (and then clear the value of the buffer with that index), but even though this would work, it will cause the zigzag to look odd
Conor Mcnamara #: that line you highlighted is indeed not working as it should, it caused an exception every time for me. You can force it to work by insuring the previous bar index is always a positive number (and then clear the value of the buffer with that index), but even though this would work, it will cause the zigzag to look odd
Using 0.0 as an empty value of an indicator buffer is a bad idea if the indicator stores bar indexes in buffers. And storing bar indexes in buffers is also a bad idea. I would rather write from scratch instead of converting this (but I don't have time for that). Because it's someone else's complex code. Your own complex code will always be clearer and more debuggable than someone else's complex code.
Your own complex code will always be clearer and more debuggable than someone else's complex code.
Wise words. I removed the logic of 0.0 (which also means NULL in this framework), and went back to EMPTY_VALUE. I have things working correctly for MT5 now, I may not have it built in cross-platform, but I'm happy enough as long as there is both a working MT4 and MT5 implementation.
I have a correctly working series version now if you're interested. Indexing is more delicate, and a decremental loop is needed in the main calculation loop.
(btw this zigzag is only built to work on currency pairs)
Why? It's just a derivative of the price. You can build it even on a cardiogram
Yea but the original only worked on currency pairs with normal scaling values. I don't fully understand the authors scaling calculation, so I don't know why this doesn't work on say...gold or bitcoin. I'm thinking because gold and bitcoin are on extremely different prices.
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.
I attached AutoScaleZZ2_fixed.mq5
Apparently, in AutoScaleZZ2_fixed.mq5 in MT5 the highlighted line does not work correctly. Because when moving a high point, the previous value of the point remains in the buffer (but must be cleared).
I don't know why this is happening. I couldn't figure out the reason quickly, I don't have enough free time to figure out the reason, sorry.
Apparently, in AutoScaleZZ2_fixed.mq5 in MT5 the highlighted line does not work correctly. Because when moving a high point, the previous value of the point remains in the buffer (but must be cleared).
Here's a visual demonstration. See the data window - multiple values in a row in the "High Point ZZ" buffer. That's why it's not displaying correctly.
that line you highlighted is indeed not working as it should, it caused an exception every time for me. You can force it to work by insuring the previous bar index is always a positive number (and then clear the value of the buffer with that index), but even though this would work, it will cause the zigzag to look odd
Using 0.0 as an empty value of an indicator buffer is a bad idea if the indicator stores bar indexes in buffers. And storing bar indexes in buffers is also a bad idea. I would rather write from scratch instead of converting this (but I don't have time for that). Because it's someone else's complex code. Your own complex code will always be clearer and more debuggable than someone else's complex code.
Your own complex code will always be clearer and more debuggable than someone else's complex code.
Wise words. I removed the logic of 0.0 (which also means NULL in this framework), and went back to EMPTY_VALUE. I have things working correctly for MT5 now, I may not have it built in cross-platform, but I'm happy enough as long as there is both a working MT4 and MT5 implementation.
I have a correctly working series version now if you're interested. Indexing is more delicate, and a decremental loop is needed in the main calculation loop.
(btw this zigzag is only built to work on currency pairs)
(btw this zigzag is only built to work on currency pairs)
Why? It's just a derivative of the price. You can build it even on a cardiogram
Why? It's just a derivative of the price. You can build it even on a cardiogram