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

Any reason why LinRegSlope won't work with CurrentBar?

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

    Any reason why LinRegSlope won't work with CurrentBar?

    Relevant code below. It works when I replace CurrentBar with a static value.. but what I'm really trying to do is calculate the LinRegSlope from the first bar to the latest bar.. in other words..

    Bar0 -> Bar 1
    Bar0 -> Bar 2
    Bar0 -> Bar 3

    I thought by setting the period of the LinRegSlope to the number of the CurrenBar, I'd get this behavior..

    Code:
    		protected override void OnBarUpdate()
    		{
    			if (CurrentBar < 3)
    				return;
    			//Add your custom indicator logic here.
    			double value = LinRegSlope(CurrentBar)[0];
    			Slope[0] = value;
    			Print("The current slope value is " + value.ToString());
                            // this just prints 0
    		}

    #2
    Hello amedhussaini,

    Thank you for your inquiry.

    I am unable to reproduce this on my end.

    Can you please provide an example script that duplicates this behavior so I may test on my end?
    Zachary G.NinjaTrader Customer Service

    Comment


      #3
      I'm using NT8, if that helps. I'm attaching the exported NinjaScript here..



      Thanks,
      Amed
      Attached Files

      Comment


        #4
        Hello amedhussaini,


        What happens when you try and load your script from your end?


        We were not successful in testing the code you provided. During our tests it tries to process too much data, and results in crashing the platform.
        Shawn B.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by f.saeidi, Today, 08:01 PM
        0 responses
        2 views
        0 likes
        Last Post f.saeidi  
        Started by Rapine Heihei, Today, 07:51 PM
        0 responses
        3 views
        0 likes
        Last Post Rapine Heihei  
        Started by frslvr, 04-11-2024, 07:26 AM
        5 responses
        96 views
        1 like
        Last Post caryc123  
        Started by algospoke, 04-17-2024, 06:40 PM
        6 responses
        49 views
        0 likes
        Last Post algospoke  
        Started by arvidvanstaey, Today, 02:19 PM
        4 responses
        11 views
        0 likes
        Last Post arvidvanstaey  
        Working...
        X