Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Parabolic SAR inconsistency in Strategy

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Parabolic SAR inconsistency in Strategy

    I started seeing some inconsistent numbers while implementing a strategy using Parabolic SAR. I have reduced it to the following recreatable problem on my end:
    In OnBarUpdate() I have the following 2 statements:
    Print("1. PSar for last bar is : " + ParabolicSAR(psarAcc,psarMaxStep,psarStep)[1].ToString());
    Print("2. PSar for last bar is : " + ParabolicSAR(.02,.2,.02)[1].ToString());
    In the variables section:
    private double psarAcc = 0.02; // Default setting for PsarAcc
    private double psarMaxStep = 0.2; // Default setting for PsarMaxStep
    private double psarStep = 0.02; // Default setting for PsarStep

    So the same variables being passed. And yet, here is a sample output:
    1. PSar for last bar is : 396.7
    2. PSar for last bar is : 395.308
    1. PSar for last bar is : 396.9
    2. PSar for last bar is : 395.48152
    1. PSar for last bar is : 396.9
    2. PSar for last bar is : 395.7549984

    And by the way, the chart display with the Parabolic SAR indicator with same parameters has no correlation to any of the numbers above.

    Why 3 separate results for each instance ?

    #2
    Hi nybangali, please check if your called ParabolicSAR indicator uses a CalculateOnBarClose reference in the Initialize(). If yes delete it and check the results again. Thanks!

    Comment


      #3
      nybangali,

      Please see if this fix addresses your issues. Thank you.

      Edit: A more up-to-date version has been uploaded. Please redownload.
      Attached Files
      Josh P.NinjaTrader Customer Service

      Comment


        #4
        Hi,

        I also have an "inconsistency" problem with ParabolicSAR.

        I'm telling the strategy to exit any Long position if the ParabolicSAR jumps from below the bars to above the bars, and to exit any Short position vice versa. However, it won't do it (in backtesting).

        Here's the code:
        Code:
        if ((High[0] == maxHigh 
        				|| 
        				(
        				ParabolicSAR(para,paraMid,para)[1] < Close[1] 
        				&& ParabolicSAR(para,paraMid,para)[0] > Close[0]
        				)
        				)
        				&& Position.MarketPosition == MarketPosition.Long
        				)
        			{
        				ExitLong();				
        			}
        (maxHigh is the last 8 bars' high).

        Any ideas, anyone?

        Greetz
        noincomenojobnoassets

        Comment


          #5
          noincomenojobnoassets,

          You should not be working off of ParabolicSAR(). Please use the "fix" version.
          Josh P.NinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by argusthome, 03-08-2026, 10:06 AM
          0 responses
          68 views
          0 likes
          Last Post argusthome  
          Started by NabilKhattabi, 03-06-2026, 11:18 AM
          0 responses
          41 views
          0 likes
          Last Post NabilKhattabi  
          Started by Deep42, 03-06-2026, 12:28 AM
          0 responses
          24 views
          0 likes
          Last Post Deep42
          by Deep42
           
          Started by TheRealMorford, 03-05-2026, 06:15 PM
          0 responses
          27 views
          0 likes
          Last Post TheRealMorford  
          Started by Mindset, 02-28-2026, 06:16 AM
          0 responses
          54 views
          0 likes
          Last Post Mindset
          by Mindset
           
          Working...
          X