Support Board
Date/Time: Wed, 15 Jan 2025 15:59:42 +0000
Subgraph display bug?
View Count: 969
[2017-07-25 14:45:59] |
User540518 - Posts: 6 |
Hi, Is there a known display bug when .DrawZeros is set to false? I've written a study that draws Harmonic Gartley patterns using Subgraphs. So the subgraph settings look something like this: BuyGartleyLine.Name = "Buy Gartley"; //stores the main Bullish Gartley M pattern, drawn using solid lines BuyGartleyLine.DrawStyle = DRAWSTYLE_LINE; BuyGartleyLine.LineStyle = LINESTYLE_SOLID; BuyGartleyLine.LineWidth = 2; BuyGartleyLine.DrawZeros = false; BuyGartleyLine.PrimaryColor = RGB(0, 255, 255); //Light blue BuyGartleyBofXAandDofBC.Name = "Buy Gartley BofXA and DofBC";//stores the BofXA and DofBC fib lines, drawn using dashed lines BuyGartleyBofXAandDofBC.DrawStyle = DRAWSTYLE_LINE; BuyGartleyBofXAandDofBC.LineStyle = LINESTYLE_DASH; BuyGartleyBofXAandDofBC.LineWidth = 1; BuyGartleyBofXAandDofBC.DrawZeros = false; BuyGartleyBofXAandDofBC.PrimaryColor = RGB(0, 255, 255);//Light blue When there is only one drawn pattern visible on the screen, it displays correctly and the ".Drawzeros = false" takes effect. See attached "CorrectWithOneDrawing.JPG" When there are two patterns visible on the screen, Sierrachart is drawing a connecting line. See attached "IncorrectWithTwoDrawings.jpg". You can clearly see that in the Chart Values window, the subgraph .Data[] indexes are clearly zero, as intended by ".Drawzeros = false". However, SierraChart is still drawing a connecting line between the two patterns. I've already tried to manuall set the .Data[] indexes to zero both before and after the subgraph array indexes that have values, still doesnt work. Is this a bug? if so how do I work around it? Thanks, Mike Date Time Of Last Edit: 2017-07-25 14:49:02
|
CorrectwithOneDrawing.JPG / V - Attached On 2017-07-25 14:45:40 UTC - Size: 172.83 KB - 340 views incorrectwithtwodrawings.JPG / V - Attached On 2017-07-25 14:45:46 UTC - Size: 214.12 KB - 357 views |
[2017-07-25 17:36:53] |
Sierra Chart Engineering - Posts: 104368 |
That looks really nice. Are you going to make this publicly available? We have answered this in the documentation here: Chart Studies: Line (ACSIL: DRAWSTYLE_LINE) You need to use Line - Skip Zeros. 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, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2017-07-25 17:53:16] |
User540518 - Posts: 6 |
Thanks, I'm glad that it might be considered useful. I'm only forced to write this study because I can't find anyone else who's written Gartley/Bat/5-0/AB=CD/etc for SierraChart. Yes, once bug free I'd consider releasing it. I will investigate the use of "Line - Skip Zeros" when I get home...I didnt choose that initially because I didnt think the lines would be drawn between the vertices (of the "triangle") that also have zeros in between them. I dont have visibility into InternalResettableZigZag(), the arrays in the main ZigZag subgraph.data[] have values (they aren't zeros like the subgraph's I'm using, which is why I didnt think "Line - Skip Zeros" was a good fit). What function is being used to populate the zigzag subgraph.data[] with values (that are on the slope of the zig zag line)? and is it publicly (class wise) accessible? I can use this to populate my Gartley subgraph with values on the line (instead of having it just be zeros in between the triangle vertices). Appreciate your help. Mike Date Time Of Last Edit: 2017-07-25 18:11:23
|
[2017-07-25 21:41:26] |
Sierra Chart Engineering - Posts: 104368 |
I didnt choose that initially because I didnt think the lines would be drawn between the vertices (of the "triangle") that also have zeros in between them. Yes this is true and the solution to this is to set all of the points along the lines of a triangle.Have a look at the Automatic Trendlines study for an example: https://www.sierrachart.com/index.php?page=doc/BuildCustomStudiesDLL.html#SearchingSourceCodeBuiltIn 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, *change* to the Teton service: Sierra Chart Teton Futures Order Routing |
[2017-07-28 14:41:57] |
User540518 - Posts: 6 |
Thanks for pointing this code out, its a bit too convoluted. I ended up using my own slope function. Hopefully this helps out someone else. //Solves for y in the equation y = mx + b, we look for Y on based on the X value of the line (MidpointX) passed to us. double CalculateY(int X1, double Y1, int X2, double Y2, double MidpointX) { double Y = 0, //used to solve for equation of our line X = 0, //current bar index we are searching for M = 0, //slope of the line B = 0; //y intercept //We are always in Quadrant II in terms of Cartesian coordinates //we have to accomodate this by making our X1 and X2 values negative, now we are in Quadrant I X1 = -1 * X1; X2 = -1 * X2; //Calculate our slope //there is a possible divide by zero error here if we get to the latest bar (ArrazySize) and dont check for that condition if ((X2 - X1) != 0) { M = (Y2 - Y1) / (X2 - X1); } else { M = 1; } //must solve for b to get y intercept, equation then becomes b = Y1 - M*X1 B = Y1 - (M*X1); //Print("B1 is: " + B); //B = Y2 - (M*X2); //double check our y intercept, B1 and B2 should be the same //Print("B2 is: " + B); //find the Y that resides on our line for the previous bar. y = mx + b X = -1 * MidpointX; //adjusts for Quandrant II by multiplying (-1) to MidpointX Y = M*X + B; //Print("MidpointX: " + X + " MidpointY is: " + NormalizeDouble(Y,5)); return(Y); }//end of CalculateY Thanks for the tips. Mike Date Time Of Last Edit: 2017-07-28 14:42:16
|
[2017-07-28 15:09:35] |
Sierra Chart Engineering - Posts: 104368 |
When we referred you to Automatic Trendlines we had not had a look at it. We see now that it is a complicated function. Although it works correctly, the way that it is doing the calculations may not be so clear. Anyway, we created this function in the latest prerelease: sc.FillSubgraphElementsWithLinearValuesBetweenBeginEndValues(int SubgraphIndex, int BeginIndex, int EndIndex) 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, *change* to the Teton service: Sierra Chart Teton Futures Order Routing Date Time Of Last Edit: 2017-07-28 15:10:14
|
[2017-07-28 20:18:28] |
User540518 - Posts: 6 |
Nice! its always gratifying to see a platform vendor be so responsive and agile to change. Thanks! Mike |
To post a message in this thread, you need to log in with your Sierra Chart account: