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

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.
    BertrandNinjaTrader Customer Service

    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 SnailHorn, Today, 10:49 PM
      0 responses
      4 views
      0 likes
      Last Post SnailHorn  
      Started by naanku, Today, 07:25 PM
      0 responses
      8 views
      0 likes
      Last Post naanku
      by naanku
       
      Started by milfocs, Today, 07:23 PM
      0 responses
      6 views
      0 likes
      Last Post milfocs
      by milfocs
       
      Started by PaulMohn, Today, 06:59 PM
      0 responses
      8 views
      0 likes
      Last Post PaulMohn  
      Started by bortz, 11-06-2023, 08:04 AM
      48 responses
      1,756 views
      0 likes
      Last Post carnitron  
      Working...
      X