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

Using LinReg Slope as a discriminator

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

    Using LinReg Slope as a discriminator

    I created a working LinReg MultiPlot indicator which paints the indicator green if it is rising, red if it is falling, and yellow if it is neither. Unfortunately I almost never get any yellow line segment and if I do it only lasts for one bar. I want to make the definition of rising and falling a little wider so if the LinReg line is truly not going up or down very much it would paint yellow. I decided to use slope for the discriminator but the expression for slope (which I think is valid, will not compile. Here's what I have:

    // Plot green if the LinReg is rising
    // If slope > 30 then trend is up, paint LinReg Green
    if (Slope(LinReg(Period), 5, 0) > 30)
    {
    // Connects the rising plot segment with the other plots
    RisingPlot.Set(1, LinReg(Period)[1]);

    // Adds the new rising plot line segment to the line
    RisingPlot.Set(LinReg(Period)[0]);
    }

    The code line in bold doesn't compile and I get the following message (by the way, LinRegMultiplot is the name of the new indicator I am tryng to create.

    No overload for method 'LinReg'MultiPlot' takes '1' arguments.

    I'm stumped, cany anyone help?
    Thanks
    DaveN

    #2
    Hi DaveN, can you post more of the code? Everything you posted looks like it should compile, but without a full sample, I can't say why it doesn't compile.

    If you'd like, you can email the code to support at ninjatrader dot com with Attention: Austin in the subject line.
    AustinNinjaTrader Customer Service

    Comment


      #3
      Hi DaveN, you may have to reinstall your NinjaTrader. Let me consult with a coworker to determine the proper course of action.

      I'm pretty sure I know where the original issue lies in your indicator, but that isn't the problem anymore.
      AustinNinjaTrader Customer Service

      Comment


        #4
        I don't know where I got this but it may be what you're looking for.
        Attached Files

        Comment


          #5
          Mike, thanks for the contribution!
          AustinNinjaTrader Customer Service

          Comment


            #6
            Thanks Mike

            I really appreciate your help. It is working, though the math is a little complicated for me to follow, (I didn't do too well in geometry and radians are apparenly beyond my comprehension).
            Thanks again
            DaveN

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by llanqui, Yesterday, 03:51 PM
            1 response
            16 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by kujista, Yesterday, 12:39 AM
            5 responses
            17 views
            0 likes
            Last Post NinjaTrader_Gaby  
            Started by nleitman, Yesterday, 11:46 AM
            9 responses
            27 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by cmtjoancolmenero, 04-25-2024, 03:58 PM
            18 responses
            105 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by Mindset, Yesterday, 06:19 AM
            2 responses
            15 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X