Support Board
Date/Time: Wed, 18 Jun 2025 08:07:56 +0000
Post From: How is ZigZag2 drawing it's lines?
[2025-03-07 16:50:06] |
User153286 - Posts: 57 |
I posted this reply to help others in the future. I hate when I read a post here and there is no follow up. My goal is to build a study similar to zigzag. While I have not yet played with the interpolation api suggested above, I did create something that is/was outputting text (HH, LL, HL, LH) using the SC.usetool. My logic requires to alter previous text items based on the closing of a future bar. In my attempted approach I did this by deleting the previously drawn SC.usetool item and re-creating a new one as required. Oh that was a bad idea... That approach absolutely killed performance. It's not the delete, it's the number of SC.usetool elements in "edit mode" as they are all uniquely selectable in the chart. I had hundreds of them on the chart. I could barely even move the mouse on the chart. Furthermore, the only way I could clear this mess once drawn was to delete the entire chart. All those "editable", unique SC.usertool draw text items could only be individually deleted, even using using the Tool menu delete all feature did not work. What a PITA. Using SC.usetool to draw lines in my custom zigzag study would have been a disaster. I found if I used the same linenumber for each tool it seemed ok, but when I let the system auto generate the id and the tool was configured in "edit mode", that combo was so taxing on the system. I think if the linenumber is the same and I delete the SC.usetool, it would have deleted all of them, not just the "previous" one which is what my logic requires. At this point I have given up on using SC.usetool for multiple items (100's of them) on the screen via a custom study. There are numerous posts here and on the web showing how to code SC.usetool so I am not going into that detail. FYI I am able to use the standard graph structure and alter previous bar values for that graph structure (set value to 0 at barindex). So instead of using text labels, I am going to use a number of graph structures with different markers (red/green dots, up/down triangles, red/green dashes-hashes). The graph structure approach does not seem to affect performance. From my perspective this can be closed. Oh and thanks for the interpolation approach, I foresee some cool things from using the interpolation approach. SC support I do not need a reply unless there is something you deem should be added. |