![]() |
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: Nov 2005
Location: , Ontario, Canada
Posts: 400
Thanks: 0
Thanked 0 times in 0 posts
|
Another amibroker-ish question.
AFL has no intra-bar 'memory'. Ie, it recalculates every bar from the begining of the series every tick. This isn't an issue with daily or bar-close indicators, but it sure is an issue in R/T as new intra-bar ticks can move your indicator all over the place How is this handled in NinjaScript. ? For example, ie 1) if x = true then do something 2) x = close> sma(9) Tick1 - x is false the 1st tick into the bar and statement 1 does not branch out. - Statement 2 is executed and sets it to be true. Tick 2 - Will x remain set for the next tick/pass ? |
|
|
|
|
|
#2 |
|
Administrator
Join Date: Mar 2005
Location: Bamberg, Germany
Posts: 9,994
Thanks: 0
Thanked 6 times in 6 posts
|
Hmm not sure I follow. Since NinjaScript basically is C#, the livetime concepts of C# for variables do apply.
a) Any class variable you defined in your strategy (see "Variables" region) is persisted as long as the strategy is running. b) If you define a varoiable within the scope of the OnBarUpdate method then it's not persisted as you processed the current tick and returned from the OnBarUpdate method.
Dierk
NinjaTrader Customer Service |
|
|
|
|
|
#3 | ||
|
Administrator
Join Date: Nov 2004
Location: Denver, CO, USA
Posts: 11,163
Thanks: 6
Thanked 45 times in 32 posts
|
Here are examples to illustrate what Dierk was stating.With example 1, x is preserved from tick to tick. Example 2 likely behaves like AFL where x is not preserved from tick to tick.
Example 1: Quote:
Example 2: Quote:
Ray
NinjaTrader Customer Service |
||
|
|
|
|
|
#4 |
|
Senior Member
Join Date: Nov 2005
Location: , Ontario, Canada
Posts: 400
Thanks: 0
Thanked 0 times in 0 posts
|
Thanks Dierk and Ray!
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|