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 NJAMC with 2 posts (1 thanks)
    3. looks_3 monpere with 2 posts (4 thanks)
    4. looks_4 ejtrader 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 6,423 views
    2. thumb_up 7 thanks given
    3. group 5 followers
    1. forum 13 posts
    2. attach_file 0 attachments




 
Search this Thread

Global Variables - does this beast exist in Ninja

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

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

Can you help answer these questions
from other members on NexusFi?
Futures True Range Report
The Elite Circle
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Build trailing stop for micro index(s)
Psychology and Money Management
Are there any eval firms that allow you to sink to your …
Traders Hideout
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
37 thanks
GFIs1 1 DAX trade per day journal
22 thanks
NexusFi site changelog and issues/problem reporting
22 thanks
The Program
20 thanks
  #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,371


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,976 since Jun 2009
Thanks Given: 533
Thanks Received: 3,709

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 Twitter Visit my NexusFi Trade Journal Reply With Quote
Thanked by:




Last Updated on May 29, 2013


© 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