![]() |
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: Aug 2008
Posts: 13
Thanks: 0
Thanked 0 times in 0 posts
|
Hi im looking for help from ppl who have experience in easy language.
ive got the following code im attempting to convert to ninjascript: Value1 = 2 * WAverage(price, halvedLength); Value2 = WAverage(price, length); Value3 = WAverage((Value1 - Value2), sqrRootLength); The variable price is a NumericSeries. Value1 and Value2 are double. What i dont get is that you can do a WAverage from Value1-Value2? Im underthe impression that weighted averages take a defined period of a certain price type. Wha does taking a weighted average of Value1-Value2 mean? Having problems understanding this, would appreciate any help thanks ian |
|
|
|
|
|
#2 | |
|
NinjaTrader Customer Service
Join Date: Sep 2008
Location: Germany
Posts: 22,411
Thanks: 252
Thanked 976 times in 959 posts
|
Quote:
Thanks for your post. This just means it smoothes the difference (momentum) of Value1 - Value2 of the specified period input, in this case 'sqrRootLength'. The 'Input' does not have to be a Price type one (OHLC), but any type of a series of values, like other indicators for example, or volume.
Bertrand
NinjaTrader Customer Service
Last edited by NinjaTrader_Bertrand; 11-08-2008 at 08:59 AM.
|
|
|
|
|
|
|
#3 |
|
Junior Member
Join Date: Aug 2008
Posts: 13
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks Bertrand for your reply
Yup youve confirmed my understanding of averages. (ie. require a set of numbers over a certain period) But if the input requires a series of values, how does (Value1 - Value2) fit in there? since (Value1 - Value2) returns a single, double value. |
|
|
|
|
|
#4 |
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
You have to store Value1 - Value2 calculation for each bar in a DataSeries and then take the average of the DataSeries.
More information - http://www.ninjatrader-support.com/H...iesObject.html
Ray
NinjaTrader Customer Service |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Converting easy language | chartlearner | General Programming | 11 | 09-23-2008 11:39 AM |
| Converting to Market Orders | PHOLAN | Automated Trading | 12 | 06-01-2008 03:12 PM |
| Converting Int to Double | BenHeaton | General Programming | 2 | 03-01-2008 05:19 AM |
| TS8 eld file missing in latest v6.5 beta | jtrade | Connecting | 2 | 01-14-2008 10:53 AM |
| Converting TS strategy signals to NT | Elfsareus | Automated Trading | 7 | 02-15-2006 02:32 PM |