NexusFi: Find Your Edge


Home Menu

 





Global variables for sharing data between Charts


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one bukkan with 1 posts (1 thanks)
    2. looks_two Quick Summary with 1 posts (0 thanks)
    3. looks_3 forrestang with 1 posts (0 thanks)
    4. looks_4 kandlekid with 1 posts (2 thanks)
    1. trending_up 2,735 views
    2. thumb_up 3 thanks given
    3. group 4 followers
    1. forum 5 posts
    2. attach_file 0 attachments




 
Search this Thread

Global variables for sharing data between Charts

  #1 (permalink)
ECI Ed
Seminole, FL
 
Posts: 17 since Oct 2011
Thanks Given: 9
Thanks Received: 3

I have been using Esignal for 9 years and have written many efs's. Now I would like to convert my efs's to NinjaTrader to take advantage of lower data costs and automated trading. But a feature that I use extensively is the Global Variable where the results from an efs in one subchart are stored in a Global variable then read by an efs in another chart or subchart.

I took a course at the local Junior College to learn the basics of C# and I'm just now starting to convert my code, but I'm not going to get very far without this capablilty. I know I could save the data to a file, but that would cause too much delay. I read in one of the posts that this might be accomplised by writing a dll.

Any help, direction, or examples would be appreciated.

TIA

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Futures True Range Report
The Elite Circle
ZombieSqueeze
Platforms and Indicators
The space time continuum and the dynamics of a financial …
Emini and Emicro Index
NexusFi Journal Challenge - April 2024
Feedback and Announcements
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
36 thanks
NexusFi site changelog and issues/problem reporting
25 thanks
The Program
20 thanks
GFIs1 1 DAX trade per day journal
19 thanks
  #3 (permalink)
 
forrestang's Avatar
 forrestang 
Chicago IL
 
Experience: None
Platform: Ninja, MT4, Matlab
Broker: CQG, AMP, MB, DTN
Trading: E/U, G/U
Posts: 1,329 since Jun 2010
Thanks Given: 354
Thanks Received: 1,047


If you need something that one study calculates available for another study, as long as you declare it as an 'exposed' dataSeries or variable, any study you create can access that information.

Not sure if that is your question or not?

Reply With Quote
  #4 (permalink)
 bukkan 
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks Given: 161
Thanks Received: 271

indicator strategies are partial class (see userdefinedmethods.cs). you can define a static property etc and store the values there which can be called by any other indicators etc. very easy and convenient way of passing values.

Reply With Quote
Thanked by:
  #5 (permalink)
kandlekid
College Point, NY (Queens)
 
Posts: 63 since Nov 2009
Thanks Given: 5
Thanks Received: 20


bukkan View Post
indicator strategies are partial class (see userdefinedmethods.cs). you can define a static property etc and store the values there which can be called by any other indicators etc. very easy and convenient way of passing values.

I agree, a static is one way to go. But remember, a static is a class variable, not an instance variable. If you instantiate multiple instances of your class, they'll all use the same static variable. For example, my strats all use statics. But I only start one instance of each, because it's not clear which strat will update the static if I start multiple instances (a good multithreading issue).

Reply With Quote
Thanked by:
  #6 (permalink)
 agora 
New York
 
Experience: Advanced
Platform: Ninja, Kinetick
Broker: Global futures
Trading: ES
Posts: 1 since May 2010
Thanks Given: 1
Thanks Received: 0


forrestang View Post
If you need something that one study calculates available for another study, as long as you declare it as an 'exposed' dataSeries or variable, any study you create can access that information.

Not sure if that is your question or not?

So how do I do the following:


Let's say I plot an SMA on a TICK chart then another on an ADD chart.

Now I want to access the current SMA data being calculated on TICK and then SMA on ADD.

I know that I can, within a code:
Initialize section:
add("^TICK", PeriodType.Second,4)
add("^ADD", PeriodType.Second,4)


Then in the OnBarsUpdate section refer to the added data series and do an SMA on each but that's a waste of CPU. I want to access the SMA already being calculated on the ADD chart and TICK chart, so that if I add this code to, say 15 different instruments, I don't need to have all 15 instruments recalculating what I is alreayd being calculated on the TICK and the ADD charts.

Is this possible within NinjaTrader?

Does anyone know?

Reply With Quote




Last Updated on March 6, 2012


© 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