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,896 views
    2. thumb_up 7 thanks given
    3. group 5 followers
    1. forum 13 posts
    2. attach_file 0 attachments




 
Search this Thread
  #1 (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,581 since Oct 2009
Thanks Given: 4,267
Thanks Received: 6,208

Is it possible for two different charts that use the same symbol in their DataSeries to share a common variable ? Does the concept of Global Variable exist in Ninja ?


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Would a node-based workflow for automated trading be useful?
Traders Hideout
Bookmap Global Plus Lifetime + Lifetime Addons For Sale
Platforms and Indicators
S&P 500 Holds the Line: No Fast Track for SpaceX, Op …
Stocks and ETFs
Khamenei Vetoes Uranium Transfer as Peace Odds Surge to …
Prediction Markets & Event Contracts
May 26 Deadline Dies at 7.5% as US Strikes Iran During C …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
NexusFi site changelog and issues/problem reporting
10 thanks
Darmok and Jalad at Tanagra
3 thanks
Big Mike in Ecuador
1 thanks
30 Sessions
1 thanks
  #3 (permalink)
 
NJAMC's Avatar
 NJAMC 
Atkinson, NH USA
Legendary Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
Posts: 1,951 since Dec 2010
Thanks Given: 3,042
Thanks Received: 2,397



trendisyourfriend View Post
Is it possible for two different charts that use the same symbol in their DataSeries to share a common variable ? Does the concept of Global Variable exist in Ninja ?

If I understand your question, the answer would be no. Two charts cannot communicate with one another. I suspect you have something else in mind such as an Indicator or Strategy. If this is the case, give more information and there may be a programming technique to get what youneed.


Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: [wiki=NT-Local-Order-Manager-LOM-Guide][/wiki]
Artificial Bee Colony Optimization
Visit my NexusFi Trade Journal Reply With Quote
Thanked by:
  #4 (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,581 since Oct 2009
Thanks Given: 4,267
Thanks Received: 6,208


NJAMC View Post
If I understand your question, the answer would be no. Two charts cannot communicate with one another. I suspect you have something else in mind such as an Indicator or Strategy. If this is the case, give more information and there may be a programming technique to get what youneed.

I might have some ideas but if Global variables are not supported then i am not sure what to think. I/RT supports it very well. Let's take an easy task (in my mind), i use a SMA(8) on a Range chart and would like to pass the current value of this RangeChart(x).SMA(8) to another chart that is a tick chart for example. Is this possible ?


Started this thread Reply With Quote
  #5 (permalink)
 
NJAMC's Avatar
 NJAMC 
Atkinson, NH USA
Legendary Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
Posts: 1,951 since Dec 2010
Thanks Given: 3,042
Thanks Received: 2,397


trendisyourfriend View Post
I might have some ideas but if Global variables are not supported then i am not sure what to think. I/RT supports it very well. Let's take an easy task (in my mind), i use a SMA(8) on a Range chart and would like to pass the current value of this RangeChart(x).SMA(8) to another chart that is a tick chart for example. Is this possible ?

If you are only trying to display the value, you are looking at a multi timeframe Indicator. The indicator would be applied to the "other chart". you wouldn't actually need the RangeChart open. This is not trivial, but can be done, and would need to be coded.


Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: [wiki=NT-Local-Order-Manager-LOM-Guide][/wiki]
Artificial Bee Colony Optimization
Visit my NexusFi Trade Journal Reply With Quote
  #6 (permalink)
 
NinjaTrader's Avatar
 NinjaTrader  NinjaTrader is an official Site Sponsor
Site Sponsor

Web: NinjaTrader
AMA: Ask Me Anything
Webinars: NinjaTrader Webinars
Elite offer: Click here
 
Posts: 1,715 since May 2010
Thanks Given: 203
Thanks Received: 2,689


trendisyourfriend View Post
I might have some ideas but if Global variables are not supported then i am not sure what to think. I/RT supports it very well. Let's take an easy task (in my mind), i use a SMA(8) on a Range chart and would like to pass the current value of this RangeChart(x).SMA(8) to another chart that is a tick chart for example. Is this possible ?

You could just add both series to a single chart, apply the indicator to the range series but it plot it over top of the other tick series and hide the range series...If I understand what you want to do correctly.

I believe this video might help - NinjaTrader 7 Tips - Hidden Data Series - YouTube


Follow me on X Reply With Quote
  #7 (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,375


trendisyourfriend View Post
Is it possible for two different charts that use the same symbol in their DataSeries to share a common variable ? Does the concept of Global Variable exist in Ninja ?

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.


Reply With Quote
  #8 (permalink)
 ejtrader 
Portland, OR
 
Experience: Intermediate
Platform: Sierra Chart
Trading: ES
Posts: 269 since Jan 2011
Thanks Given: 327
Thanks Received: 180

- I have done some work in this space
- it is possible to share the values using globalvariable.dll (tradestation dll)
- I would do a cleanup of the code and post in elite downloads section soon.


Reply With Quote
Thanked by:
  #9 (permalink)
 Tarkus11 
East Coast
 
Experience: Beginner
Platform: Ninja
Trading: ES, NQ
Posts: 124 since Apr 2010
Thanks Given: 55
Thanks Received: 80

The GlobalVariable.dll was great in TradeStation and NT 32bit. In 64bit NT the static class works.


Reply With Quote
  #10 (permalink)
 ejtrader 
Portland, OR
 
Experience: Intermediate
Platform: Sierra Chart
Trading: ES
Posts: 269 since Jan 2011
Thanks Given: 327
Thanks Received: 180


Tarkus1 - you are correct. I did it sometime back and realized it would work only with 32 bit version of Ninja ( due to the dll being 32 bit).

probably static class might be the way to go in that case.

Thanks.


Reply With Quote




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