NexusFi: Find Your Edge


Home Menu

 





Global Variables - does this beast exist in Ninja


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one trendisyourfriend with 3 posts (0 thanks)
    2. looks_two monpere with 2 posts (4 thanks)
    3. looks_3 ejtrader with 2 posts (1 thanks)
    4. looks_4 NJAMC with 2 posts (1 thanks)
      Best Posters
    1. looks_one monpere with 2 thanks per post
    2. looks_two shodson with 1 thanks per post
    3. looks_3 NJAMC with 0.5 thanks per post
    4. looks_4 ejtrader with 0.5 thanks per post
    1. trending_up 8,623 views
    2. thumb_up 7 thanks given
    3. group 5 followers
    1. forum 13 posts
    2. attach_file 0 attachments




 
Search this Thread
  #11 (permalink)
 
trendisyourfriend's Avatar
 trendisyourfriend 
Quebec Canada
Legendary Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader
Broker: AMP/CQG
Trading: ES, NQ, YM
Frequency: Daily
Duration: Minutes
Posts: 4,580 since Oct 2009
Thanks Given: 4,266
Thanks Received: 6,199

What about using the clipboard ? I think i read something to this effect in another post of yours recently.


monpere View Post
I haven't had the need tor two charts to talk to each other, but I get an indicator to talk to a strategy using this:

//### This is for External strategies.
//### Update() ensures this exposed variable is up to date, when external strategy Add()'s this indicator
public string TradeCommand {
get { Update(); return tradeCommand; }
Set { tradeCommand = value; }
}

And I get one indicator to share variables with another indicator like this:

public class GlobalChartVars {
public static Dictionary<string, string> chartIds = new Dictionary<string, string>();
public static Dictionary<string, string> SoundFiles = new Dictionary<string, string>();
}

I think the 2nd one should be able to share data between charts. I haven't tried it that way, but maybe that can give you some ideas.


Started this thread Reply With Quote
  #12 (permalink)
 
monpere's Avatar
 monpere 
Bala, PA, USA
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Mirus, IB
Trading: SPY, Oil, Euro
Posts: 1,854 since Jul 2010
Thanks Given: 300
Thanks Received: 3,374


trendisyourfriend View Post
What about using the clipboard ? I think i read something to this effect in another post of yours recently.

You could probably use that as well, but requires more coding then it is probably worth just to access the data in one variable.


Reply With Quote
Thanked by:
  #13 (permalink)
Wazoo
Boston, Massachusetts
 
Posts: 7 since Mar 2013
Thanks Given: 1
Thanks Received: 1


monpere View Post
I haven't had the need tor two charts to talk to each other, but I get an indicator to talk to a strategy using this:

//### This is for External strategies.
//### Update() ensures this exposed variable is up to date, when external strategy Add()'s this indicator
public string TradeCommand {
get { Update(); return tradeCommand; }
Set { tradeCommand = value; }
}

Monpere or anyone who knows, Does the code snippet above, in the strategy force the Indicator to Update its value or does it only update its own copy of the Last external public value published by the indicator.

Thanks
Jerry


Reply With Quote
  #14 (permalink)
 
shodson's Avatar
 shodson 
OC, California, USA
Quantoholic
 
Experience: Advanced
Platform: IB/TWS, NinjaTrader, ToS
Broker: IB, ToS, Kinetick
Trading: stocks, options, futures, VIX
Posts: 1,971 since Jun 2009
Thanks Given: 534
Thanks Received: 3,711

You're better off using a Singleton design pattern, and then writing semaphores around the get/setting of the singleton instance's shared data. If you want data "sent" to interested parties when changes are made look to implement INotifiyPropertyChanging.


Follow me on X Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on May 29, 2013


© 2026 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 - Downloads - Top
no new posts