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

Problem adding Indicators to Strategies

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

    Problem adding Indicators to Strategies

    In Tips you discuss, setting the panel of an indicator to plot in a strategy:



    You say to do:

    ==================================
    For example:

    To add a volume indicator to your charts you need to add this code snippet into the Initialize() section of your code.
    Code:
    Add(VOL());
    To choose which panel you want your indicator plotted on you can use this code snippet into the Initialize() section:
    Code:
    VOLMA(20).Panel = 2;
    Add(VOLMA(20));
    ====================================

    I did this with this indicator that opperates on the Dataset of another indicator (fisherTransform):

    =============================

    // Transform
    Add(FisherTransform( fisherPeriod));
    // Linear Regression of fisher Transform & put it in the panel above
    LinRegSlopeSFX(FisherTransform(fisherPeriod),!EMA, LinRegPeriod,LINREGR).Panel=2 ;
    Add(LinRegSlopeSFX( FisherTransform(fisherPeriod),!EMA,LinRegPeriod,LI NREGR));

    =====================================

    It gave errors:
    Method must have a return type
    and
    Identifier expected col 23
    and
    Invalid token"" in class struct interface member declaration

    What can I do?

    #2
    looks like I'm getting lots of errors that I didn't have before

    Here is the complete code section: FYI

    protected override void Initialize()
    {
    private const int SLOPE = 1, LINREGR =2, ERROR=3, EXP = true; //exponetial or linear average;
    // SlopeChgPeak(FisherTransform( fisherPeriod),lowEnterHysteresis,highEnterHysteres is).Plots[1].Pen.Color = Color.Orange;
    // HMAnoOverlay(FisherTransform( fisherPeriod),6).Plots[1].Pen.Color = Color.Green;
    // FisherTransform( fisherPeriod).Plots[1]. Pen.Color = Color.Blue;
    // RSquared(FisherTransform( fisherPeriod),4).Plots[2].Pen.Color = Color.Blue;

    // Transform
    Add(FisherTransform( fisherPeriod));
    // Linear Regression of fisher Transform & put it in the panel above
    // LinRegSlopeSFX( FisherTransform(fisherPeriod),!EMA,LinRegPeriod,LI NREGR); // .Panel=2 ; --> error asked support
    //link to support: http://www.ninjatrader.com/support/f...ad.php?t=39457
    Add(LinRegSlopeSFX( FisherTransform(fisherPeriod),!EMA,LinRegPeriod,LI NREGR));
    // Slope of Fisher Transform
    Add(LinRegSlopeSFX( FisherTransform(fisherPeriod),!EMA,LinRegPeriod,SL OPE));
    // R squared of Fisher Transform
    Add(RSquared(FisherTransform( fisherPeriod),rSquaredPeriod));

    CalculateOnBarClose = true;

    //Add(HMAnoOverlay(FisherTransform( fisherPeriod),HMAperiod)); // Add(LinReg(FisherTransform( fisherPeriod),6));
    // Add(SlopeChgPeak(HMAnoOverlay(FisherTransform( fisherPeriod),HMAperiod),lowEnterHysteresis,highEn terHysteresis)); //(FisherTransform( fisherPeriod)

    // Add(LinRegSlopeSFXSFX(HMAnoOverlay(FisherTransform ( fisherPeriod),26),20));

    }

    Comment


      #3
      I had this code before and it compiled ok:

      protected override void Initialize()
      {


      // SlopeChgPeak(FisherTransform( fisherPeriod),lowEnterHysteresis,highEnterHysteres is).Plots[1].Pen.Color = Color.Orange;
      // HMAnoOverlay(FisherTransform( fisherPeriod),6).Plots[1].Pen.Color = Color.Green;
      // FisherTransform( fisherPeriod).Plots[1].Pen.Color = Color.Blue;
      // RSquared(FisherTransform( fisherPeriod),4).Plots[2].Pen.Color = Color.Blue;

      Add(FisherTransform( fisherPeriod));

      Add(SlopeChgPeak(HMAnoOverlay(FisherTransform( fisherPeriod),hMAperiod),enterShortHysteresis,ente rLongHysteresis)); //(FisherTransform( fisherPeriod)
      Add(RSquared(FisherTransform( fisherPeriod),hMAperiod));
      // Add(LinRegSlope(HMAnoOverlay(FisherTransform( fisherPeriod),26),20));
      Add(HMAnoOverlay(FisherTransform( fisherPeriod),hMAperiod)); // Add(LinReg(FisherTransform( fisherPeriod),6));

      CalculateOnBarClose = true;
      }

      Comment


        #4
        Hello,

        Thanks for the forum post.

        What parameters does

        LinRegSlopeSFX

        take? I'm not familiur with this custom indicator.

        If you'd like I can goto File->Utilities->Export NinjaScript and send your strategy to support at ninjatrader dot com and reference this forum post I can look into the correct syntax you should use.

        Let me know if I can be of further assistance.

        Comment


          #5
          for Ref: Here is the code for LinRegSlopeSFX

          FYI it has this at the end:
          " return _indicator.LinRegSlopeSFX(input, exponential, period, returnval);
          }"
          ----------------
          here's the link to LinRegSlopeSFX

          Comment


            #6
            Hello,

            Have you compiled this indicator in NinjaTrader 7 in the past without issue? As it may need new wrappers generated arround it to be used in NinjaTrader 7 since its a NinjaTrader 6.5 exported indicator.

            If so I would still need you to send code in for me to play with it to find where the error is.

            I look forward to assisting you further.

            Comment


              #7
              Yes, the LINREGSLOPESFX() compiled ok.

              It may be a 6.5 version...since in his description on the board, he talks about the LinRegrSlope() from NT as being last delta/interval....but now in version 7...your and his indicator have the exact same readouts.

              Perhaps, I should just use the NT one.

              I would like to know what is involved in conversion from 6.5 to 7 vers NT and What a wrapper is.

              Comment


                #8
                I emailed the code to support.

                both codesets....LinRegrSlope() and my fisher6

                thxs so much

                Comment


                  #9
                  Is there a link to the process of code conversion from 6.5 to 7?

                  Comment


                    #10
                    Hello,

                    I did not recieve your strategy/indicator. Can you please resend make sure it to support at ninjatrader dot com ATTN: Brett reference this forum post.

                    Also, code breaking changes: http://www.ninjatrader.com/support/h...er_11_2010.pdf

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by lorem, 04-25-2024, 09:18 AM
                    20 responses
                    85 views
                    0 likes
                    Last Post lorem
                    by lorem
                     
                    Started by xepher101, 05-10-2024, 12:19 PM
                    4 responses
                    51 views
                    0 likes
                    Last Post xepher101  
                    Started by DawnTreader, 05-08-2024, 05:58 PM
                    22 responses
                    82 views
                    0 likes
                    Last Post DawnTreader  
                    Started by Mathias79, Today, 03:44 PM
                    0 responses
                    17 views
                    0 likes
                    Last Post Mathias79  
                    Started by Austiner87, Today, 03:42 PM
                    0 responses
                    12 views
                    0 likes
                    Last Post Austiner87  
                    Working...
                    X