![]() |
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
|
|||||||
| Indicator Development Support for the development of custom indicators using NinjaScript. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Senior Member
Join Date: Dec 2007
Posts: 365
Thanks: 36
Thanked 28 times in 24 posts
|
Hello,
I"m not at all a "good" coder, but have had some success using dataseries in the past. The script code below doesn't work (doesn't paint anything in pane, just blank). I did some debugging (commenting out things one at a time) and it seems that the problem stems from when the code tries to access myDataSeries[1]. When the code calls for myDataSeries[0], it seems ok. Here is the code: myValue = EMA(Typical,period)[0]; myDataSeries.Set(myValue); myValue1 = 2*(myDataSeries[0]-myDataSeries[1])/(myDataSeries[0]+myDataSeries[1]); myDataSeries2.Set(myValue1); Plot0.Set(100*EMA(myDataSeries2,3)[0]); And yes, I have the proper variables declared and the dataseries initialized in the proper place. Any ideas? I'm hoping I've done something really stupid ![]() Thanks much for any help! |
|
|
|
|
|
#2 |
|
Certified NinjaScript Consultant
|
Isn't this what you want as the last statement
Value.Set(100*EMA(myDataSeries2,3)[0]); |
|
|
|
|
|
#3 |
|
Senior Member
Join Date: Dec 2007
Posts: 365
Thanks: 36
Thanked 28 times in 24 posts
|
Hello and thanks for your help.
I don't think that's what I want, but I can tell you during debugging, I just commented out my last line (with the Plot0) in it and instead just had Plot0.Set(High[0]). Even that didn't work. If I remove all reference to myDataSeries[1] and replace it with something trivial, then the indicator will plot. |
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Mar 2008
Posts: 142
Thanks: 0
Thanked 0 times in 0 posts
|
Do you have on top of BarUpdate() something like:
if (CurrentBar < Period) return; ? |
|
|
|
|
|
#5 |
|
Senior Member
Join Date: Dec 2007
Posts: 365
Thanks: 36
Thanked 28 times in 24 posts
|
no I do not, I'll give that a try, thanks.
|
|
|
|
|
|
#6 |
|
Senior Member
Join Date: Dec 2007
Posts: 365
Thanks: 36
Thanked 28 times in 24 posts
|
S W E E T!!!
Thank you both for your help. Testing for enough bars present seems to have done the trick. |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Plotting DataSeries | gg80108 | Charting | 4 | 11-22-2009 03:01 PM |
| DataSeries Object Help | zenith1107 | General Programming | 1 | 05-21-2009 07:43 AM |
| DataSeries converting | gg80108 | General Programming | 3 | 04-24-2009 02:58 PM |
| How to copy DataSeries to another DataSeries | xewoox | General Programming | 8 | 12-02-2008 07:53 AM |
| Indicator on a DataSeries | jriverac | Strategy Development | 17 | 06-09-2008 11:42 AM |