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 ejtrader with 0.5 thanks per post
    4. looks_4 NJAMC with 0.5 thanks per post
    1. trending_up 6,369 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

  #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,526 since Oct 2009
Thanks Given: 4,167
Thanks Received: 6,018

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?
ZombieSqueeze
Platforms and Indicators
NexusFi Journal Challenge - April 2024
Feedback and Announcements
Request for MACD with option to use different MAs for fa …
NinjaTrader
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
67 thanks
NexusFi site changelog and issues/problem reporting
47 thanks
Battlestations: Show us your trading desks!
43 thanks
GFIs1 1 DAX trade per day journal
32 thanks
What percentage per day is possible? [Poll]
31 thanks

  #3 (permalink)
 
NJAMC's Avatar
 NJAMC 
Atkinson, NH USA
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
Posts: 1,970 since Dec 2010
Thanks Given: 3,037
Thanks Received: 2,394



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: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Visit my NexusFi Trade Journal Reply With Quote
The following user says Thank You to NJAMC for this post:
  #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,526 since Oct 2009
Thanks Given: 4,167
Thanks Received: 6,018


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
Market Wizard
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
Posts: 1,970 since Dec 2010
Thanks Given: 3,037
Thanks Received: 2,394


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: NT-Local-Order-Manager-LOM-Guide
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,713 since May 2010
Thanks Given: 203
Thanks Received: 2,686


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 Twitter 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,371


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
The following 3 users say Thank You to monpere for this post:
  #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
The following user says Thank You to ejtrader for this post:
  #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


© 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