-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Feature : Implements Parabolic SAR Extended (SAREXT) #8818
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! It's looking good. Leaving a few minor comments
if (_sarInit != 0) | ||
return Math.Abs(_sarInit); // Force SAR to be non-negative to maintain compatibility with SAR logic assumptions |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See this comment about using Abs
here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The extended version can return negative values to indicate the short positioning, but the -ve
values are handled in HandleLongPosition
and HandleShortPosition
. so removing this, thanks.
if (Samples == 2) | ||
{ | ||
Init(input); | ||
_previousBar = input; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See this comment about _previousBar
. Should it be returning here right away? Or just not set the previous bar at this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if _previousBar
is not set before calling HandleLongPosition or HandleShortPosition , the tests break because those methods rely on _previousBar
being initialized.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand, but _previousBar
is set when the first sample comes in. The issue is that on sample 2, HandleLongPosition
and HandleShortPosition
will use input
both as previous and current input, does that make sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jhonabreul On the second sample, using input
as both the current and previous bar is intentional, it's part of the warm-up
phase where trend direction and initial values are set (i.e., indicator initialization). Real SAR calculations begin from sample 3 (Samples >= 3)
, where _previousBar
and input
truly differ. The indicator is marked IsReady
only after two samples.
Description
Implements Parabolic SAR Extended (SAREXT) IndicatorRelated Issue
#6987 Reference PR - #7528How Has This Been Tested?
Comparison against talib generated data for SAREXT - spy_sarext.csv
Types of changes
Checklist:
bug-<issue#>-<description>
orfeature-<issue#>-<description>