Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Help with Can't convert Double to Data Series

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

    Help with Can't convert Double to Data Series

    I'm working with the indicator "TriggerLines".

    I'm trying to develop a Trigger Strength and a Trigger Strength Average plot.
    The Trigger Strength plot works.

    But on line 65, when I try to calculate the TrgStrengthAvg using an EMA, I get an error.

    "Argument'1': cannot convert from 'double' to Ninja Trader.Data.IDataSeries"

    I do not understand what this error is telling me.

    Can someone help?

    Thanks,
    taddypole...
    Attached Files

    #2
    Hello,

    Thank you for your note.

    EMA() can only take a DataSeries as an input, you cannot input a double variable here. A DataSeries object is any Close[0], Open[0], Low[0], High[0], Volume[0], or a custom one you would create. To create a custom one to use in a EMA please see the information below:



    Let me know if I can be of further assistance.
    BrettNinjaTrader Product Management

    Comment


      #3
      Thank you Brett,

      On line 68, i change the TrgStrengthAvg to an IDataseries but then it told me that TrigerStrength needed to be a IDataseries also. So I changed TrigerStrength on line 67 to a IDataSeries as well but now get an error message...

      "Cannot implicitly convert type 'double' to NinjaTrader.Data.DataSeries."

      Intellisense tells me that all the variables in line 67 are data series. why does it tell me that i'm trying to convert a type double?


      Thank you...
      Attached Files

      Comment


        #4
        Hello,

        I still see the same error in the file.

        TrigerStrength=(LinRegCurve[0]-LinRegCurveAvg[0]) * 10000;
        TrgStrengthAvg=EMA(TrigerStrength,TSPeriod);


        Issue is here: EMA(TrigerStrength - TrigerStrength needs to be a data series however it is currently a double variable. DataSeries must always be set, meaning the line above it would need to read TrigerStrength.Set(); You do not use = signs to set DataSeries objects.

        Also, you need to add a [0] at the end of the EMA() function.

        Let me know if I can be of further assistance.
        BrettNinjaTrader Product Management

        Comment


          #5
          Brett,

          I followed your advice and used the "Set" on both TrigerStrength and TrgStrengthAvg as they are both DataSeries objects.

          And Intellisense seems to indicate they are both dataseries objects. But i continue to get an error that it cannot convert EMA to double.
          Attached Files

          Comment


            #6
            Hello,

            You wernt quite consitant with all the data series.

            I made the last few changes you were missing to compile here are the changed lines: Had to add [0]'s as they are now data series objects and had to move the [0] on your TrgStrengthAvg.Set in one parenthesis.

            TrgStrengthAvg.Set(EMA(TrigerStrength,TSPeriod)[0]);

            TrgStrength.Set(TrigerStrength[
            0]);
            TrgStrAvgPlot.Set(TrgStrengthAvg[
            0]);

            Let me know if I can be of further assistance.

            BrettNinjaTrader Product Management

            Comment


              #7
              Thank you very much Brett...

              You have been very helpful..!!

              Comment


                #8
                Hello,

                No problem have a great rest of the day and happy trading.
                BrettNinjaTrader Product Management

                Comment


                  #9
                  Sorry Brett,

                  Had one other question about this code.

                  After modifying this code, i now have a bunch of extra/erroneous Plots in the properties window of that indicator.

                  As i modified code these never updated and reflect the old code i started with.
                  How do i update or refresh those so they reflect my current plots?

                  Thanks,
                  taddypole...
                  Attached Files

                  Comment


                    #10
                    Hello,

                    The plots that show up here are ones that are added in Initilize() with the Add call. Remove these if you no longer want them added.

                    Also expand the parameters section and remove them from there as well.

                    Let me know if I can be of further assistance.
                    BrettNinjaTrader Product Management

                    Comment


                      #11
                      That's what's puzzling.

                      In the initialize() i only have the following:

                      Add(new Plot(Color.Cyan, "TrgStrength"));
                      Add(new Plot(Color.Magenta, "TrgStrAvgPlot"));
                      Add(new Line(Color.Black, 0, "Zero line"));

                      and if i look in the "Catagory "Pararameters"" section... i don't see anything relative to those plots?

                      Comment


                        #12
                        Hello,

                        Have you tried removing it and the adding it? As this is the only time the plots are loaded.

                        I look forward to assisting you further.
                        BrettNinjaTrader Product Management

                        Comment


                          #13
                          Thanks Brett,

                          I tried removing and adding the indicator... and that didn't work.
                          I then shut down Ninja Trader and reloaded... that didn't work.

                          I then renamed the indicator and that worked.

                          ???

                          Not sure what that all means.. but i'm good now.

                          Thanks for all your help...

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                          0 responses
                          574 views
                          0 likes
                          Last Post Geovanny Suaza  
                          Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                          0 responses
                          333 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by Mindset, 02-09-2026, 11:44 AM
                          0 responses
                          101 views
                          0 likes
                          Last Post Mindset
                          by Mindset
                           
                          Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                          0 responses
                          553 views
                          1 like
                          Last Post Geovanny Suaza  
                          Started by RFrosty, 01-28-2026, 06:49 PM
                          0 responses
                          551 views
                          1 like
                          Last Post RFrosty
                          by RFrosty
                           
                          Working...
                          X