NexusFi: Find Your Edge


Home Menu

 





NT7 - Chart Indicators loading randomly


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one vantojo with 9 posts (1 thanks)
    2. looks_two choke35 with 3 posts (0 thanks)
    3. looks_3 ratfink with 2 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 2,971 views
    2. thumb_up 1 thanks given
    3. group 2 followers
    1. forum 14 posts
    2. attach_file 0 attachments




 
Search this Thread

NT7 - Chart Indicators loading randomly

  #1 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

for NT7:

I have several chart indicators that add buttons and other controls to the chart ToolStrip.

The problem is that sometimes Ninja loads the indicators in an order that is different than the Indicator list where I attach the indicators to the chart.

This causes a problem because then my toolstrip controls are in a different order than I expect, which is a distraction.

If I reload the indicators (F5) the toolstrip controls are usually placed in the correct order.

Any ideas on how to fix this? I asked NinjaTrader forum some time ago and they didn't have an answer....just " that is the way it works"....no control over the order a chart loads the indicators.

Any ideas guys?

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Looking for an MQL4 MetaTrader programmer/coder
The Elite Circle
NexusFi Journal Challenge - May 2024
Feedback and Announcements
ZombieSqueeze
Platforms and Indicators
Request for MACD with option to use different MAs for fa …
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
62 thanks
NexusFi site changelog and issues/problem reporting
46 thanks
Battlestations: Show us your trading desks!
34 thanks
GFIs1 1 DAX trade per day journal
31 thanks
What percentage per day is possible? [Poll]
22 thanks

  #3 (permalink)
 choke35 
Germany
 
Experience: Intermediate
Platform: Other
Trading: ES, YM, 6E
Posts: 2,668 since Feb 2013
Thanks Given: 5,101
Thanks Received: 6,558


The phenomenon that you describe regularly results from
a) missing or
b) logically incorrect
z-orders of drawing objects.

Even more than proprietary order handling, z-order certainly is for advanced programers. Most beginners
are not aware of the underlying DrawObjects collection at all or don't understand the .NET concept and
therefore quickly lose track of their drawing objects. (See e.g. the level of confusion about this topic in NT
development forum discussions.)

Besides, it is a relative concept, not an absolute one. Relative means that an object's z-order is relative
to all other objects and data series of the collection. Objects from a NinjaScript indicator or strategy
will generally share the same z-order as the script. Changes to that order must be done programmatically.

A classical rookie mistake (if you didn't lock your DrawObjects collection for new entries) is e.g. adding a new
object (at worst by hand during the runtime of the script) without programmatically checking - and readjusting if
necessary - the z-order of all your other objects.

If you really want to do the gruntwork and sort this out for your case, I'd recommend to start with the .NET
documentation on z-order.

Reply With Quote
  #4 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

Ok, I can research that...

Does z-order work only within an indicator, or can you set it globally across several indicators?

There are 3-4 indicators that create objects on a given toolbar.

Started this thread Reply With Quote
  #5 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

" A classical rookie mistake (if you didn't lock your DrawObjects collection for new entries) is e.g. adding a new
object (at worst by hand during the runtime of the script) without programmatically checking - and readjusting if
necessary - the z-order of all your other objects."


The toolstrip controls are created during OnStartup.

The only objects created by hand are Ninja drawobjects.

Do you know of any code samples (in Futures IO) that show how to check and readjust the z-order of all other objects, as you mention?

Thanks

Started this thread Reply With Quote
  #6 (permalink)
 choke35 
Germany
 
Experience: Intermediate
Platform: Other
Trading: ES, YM, 6E
Posts: 2,668 since Feb 2013
Thanks Given: 5,101
Thanks Received: 6,558


vantojo View Post
Ok, I can research that...

Does z-order work only within an indicator, or can you set it globally across several indicators?

There are 3-4 indicators that create objects on a given toolbar.

The z-order is FOR the indicator. This can cause additional problems if an indicator produces several
objects for the collection. If you want to be absolutely sure about the z-order for any of these outputs,
you will need to decompose the indicator into single output objects.

Reply With Quote
  #7 (permalink)
 choke35 
Germany
 
Experience: Intermediate
Platform: Other
Trading: ES, YM, 6E
Posts: 2,668 since Feb 2013
Thanks Given: 5,101
Thanks Received: 6,558


vantojo View Post
" A classical rookie mistake (if you didn't lock your DrawObjects collection for new entries) is e.g. adding a new
object (at worst by hand during the runtime of the script) without programmatically checking - and readjusting if
necessary - the z-order of all your other objects."


The toolstrip controls are created during OnStartup.

The only objects created by hand are Ninja drawobjects.

Do you know of any code samples (in Futures IO) that show how to check and readjust the z-order of all other objects, as you mention?

Thanks

The problem with the support of this feature for NT is that the order in which objects of your DrawObjects collection
are invoked are completely irrelevant for "the rest of the world". So NT only implements the method (publicly since
about 2009, I think - because they also need it for constructing the charts), but to the best of my knowledge, NT
neither documents this method nor gives significant examples.

Thus you will presumably find the best examples in the .NET documentation.

Reply With Quote
  #8 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012


choke35 View Post
The problem with the support of this feature for NT is that the order in which objects of your DrawObjects collection
are invoked are completely irrelevant for "the rest of the world". So NT only implements the method (publicly since
about 2009, I think - because they also need it for constructing the charts), but to the best of my knowledge, NT
neither documents this method nor gives significant examples.

Thus you will presumably find the best examples in the .NET documentation.

Ok, at the moment this is over my head. I'll live with it until I can do more research.

Thank you.

Started this thread Reply With Quote
  #9 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012

I just remembered, and verified this.....the above discussion might be so....but in the indicator list for the chart, the ORDER of the indicators is changing from what I entered.

And, then the toolbar matches the new order the next time the chart is loaded....so, while z-order may be important, I don't think it is causing this problem.

Something in Ninja is changing the order of the indicators in the list (Control I), perhaps when I shut Ninja down and it saves the Workspace (?), and then when the chart loads again, the order the indicators are loaded match the NEW list, which is not what I entered.

Any ideas?

When I asked Ninja before I didn't get any solution. Just "that is the way it works".

(this is NT7)

Started this thread Reply With Quote
  #10 (permalink)
 vantojo 
Vilcabamba, Ecuador
 
Experience: Intermediate
Platform: Ninja
Trading: NQ, UB
Posts: 204 since Jul 2012


Then, if I reload the Chart Template, the list is correct, and the controls load the way I expect.

Started this thread Reply With Quote





Last Updated on January 25, 2016


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts