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 Hwop38, 05-04-2026, 07:02 PM
      0 responses
      173 views
      0 likes
      Last Post Hwop38
      by Hwop38
       
      Started by CaptainJack, 04-24-2026, 11:07 PM
      0 responses
      328 views
      0 likes
      Last Post CaptainJack  
      Started by Mindset, 04-21-2026, 06:46 AM
      0 responses
      252 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by M4ndoo, 04-20-2026, 05:21 PM
      0 responses
      355 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Started by M4ndoo, 04-19-2026, 05:54 PM
      0 responses
      181 views
      0 likes
      Last Post M4ndoo
      by M4ndoo
       
      Working...
      X