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

New and Fun error code

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

    New and Fun error code

    // plot below by replacing 'Close[0]' with your own formula.
    myDataSeries.Set(((High[0] - Low[0])/2) + Low[0]);
    myDataSeries1.Set((High[
    0] - Low[0]) + High[0]);
    myDataSeries2.Set(Low[
    0] - (High[0] - Low[0]));
    Plot0.Set(SMA(myDataSeries[
    0], myInput0));
    Plot1.Set(Close[
    0]);
    Plot2.Set(Close[
    0]);

    What is the problem with this? This is the error code I'm getting.
    The best overloaded method match for 'NinjaTrader.Indicator.SMA(NinjaTrader.Data.IDataS eries, Int) has some invalid arguments, specifically Argument 1 cannot covert form Double to IDataseries. What is double? What does that mean? How is it used? The online manual is, at best, vague.

    #2
    Hi bobby1001,

    This line
    Code:
    [FONT=Courier New][SIZE=2]Plot0.Set(SMA(myDataSeries[[/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#800080]0[/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2]], myInput0));[/SIZE][/FONT]
    should be
    Code:
    [FONT=Courier New][SIZE=2]Plot0.Set(SMA(myDataSeries[/SIZE][/FONT][FONT=Courier New][SIZE=2], myInput0)[COLOR=SeaGreen][0][/COLOR]);[/SIZE][/FONT]
    A double is basically a number with decimal points. The first parameter when you call SMA() is suppose to be a DataSeries object not a double object. To get the DataSeries object you can remove the [0] indexing. In this case, you will also need to add an index reference at the end of SMA(). Make sure myInput0 is an int and it should compile after that.
    Last edited by NinjaTrader_JoshP; 10-02-2007, 09:04 PM.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Thank you

      It worked fine. I think I understand why, but wanted to check to make sure. The [0] we added refers to the SMA for the plot, correct?

      Thanks again.

      Comment


        #4
        Correct. It refers the latest SMA() value to the plot.
        Josh P.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by jxs_xrj, 01-12-2020, 09:49 AM
        6 responses
        3,290 views
        1 like
        Last Post jgualdronc  
        Started by Touch-Ups, Today, 10:36 AM
        0 responses
        9 views
        0 likes
        Last Post Touch-Ups  
        Started by geddyisodin, 04-25-2024, 05:20 AM
        11 responses
        62 views
        0 likes
        Last Post halgo_boulder  
        Started by Option Whisperer, Today, 09:55 AM
        0 responses
        8 views
        0 likes
        Last Post Option Whisperer  
        Started by halgo_boulder, 04-20-2024, 08:44 AM
        2 responses
        25 views
        0 likes
        Last Post halgo_boulder  
        Working...
        X