Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Problem with Smoothing a value

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

    Problem with Smoothing a value

    I am trying to take an average of a value I already calculate internally then display as a plot. When I try to create another variable that can capture the average of the plotted variable (so I can plot that too) I always get error code CS1502 (The best overloaded method maatch for 'NinjaTrader.Indicator.EMA(NinjaTrader.Data.IDataS eries, int)' has some invalid arguments, as well as NT1503 error code, 'Argument'1' cannot convert from 'double' to 'NinjaTrade.Data.IDataSeries'.

    Here is the code that gives me the error messages:

    Code:
    					double pressgauge = shrtvr + longvr + diff;	
    				PressGauge.Set(pressgauge);
    					double pressgavg = EMA(pressgauge, smoothprd)[0];
    				PressGauge_Avg.Set(pressgavg);
    It is the second element "pressgavg' which is causing the problem. earlier I created a dataseries for that value so that I could plot it, (which is how I was able to get pressgauge to plot in the first place), but when I try to do it with pressgavg it doesn't work. As I said, the first two lines of the code, work fine and the variable displays as I would expect it to display. I just can't get the smoother version of it to work.

    #2
    NinjaScript is case sensitive, please try this -

    Code:
     
    double pressgavg = EMA(PressGauge, smoothprd)[0];
    PressGauge_Avg.Set(pressgavg);
    Would this compile and plot? The EMA expectes a data series passed in, you passed in your lower case double.

    Comment


      #3
      Fixed it

      Bertrand,
      That worked but because I had predefined a data series with that name but was trying to use the variable in the EMA function.
      Thanks for your help.
      DaveN
      Last edited by daven; 01-07-2010, 11:26 PM. Reason: correct misspelling

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      579 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      334 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
      554 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