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

Adding Indicator to Strategy

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

    Adding Indicator to Strategy

    I am attempting to add the ParabolicSAR to my strategy.
    I am able to Add() the indicator and have it plot to my chart. The problem is that I have been unable to find a way to change the plot attributes for the indicator. I would like to change the color and name associated with it.

    Below is the Code that I am using.
    protectedoverridevoid Initialize()
    {
    ParabolicSAR(0.02, 0.2, 0.02).Plots[0].Name = "ParSAR";
    ParabolicSAR(0.02, 0.2, 0.02).Plots[0].Pen.Color = Color.Blue;
    Add(ParabolicSAR(0.02, 0.2, 0.02));
    CalculateOnBarClose = true;
    }

    protectedoverridevoid OnBarUpdate()
    {
    // Working Code
    }

    publicoverridestring ToString()
    {
    return" ";
    }

    Any assistance would be greatly appreciated.
    Thanks.
    Larry.

    #2
    Larry, which NinjaTrader version are you running? You can check under Help > About - I tested your code with the fixed Parabolic version and it does work as expected -

    Code:
     
    protected override void Initialize()
    {
    ParabolicSARFixed(0.02, 0.2, 0.02).Plots[0].Pen.Color = Color.Blue;
    Add(ParabolicSARFixed(0.02, 0.2, 0.02));
    CalculateOnBarClose = true;
    }
    BertrandNinjaTrader Customer Service

    Comment


      #3
      .NET Version: 2.0.50727.3082

      Ninja Trader Version: 6.5.1000.11

      ===========

      Perhaps my setups for the chart and strategy are not set properly.

      Thanks.
      Larry

      Comment


        #4
        Larry, these are the correct versions -did you gave my posted snippet a try?
        BertrandNinjaTrader Customer Service

        Comment


          #5
          My version of NinjaTrader does not recognize "ParabolicSARFixed()"

          Interestingly ... The price Marker paints the correct color the value plots do not.

          - Larry

          Comment


            #6
            Larry,

            Please disregard the "fixed" part and use the regular ParabolicSAR(). The price markers should show the same value as the plot on the last bar.
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Hi Josh,

              Yes the ParSAR is correctly plotting the values.
              I was attempting to change the attributes of the plot .. i.e. the color, the name that displays on the chart - such that I could display different names for the different setups in different colors.

              I can get the price marker to the new color of Blue ... The parSAR dots are still the deualt Orange. I wanted to be able to identify my plots from the default indicator color.

              Comment


                #8
                Larry,

                Will look into it.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Larry,

                  Could be a bug. Thank you for reporting. In the meantime, you can bring up the indicators dialogue and then close it to get it to show up as blue.
                  Josh P.NinjaTrader Customer Service

                  Comment


                    #10
                    Yes - that is a work around. Bringing the indicator window active and applying to the chart will change the color to that of my Strategy.

                    Thanks for your help. Looking forward to the upcomming fix.

                    Comment


                      #11
                      Thanks for reporting this one in Larry, it should be fixed in NinjaTrader 7
                      BertrandNinjaTrader Customer Service

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Salahinho99, 05-05-2024, 04:13 AM
                      7 responses
                      55 views
                      0 likes
                      Last Post Salahinho99  
                      Started by knighty6508, 05-10-2024, 01:20 AM
                      4 responses
                      26 views
                      0 likes
                      Last Post knighty6508  
                      Started by OllieFeraher, 05-09-2024, 11:14 AM
                      6 responses
                      19 views
                      0 likes
                      Last Post OllieFeraher  
                      Started by PaulMohn, 05-02-2024, 06:59 PM
                      2 responses
                      44 views
                      0 likes
                      Last Post PaulMohn  
                      Started by ETFVoyageur, Today, 02:10 AM
                      0 responses
                      19 views
                      0 likes
                      Last Post ETFVoyageur  
                      Working...
                      X