![]() |
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Dec 2009
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
|
Hi ,
I am trying to use EMA function to enter values in an array in the following way for (i=-24 ;i==0;i++) { EMA_val[i]=EMA(480)[i]; EMA_sum[1]+=EMA_val[i]; } getting an error saying that I am trying to use a field like a mathod , I looked in documantion and I am using the script as I should. Can someone explain what I am doing worng. Thanks |
|
|
|
|
|
#2 |
|
NinjaTrader Customer Service
Join Date: May 2008
Location: Denver, CO
Posts: 3,157
Thanks: 0
Thanked 3 times in 3 posts
|
Hello,
Since you are using [indx], I assume you are trying to enter values that you can then access later via bar references. Here is a better way to do it: http://www.ninjatrader-support.com/H...iesObject.html
Ben
NinjaTrader Customer Service |
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Dec 2009
Posts: 10
Thanks: 0
Thanked 0 times in 0 posts
|
Hi Ben,
I tried to do what you instructed but , I am stil l getting the same error when compiling. I attached a screen shot of what I see. Thanks. |
|
|
|
|
|
#4 |
|
NinjaTrader Customer Service
Join Date: Sep 2009
Location: Denver, CO
Posts: 8,117
Thanks: 249
Thanked 418 times in 415 posts
|
Hello Sharkie,
Ben's suggestion was to create a DataSeries object. This tutorial may help illustrate this concept. Create a data series and you could then run sum method against the data series you created. http://www.ninjatrader-support.com/HelpGuideV6/SUM.html Using arrays is outside of NinjaScript support. I did notice you're trying to access negative index values. If you pursue this array approach, this is one thing to change. Current bar is accessed with index [0]. The bar prior to this (on the left) is accessed with [1] Close[0] Close[1]
Ryan M
NinjaTrader Customer Service |
|
|
|
![]() |
| Tags |
| array, ema, error |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Iorder array | binwang2 | General Programming | 1 | 10-27-2009 12:52 PM |
| Double EMA needs a price option (OHLC)for each EMA | simpletrades | Indicator Development | 9 | 08-31-2009 07:20 AM |
| Dispose of array | irurn | General Programming | 2 | 01-27-2009 06:01 AM |
| Array | pipsheker | General Programming | 1 | 05-24-2008 03:45 AM |
| Using the Strategizer how do I write the entry EMA & exit using another EMA | gygraham | Strategy Development | 1 | 02-05-2008 01:48 PM |