Global variables in NT - NinjaTrader Programming | futures io social day trading
futures io futures trading


Global variables in NT
Updated: Views / Replies:7,988 / 24
Created: by Geir Attachments:5

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors – all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you don’t need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 5  
 
Thread Tools Search this Thread
 

Global variables in NT

  #21 (permalink)
 Vendor: www.probabletrades.com 
OC, California, USA
 
Futures Experience: Advanced
Platform: IB/TWS, NinjaTrader, thinkorswim
Favorite Futures: stocks, options, futures, VIX
 
shodson's Avatar
 
Posts: 1,860 since Jun 2009
Thanks: 480 given, 3,255 received


Cheech View Post
OK thank you, I will do that, give it a shot, and report the results.

That said, the second problem is that after the historical data is plotted (correctly) they go out of sync. I didn't modify any of the original code when I added in the locks and at this point not sure if the original code worked. Should the locks have prevented this from happening or is there something missing in the original code?

I'm not sure what "out of sync" means. I need to move on, maybe someone else can help you from here. Since you don't have any/much programming experience this could get very time-consuming for me. I just thought I'd point out some quick-to-find things for you. You can always try here or here or here as well for further help.

Reply With Quote
The following user says Thank You to shodson for this post:
 
  #22 (permalink)
Elite Member
Mesa, AZ/USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, ThinkorSwim
Broker/Data: AMP Futures/CQG, TDA
Favorite Futures: Currency Futures, my Harley Davidson
 
Posts: 94 since Jun 2012
Thanks: 41 given, 126 received


shodson View Post
I'm not sure what "out of sync" means. I need to move on, maybe someone else can help you from here. Since you don't have any/much programming experience this could get very time-consuming for me. I just thought I'd point out some quick-to-find things for you. You can always try here or here or here as well for further help.

BTW, I am a retired programmer/analyst but C# is not a language that I know. The out of sync condition as shown in the screenshot means the plots don't match.


Ok, thanks for your help.

Reply With Quote
The following user says Thank You to Cheech for this post:
 
  #23 (permalink)
Elite Member
Frankfurt
 
Futures Experience: Intermediate
Platform: NinjaTrader, cTrader
Favorite Futures: Currency Futures
 
Posts: 6 since Aug 2014
Thanks: 4 given, 3 received


Hi,

what I do if I want to share data between more indicators is a Singleton Pattern class. This ensures, that only one instance can be exist at one time. Just google for Singleton Pattern C#

So the class could look like this:

 
Code
public class TSMTFHistory
{
        private static double _OnBidVolumeHistory;
	private static double _OnAskVolumeHistory;		
		
	private static readonly TSMTFHistory _TSMTFHistoryInstance = new TSMTFHistory();

        // Explicit static constructor to tell C# compiler
        // not to mark type as beforefieldinit
        static TSMTFHistory()
        {
			
        }

        private TSMTFHistory()
        {
			
        }

        public static TSMTFHistory TSMTFHistoryInstance
        {
            get
            {
                return _TSMTFHistoryInstance;
            }
        }
       
       public void AddBidVolume(double value)
	{
		_OnBidVolumeHistory += value;
	}
		
	public double GetBidVolume()
	{
		return _OnBidVolumeHistory;
	}

}
So you can do some write operation in indicators like this:
 
Code
TSMTFHistory.TSMTFHistoryInstance.AddBidVolume(bid);
And read like this:
 
Code
TSMTFHistory.TSMTFHistoryInstance.GetBidVolume();

For me it works fine. Hope this helps.

Reply With Quote
The following user says Thank You to antonma for this post:
 
  #24 (permalink)
Elite Member
Mesa, AZ/USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, ThinkorSwim
Broker/Data: AMP Futures/CQG, TDA
Favorite Futures: Currency Futures, my Harley Davidson
 
Posts: 94 since Jun 2012
Thanks: 41 given, 126 received


Geir View Post
Hi drmartell

I have not heard of similar problems and I have no idea what this could be.

I guess that Ninja Trader does not provide support when it comes to custom code, but they do provide a framework in which it is possible to program the platform. And when this framework starts behaving strangely in some instances, then I assume that they would be interested in investigating the issue.

I hope this helps.

Regards
Geir

@Geir

I had that exact same problem, indicators compiled with no errors but all of my custom indicator disappeared, but were in the Indicators directory. I contacted Ninja support and after compiling several indicators with no errors he upgraded my release level (I was only 1 level behind) and when that didn't fix the problem we started removing these indicators, which solved the problem.

The original indicators first posted worked fine, but when I updated the code to include making the DataTable private and included the global locking mechanism the problem occurred, As I stated once all of the indicators were removed the problem went away.

I haven't gotten back to it yet but once I do I will be more methodical in doing the updates and see if I can at lease identify where it's getting broken.

Reply With Quote
 
  #25 (permalink)
Elite Member
Portland Oregon, United States
 
Futures Experience: Beginner
Platform: Ninjatrader®
Broker/Data: CQG, Kinetick
Favorite Futures: Gameplay Klownbine® Trading of Globex
 
Zondor's Avatar
 
Posts: 1,327 since Jul 2009
Thanks: 1,246 given, 2,635 received

Suggested Application to NT8

Project goals:

Create indicator that will, for each instrument of interest, calculate the prior day OHLC, overnight (Globex) HL, prior day VWAP, current day VWAP , and SD of current day VWAP, and store the data in a singlet class, or a file.

Create indicators that recover the stored data and display those levels on any chart of any of the instruments of interest. So that you don't have to calculate the same things on a gazillion different charts.

Even better would be if @NinjaTrader calculated these and made them available from their historical and real time data servers.

"If we don't loosen up some money, this sucker is going down." -GW Bush, 2008
“Lack of proof that something is true does not prove that it is not true - when you want to believe.” -Humpty Dumpty, 2014
“The greatest shortcoming of the human race is our inability to understand the exponential function.”
Prof. Albert Bartlett

Last edited by Zondor; March 31st, 2016 at 05:26 PM.
Reply With Quote
The following user says Thank You to Zondor for this post:

Reply



futures io > > > > > Global variables in NT

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Global Variables In TS c12345 EasyLanguage Programming 7 October 14th, 2017 10:52 AM
Global Variables - does this beast exist in Ninja trendisyourfriend NinjaTrader Programming 13 May 29th, 2013 07:15 PM
Global variables for sharing data between Charts ECI Ed NinjaTrader Programming 5 March 6th, 2012 10:02 AM
global variables: anyone got a complete NT7 example? elbone NinjaTrader Programming 2 July 19th, 2011 10:13 AM
Global Variables and Strategies in Ninja 6.5 TonyA NinjaTrader Programming 3 November 6th, 2010 08:50 AM


All times are GMT -4. The time now is 06:54 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-16 in 0.09 seconds with 20 queries on phoenix via your IP 54.145.16.43