Login Page - Create Account

Support Board


Date/Time: Wed, 27 Nov 2024 19:45:46 +0000



[Programming Help] - [Programming Help] - Horizontal Lines Cumulative Increment Levels

View Count: 449

[2023-07-24 13:15:00]
User688525 - Posts: 259
Hello,
I am modifying the Horizontal Lines at Increment study (scsf_HorizontalLinesAtIncrement) and would appreciate some assistance with increasing the increment in an additive way. For example, the current study requests the "Start Value" (base price) and the "Line Increment" (amount to increase each level by), however, this is a fixed increase. For example, if the "Start Value" is "1000" and the "Line Increment" is "25", the plotted levels will be: 1025, 1050, 1075, 1100, 1125, etc.

Assuming the final line of code "CurrentLineValue += Input_LineIncrement.GetFloat();" is the code that requires modifying, what code is required for each plotted level to increment the cumulative increment total? For example, instead of plotting levels every 25 points, how can levels be plotted as follows: 1025, 1075, 1150, 1250, 1375, etc.

I understand some sort of loop is required to plot each level based on adding the increment amount to the cumulative increment total, but am unsure how this would be coded.

Thank you
[2023-07-25 13:42:18]
JohnR - User831573 - Posts: 306
There are usually lots of ways to solve things, but here is one. Just use the variable counting the FOR loop -> SubGraphIndex , and then multiply your line of code with it + 1.
Use SubgraphIndex from this line >> for (int SubgraphIndex = 0
add it to this calc
    CurrentLineValue += Input_LineIncrement.GetFloat();
    CurrentLineValue += Input_LineIncrement.GetFloat() * (SubGraphIndex +1);


Just might work. I did not test it.

JohnR
[2023-07-26 11:24:10]
User688525 - Posts: 259
Hi JohnR,
Thank you for the code.

It appears to be printed incremental levels, however, the levels appear to be off by a few decimal points. I am investigating where I may have a calculation error in the code.

To post a message in this thread, you need to log in with your Sierra Chart account:

Login

Login Page - Create Account