![]() |
This website will be down for maintenance from Friday May 24th at 6PM MDT until Saturday May 25th at 11AM MDT. We apologize for the inconvenience. If you need assistance during this time, please email sales@ninjatrader.com
|
|||||||
| General Programming General NinjaScript programming questions. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Junior Member
Join Date: Feb 2008
Posts: 16
Thanks: 0
Thanked 0 times in 0 posts
|
Hi,
I am not very good in "C". I have tried to use array but always encounter error. Below is my simple code for experiment: protected override void OnBarUpdate() { if (CurrentBar == 0) Value.Set(0); else { double mean = 0; double trend = 0; double[] w; for (int idx = Math.Min(CurrentBar, k3m - 1); idx >= 0; idx--) w[idx]=idx; What is my problem? ****************** 1) I am not sure whether I have define the array correctly: for example: double[] w; 2) I am also not sure how to place the array command correctly: for (int idx = Math.Min(CurrentBar, k3m - 1); idx >= 0; idx--) w[idx]=idx; Can someone give some advise please? Thanks. Shek |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Unfortunately plain C# coding support is beyond the scope what we can provide.
Hint: Code:
double[] w; Code:
double[] w = new double[yourSize];
Dierk
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Array question... | funk101 | Indicator Development | 14 | 01-21-2009 07:37 AM |
| Array problem | kuroro13 | General Programming | 12 | 05-13-2008 01:33 AM |
| Array Index Errors in Help Guide | KBJ | Suggestions And Feedback | 1 | 12-16-2007 09:12 PM |
| Strategy Array out of Bounds Error or Output CancelAllOrders: BarsInProgress = 0 | Learning1 | Strategy Development | 16 | 09-25-2007 11:02 PM |
| Array manipulation | goldfly | General Programming | 1 | 07-01-2007 03:58 AM |