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 zstheorist, Today, 07:52 PM
        0 responses
        7 views
        0 likes
        Last Post zstheorist  
        Started by pmachiraju, 11-01-2023, 04:46 AM
        8 responses
        150 views
        0 likes
        Last Post rehmans
        by rehmans
         
        Started by mattbsea, Today, 05:44 PM
        0 responses
        6 views
        0 likes
        Last Post mattbsea  
        Started by RideMe, 04-07-2024, 04:54 PM
        6 responses
        33 views
        0 likes
        Last Post RideMe
        by RideMe
         
        Started by tkaboris, Today, 05:13 PM
        0 responses
        6 views
        0 likes
        Last Post tkaboris  
        Working...
        X