Login Page - Create Account

Support Board


Date/Time: Sat, 27 Apr 2024 23:43:46 +0000



[Programming Help] - "User Entered Pivot Point" for Pivot Points Daily Study

View Count: 493

[2020-02-13 14:12:22]
User996502 - Posts: 28
The PivotPoint-Daily study has 27 different types of formulas and they all seem to calculate Pivot Point based on:

PivotPoint = (PriorHigh + PriorLow + PriorClose) / 3;

    R1 = (PivotPoint * 2) - PriorLow;
    R_5 = (PivotPoint + R1) / 2;
    R2 = PivotPoint + (PriorHigh - PriorLow);
    R1_5 = (R1 + R2) / 2;
    S1 = (2 * PivotPoint) - PriorHigh;
    S_5 = (PivotPoint + S1) / 2;
    S2 = PivotPoint - (PriorHigh - PriorLow);
    S1_5 = (S1 + S2) / 2;
    R3 = 2 * PivotPoint + (PriorHigh - 2*PriorLow);
    R2_5 = (R2 + R3) / 2;
    S3 = 2 * PivotPoint - (2 * PriorHigh - PriorLow);
    S2_5 = (S2 + S3) / 2;
    R4 = 3 * PivotPoint + (PriorHigh - 3 * PriorLow);
    S4 = 3 * PivotPoint - (3 * PriorHigh - PriorLow);
    R3_5 = (R3 + R4) / 2;
    S3_5 = (S3 + S4) / 2;
    R5 = 4 * PivotPoint + (PriorHigh - 4 * PriorLow);
    S5 = 4 * PivotPoint - (4 * PriorHigh - PriorLow);
    R6 = 5 * PivotPoint + (PriorHigh - 5 * PriorLow);
    S6 = 5 * PivotPoint - (5 * PriorHigh - PriorLow);
    R7 = 6 * PivotPoint + (PriorHigh - 6 * PriorLow);
    S7 = 6 * PivotPoint - (6 * PriorHigh - PriorLow);
    R8 = 7 * PivotPoint + (PriorHigh - 7 * PriorLow);
    S8 = 7 * PivotPoint - (7 * PriorHigh - PriorLow);
    R9 = 8 * PivotPoint + (PriorHigh - 8 * PriorLow);
    S9 = 8 * PivotPoint - (8 * PriorHigh - PriorLow);
    R10 = 9 * PivotPoint + (PriorHigh - 9 * PriorLow);
    S10 = 9 * PivotPoint - (9 * PriorHigh - PriorLow);

Is there a way to add option for "User Entered Pivot Point" and use that value for all S/R calculations?

So far I have:

SCInputRef Input_UserPivotPoint = sc.Input[19];

  Input_UserPivotPoint.Name = "Enter Pivot Point Value";
Input_UserPivotPoint.SetFloat(0.0f);

    PivotPoint = GetFloat.UserPivotPoint();
    
    R1 = (PivotPoint * 2) - PriorLow;
    R_5 = (PivotPoint + R1) / 2;
    R2 = PivotPoint + (PriorHigh - PriorLow);
    R1_5 = (R1 + R2) / 2;
    S1 = (2 * PivotPoint) - PriorHigh;
    S_5 = (PivotPoint + S1) / 2;
    S2 = PivotPoint - (PriorHigh - PriorLow);
    S1_5 = (S1 + S2) / 2;
    R3 = 2 * PivotPoint + (PriorHigh - 2*PriorLow);
    R2_5 = (R2 + R3) / 2;
    S3 = 2 * PivotPoint - (2 * PriorHigh - PriorLow);
    S2_5 = (S2 + S3) / 2;
    R4 = 3 * PivotPoint + (PriorHigh - 3 * PriorLow);
    S4 = 3 * PivotPoint - (3 * PriorHigh - PriorLow);
    R3_5 = (R3 + R4) / 2;
    S3_5 = (S3 + S4) / 2;
    R5 = 4 * PivotPoint + (PriorHigh - 4 * PriorLow);
    S5 = 4 * PivotPoint - (4 * PriorHigh - PriorLow);
    R6 = 5 * PivotPoint + (PriorHigh - 5 * PriorLow);
    S6 = 5 * PivotPoint - (5 * PriorHigh - PriorLow);
    R7 = 6 * PivotPoint + (PriorHigh - 6 * PriorLow);
    S7 = 6 * PivotPoint - (6 * PriorHigh - PriorLow);
    R8 = 7 * PivotPoint + (PriorHigh - 7 * PriorLow);
    S8 = 7 * PivotPoint - (7 * PriorHigh - PriorLow);
    R9 = 8 * PivotPoint + (PriorHigh - 8 * PriorLow);
    S9 = 8 * PivotPoint - (8 * PriorHigh - PriorLow);
    R10 = 9 * PivotPoint + (PriorHigh - 9 * PriorLow);
    S10 = 9 * PivotPoint - (9 * PriorHigh - PriorLow);

Error message I am getting is:

PivotPointsCustom.cpp: In function 'int CalculatePivotPoints(float, float, float, float, float, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, int)':
PivotPointsCustom.cpp:463:16: error: 'GetFloat' was not declared in this scope
PivotPoint = GetFloat.UserPivotPoint();

^

attachmentPivotPointsCustom.cpp - Attached On 2020-02-13 14:04:20 UTC - Size: 45.09 KB - 217 views
[2020-02-13 15:35:11]
mkata - Posts: 103
Your assignment was ill named.
Try this:

PivotPoint = Input_UserPivotPoint.GetFloat();
[2020-02-13 15:57:36]
User996502 - Posts: 28
Still getting error:

PivotPointsCustom.cpp: In function 'int CalculatePivotPoints(float, float, float, float, float, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, float&, int)':
PivotPointsCustom.cpp:463:16: error: 'Input_UserPivotPoint' was not declared in this scope
PivotPoint = Input_UserPivotPoint.GetFloat();

[2020-02-13 17:13:33]
mkata - Posts: 103
I only looked at your error and not your code. Quite honestly your code is a mess. It looks like you indiscriminately copy/pasted pivot functions.
I think your problem is going to extend beyond a declaration error. Since pivot points is a complex study and there are already so many available, just use one of those.
Best of luck to you.
[2020-02-13 18:35:29]
User996502 - Posts: 28
I was able to figure this out.

But it would be nice to have the option built in future release.

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

Login

Login Page - Create Account