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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      153 views
      1 like
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      89 views
      1 like
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      133 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      127 views
      1 like
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      107 views
      0 likes
      Last Post CarlTrading  
      Working...
      X