Support Board
Date/Time: Mon, 16 Jun 2025 22:47:36 +0000
ZigZag2 function not creating nodes at exact reversal amount
View Count: 295
[2025-04-28 12:39:33] |
Theodore01 - Posts: 6 |
Hello, I've identified an issue with the ZigZag study when applied to FlexRenko charts. When the price movement equals exactly the specified reversal amount, nodes are not being created as expected. Example 1: - Renko brick size: $20 - ZigZag Reversal amount: $50 - From low point to 3rd green Renko close: exactly 2.5 bricks = $50 - Expected: A node should be created at the low point - Actual: No node is created - https://www.sierrachart.com/image.php?Image=1745590873605.png Example 2: - Renko brick size: $20 - ZigZag Reversal amount: $40 - From low point to 2nd green Renko close: exactly 2 bricks = $40 - Expected: A node should be created at the low point - Actual: No node is created - https://www.sierrachart.com/image.php?Image=1745591289741.png Settings used: - Zig Zag Input Data: Renko Close - Number of Bars Required for Reversal: 1 Workaround found: Using reversal amounts slightly less than the target value (e.g., 49.9 instead of 50, 39.9 instead of 40) creates nodes as expected. This suggests the ZigZag2 built-in function might be using a "greater than" comparison instead of "greater than or equal to" when checking if a price movement qualifies as a reversal. Could the ZigZag2 function be modified to recognize price movements that equal the exact reversal amount? This would make zigzag behavior more predictable when used with Renko charts where price movements occur in precise brick increments. This is the code block the calls the built-in ZigZag2 from Studies7.cpp : //Calculate and set the zigzag lines
switch (Input_CalculationMode.GetInt()) { case 1: sc.ZigZag( sc.BaseData[Input_DataHigh.GetInputDataIndex()], sc.BaseData[Input_DataLow.GetInputDataIndex()], Subgraph_ZigZagLine, CalcIndex, Input_ReversalPercent.GetFloat() * 0.01f, ZigZagStartIndex); break; case 2: sc.ZigZag2( sc.BaseData[Input_DataHigh.GetInputDataIndex()], sc.BaseData[Input_DataLow.GetInputDataIndex()], Subgraph_ZigZagLine, CalcIndex, Input_NumberBarsForReversal.GetInt(), Input_ReversalAmount.GetFloat(), ZigZagStartIndex); break; case 3: sc.ZigZag( sc.BaseData[Input_DataHigh.GetInputDataIndex()], sc.BaseData[Input_DataLow.GetInputDataIndex()], Subgraph_ZigZagLine, CalcIndex, 0.0f, Input_ReversalAmount.GetFloat(), ZigZagStartIndex); break; } Thank you! |
[2025-04-29 16:05:35] |
Sierra_Chart Engineering - Posts: 19938 |
We have reviewed this. We cannot change the code as it will then alter the current functionality being relied on. However, the source code is available and you can modify it: The core study function is in /ACS_Source/SCStudyFunctions.cpp The function is: ResettableZigZag2_S Refer to: How to Build an Advanced Custom Study from Source Code Sierra Chart Support - Engineering Level Your definitive source for support. Other responses are from users. Try to keep your questions brief and to the point. Be aware of support policy: https://www.sierrachart.com/index.php?l=PostingInformation.php#GeneralInformation For the most reliable, advanced, and zero cost futures order routing, use the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2025-04-29 16:06:04
|
To post a message in this thread, you need to log in with your Sierra Chart account: