Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Myalgomate Pivot Point Add new Type #1

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

myalgomate
Copy link
Owner

BY SUBMITTING A PULL REQUEST AND CHANGES TO THIS REPOSITORY YOU ARE ACKNOWLEDGING AND AGREE TO THE TERMS IN BOTH THE DEVELOPER CERTIFICATE OF ORIGIN AND THE APACHE 2.0 LICENSE.

PLEASE REMOVE EXPLANATORY TEXT AND UNNEEDED SECTIONS BEFORE CREATING PULL REQUEST. CREATE A DRAFT PULL REQUEST IF YOU INTEND TO ADD MORE COMMITS. REMOVE DRAFT STATUS AND REQUEST REVIEW FROM DaveSkender WHEN YOU ARE READY TO COMMIT CHANGES.

Description

Please include a summary of the change and which issue is fixed. Please also include relevant motivation, context, and sources of information or recipes.

Fixes #

Checklist

  • My code follows the existing style, code structure, and naming taxonomy
  • I have commented my code, particularly in hard-to-understand areas
  • I have performed a self-review of my own code and included any verifying manual calculations
  • I have added or updated unit tests that prove my fix is effective or that my feature works, and achieves sufficient code coverage. New and existing unit tests pass locally and in the build (below) with my changes
  • My changes generate no new warnings and running code analysis does not produce any issues
  • I have added or run the performance tests that depict optimal execution times
  • I have made corresponding changes to the documentation

@DaveSkender
Copy link

DaveSkender commented Dec 22, 2021

You’ll have to retarget to the DaveSkender repo main branch instead of your own main branch. Just edit above.

@DaveSkender
Copy link

Is this an entirely new type or is it supposed to just add the 3rd and 4th level to the standard type?

@myalgomate
Copy link
Owner Author

Is this an entirely new type or is it supposed to just add the 3rd and 4th level to the standard type?

Both the calculations are different

internal static TPivotPoint GetPivotPointStandard(
decimal high, decimal low, decimal close)
where TPivotPoint : IPivotPoint, new()
{
decimal pp = (high + low + close) / 3;

        return new TPivotPoint
        {
            PP = pp,
            S1 = pp * 2 - high,
            S2 = pp - (high - low),
            R1 = pp * 2 - low,
            R2 = pp + (high - low)
        };
    }

internal static TPivotPoint GetPivotChartIQ(
decimal currentOpen, decimal high, decimal low, decimal close)
where TPivotPoint : IPivotPoint, new()
{
decimal pp = (high + low + close) / 3;

        return new TPivotPoint
        {
            PP = pp,
            R4 = (2 * pp) - high,
            S4 = pp - (high - low),
            S3 = pp - 2 * (high - low),
            R1 = (2 * pp) - low,
            R2 = pp + (high - low),
            R3 = pp + 2 * (high - low),
        };
    }

@myalgomate
Copy link
Owner Author

We can add it to standard itself

@myalgomate
Copy link
Owner Author

Pivot point = (H + L + C) / 3
First support level (S1) = (2 * P) – H
Second support level (S2) = P – (H – L)
Third support level (S3) = P – 2*(H-L)
First resistance level (R1) = (2 * P) – L
Second resistance level (R2) = P + (H – L)
Third resistance level (R3) = P + 2*(H – L)

@DaveSkender
Copy link

Yah, if I’m interpreting right, you only need to add this to the standard type:

S3 = pp - 2 * (high - low),
R3 = pp + 2 * (high - low)

I’ll take a closer look tomorrow.

@DaveSkender
Copy link

DaveSkender commented Dec 22, 2021

Also, you can close/delete this PR and use the other pointing to the base repo one instead. DaveSkender#671

@DaveSkender
Copy link

DaveSkender commented Dec 22, 2021

Also, check your sources, Wikipedia is saying for standard type:

R3 = H + 2×(P − L) = R1 + (HL)
S3 = L − 2×(H − P) = S1 − (HL)

@myalgomate
Copy link
Owner Author

Yah, if I’m interpreting right, you only need to add this to the standard type:

S3 = pp - 2 * (high - low),
R3 = pp + 2 * (high - low)

I’ll take a closer look tomorrow.

Okay Agreed, we can modify the standard itself. Let me know once its done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants