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!
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
NinjaTrader
dataSeries pointer or mirror
Collapse
X
-
dataSeries pointer or mirror
EMA(), Falling(), Rising(), and many other useful functions require a DataSeries as argument. My indicator allows the user to select open, high, low, or close to use in all price calcs. I would like to be able to use a pointer to hold the current selection and just use the pointer everywhere the price is needed. Is something like this possible? Currently I use switch case statements everywhere I need to pass the price DataSeries as argument.Tags: None
-
I wasn't very clear. Up until now all my calculations have been on Close.
Code:for( i=0; i < kGups_total; i++) { Values[i].Set( EMA( Close, gup_periods[i] )[0] ); }
Code:[Description("")] [GridCategory("Parameters -- General")] [Gui.Design.DisplayName ("100 - Price based on:")] public eCalc_type2 Calc_enum { get { return calc_enum; } set { calc_enum = value; } } public enum eCalc_type2 { Open, Close, High, Low, }
Code:for( i=0; i < kGups_total; i++) { switch( calc_enum ) { case eCalc_type2.Open: Values[i].Set( EMA( Open, gup_periods[i] )[0] ); break; case eCalc_type2.Close: Values[i].Set( EMA( Close, gup_periods[i] )[0] ); break; case eCalc_type2.High: Values[i].Set( EMA( High, gup_periods[i] )[0] ); break; case eCalc_type2.Low: Values[i].Set( EMA( Low, gup_periods[i] )[0] ); break; } }
Comment
-
Hello bernie_c,
Thank you for your response.
My mistake as we cannot set the DataSeries values in Initialize(). You would need to instead check the case and switch in the OnBarUpdate() and place the full code for each choose in each switch much like the SampleUniversalMovingAverage example: http://www.ninjatrader.com/support/f...ead.php?t=3420
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by suroot, 04-10-2017, 02:18 AM
|
4 responses
3,021 views
0 likes
|
Last Post
by truepenny
Today, 08:01 AM
|
||
Started by Stanfillirenfro, Today, 07:23 AM
|
1 response
6 views
0 likes
|
Last Post Today, 07:37 AM | ||
Started by cmtjoancolmenero, Yesterday, 03:58 PM
|
2 responses
22 views
0 likes
|
Last Post Today, 07:24 AM | ||
Started by olisav57, Yesterday, 07:39 PM
|
1 response
9 views
0 likes
|
Last Post Today, 07:23 AM | ||
Started by cocoescala, 10-12-2018, 11:02 PM
|
7 responses
944 views
0 likes
|
Last Post
by Jquiroz1975
Today, 07:21 AM
|
Comment