Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

parabolic sar

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

    parabolic sar

    how can i determine candle[0] is below or above parabolic sar?
    for up trend i use :
    double value=ParabolicSAR(0.02,0.2,0.02)[0];​
    if ( candle[0] > value)

    for down trend i use:
    if ( candle[0] < value)

    but its not work correctly.
    how can i fix this?

    #2
    Hello f.saeidi,

    If you want the Close price of the bar use Close[0].

    If you want the Low price of the bar use Low[0].

    Code:
    Print(string.Format("{0} | Low[0]: {1} > ParabolicSAR(0.02,0.2,0.02)[0]: {2}", Time[0], Low[0], ParabolicSAR(0.02,0.2,0.02)[0]));
    
    if (Low[0] > ParabolicSAR(0.02,0.2,0.02)[0])
    {
    Print(Time[0] + " | the Low of the bar is greater than the ParabolicSAR");
    }
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      Thnx for notes.
      I don't need create parabolic for candle0 and candle 1?
      For example
      If (sar candle 0 > sar candle 1) trend is up
      If (sar candle 0 <sar candle 1) trend is down.
      Can I use above method?

      Comment


        #4
        Hello f.saeidi,

        I'm not quite sure what you are asking.

        Are you asking if you can compare the Low of the current bar with the ParabolicSAR() value from the previous bar (1 bar ago)?

        if (CurrentBar > 1 && Low[0] > ParabolicSAR(0.02,0.2,0.02)[1])
        Chelsea B.NinjaTrader Customer Service

        Comment


          #5
          I guess ur mention script don't work well.
          I just want when parabolic sar in above candle tell me down trend and when parabolic sar is below candle tell me up trend.
          I understand we must compare candle 0 and candle 1 parabolic sar condition to determine what is the trend.

          Comment


            #6
            Hello f.saeidi,

            I've tested this and I am seeing this is working as expected.

            Below is a link to a video.



            "I just want when parabolic sar in above candle tell me down trend and when parabolic sar is below candle tell me up trend."

            I'm not clear on what this means. Can you specific on what values you want compared and how you want them compared?

            "when parabolic sar in above candle"

            Do you mean the Low[0] of the current bar is greater than the value returned from the ParabolicSAR indicator?

            "candle tell me down trend"

            Do you mean the Close[0] of the current bar is greater than the Close[1] of the previous bar?



            Chelsea B.NinjaTrader Customer Service

            Comment


              #7
              Thnx for notes.
              You use low and high for parabolic sar.
              I use current bid value and I will try your method.
              Best regard

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by Marklhc1988, 04-19-2023, 11:11 AM
              12 responses
              569 views
              1 like
              Last Post victor68133  
              Started by nicthe, Yesterday, 02:58 PM
              1 response
              9 views
              0 likes
              Last Post nicthe
              by nicthe
               
              Started by percy3687, 05-17-2024, 12:28 AM
              3 responses
              30 views
              0 likes
              Last Post percy3687  
              Started by SilverSurfer1, Yesterday, 01:33 PM
              0 responses
              12 views
              0 likes
              Last Post SilverSurfer1  
              Started by ETFVoyageur, Yesterday, 10:27 AM
              2 responses
              19 views
              0 likes
              Last Post ETFVoyageur  
              Working...
              X