Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Simple Compiling Error

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

    Simple Compiling Error

    Hey guys,

    I'm a bit new to ninjascript, just can't seem to get past this simple error. I keep getting CS1502 "The best overloaded method match...". I tried removing the index bracket on sdev, I tried using the
    Stat.StdDev function... I'm stumped on this simple issue. Please help.

    barLookBack is an int input set to 300

    protected override void OnBarUpdate()
    {
    double closeOpen = Close[1] - Open[1] ;
    double sdev = StdDev(closeOpen, barLookBack)[0] ;
    Plot0.Set(sdev);
    }
    Last edited by texasnomad; 10-22-2008, 11:14 AM.

    #2
    Hello,


    closeOpen needs to be a DataSeries. To understand how to set up a data series please visit this link:


    StdDev() needs a DataSeries as the first argument. This link has some detail on this:


    When you refer to historical bars understanding this link becomes important:
    DenNinjaTrader Customer Service

    Comment


      #3
      hey tex,

      A quick look. I think closeOpen needs to be a DataSeries. So you would want to do this.

      Define the dataseries in the variables area
      Code:
      private DataSeries sOpenClose;
      Then in the initialize method
      Code:
      sOpenClose = new DataSeries(this);
      Then you can use what you have in this manner.
      Code:
      if(CurrentBar <= barLookBack)
      return;
      
      sOpenClose.Set(Close[1] - Open[1]);
      double sdev = StdDev(sOpenClose, barLookBack)[0];
      Plot0.Set(sdev);
      I'm not sure how Close - Open will react; You may have to play with this.

      hope this helps.
      mrlogik
      NinjaTrader Ecosystem Vendor - Purelogik Trading

      Comment


        #4
        Thanks everyone. At least I was right about it being a newbie error

        Comment


          #5
          Originally posted by NinjaTrader_Ben View Post
          Hello,


          closeOpen needs to be a DataSeries. To understand how to set up a data series please visit this link:


          StdDev() needs a DataSeries as the first argument. This link has some detail on this:


          When you refer to historical bars understanding this link becomes important:
          http://www.ninjatrader-support.com/v...ead.php?t=3170
          Ben,

          This is my new code. I'm still getting "best overloaded match" errors. I declared closeOpen and sdev as DataSeries. Everything compiles fine except for
          "if ( CurrentBar >= barLookBack ) sdev.Set(StdDev(closeOpen, barLookBack)) ;"


          Code:
          [FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]protected [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]override [/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]void[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] OnBarUpdate()[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]{[/FONT][/SIZE]
          [SIZE=2][FONT=Courier New]  closeOpen.Set(Close[[/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]] - Open[[/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]]) ;[/SIZE][/FONT]
          [/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]  if[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] ( CurrentBar >= barLookBack ) sdev.Set(StdDev(closeOpen, barLookBack)) ;[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]  Plot0.Set(sdev[[/FONT][/SIZE][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]]);[/SIZE][/FONT]
          [SIZE=2][FONT=Courier New]}[/FONT][/SIZE]
          [/SIZE][/FONT]

          Comment


            #6
            Hello,


            Did you do the portions of our instructions that needed to be done in the Variables and Initialization sections? You will see examples of it in my post below and mylogik's post below.
            DenNinjaTrader Customer Service

            Comment


              #7
              sdev.Set(StdDev(closeOpen, barLookBack)[0]);
              mrlogik
              NinjaTrader Ecosystem Vendor - Purelogik Trading

              Comment


                #8
                Hello,

                Good catch mrlogik! Thanks.
                DenNinjaTrader Customer Service

                Comment


                  #9
                  That resolved it.. many thanks.

                  I'm very impressed with this forum. The response time is far better than tradestation.

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                  0 responses
                  630 views
                  0 likes
                  Last Post Geovanny Suaza  
                  Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                  0 responses
                  364 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by Mindset, 02-09-2026, 11:44 AM
                  0 responses
                  105 views
                  0 likes
                  Last Post Mindset
                  by Mindset
                   
                  Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                  0 responses
                  566 views
                  1 like
                  Last Post Geovanny Suaza  
                  Started by RFrosty, 01-28-2026, 06:49 PM
                  0 responses
                  568 views
                  1 like
                  Last Post RFrosty
                  by RFrosty
                   
                  Working...
                  X