Enqueue a variable - NinjaTrader Programming | futures io social day trading
futures io futures trading


Enqueue a variable
Updated: Views / Replies:842 / 9
Created: by Xav1029 Attachments:1

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
 
Thread Tools Search this Thread
 

Enqueue a variable

  #1 (permalink)
Elite Member
Tampa, FL
 
Futures Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: 6E, M6E, 6J
 
Xav1029's Avatar
 
Posts: 1,374 since Dec 2011
Thanks: 1,452 given, 3,354 received

Enqueue a variable

Does anyone know how to pass a variable unsing Enqueue??

for example:

double myprofit = 99.75;

myQ.Enqueue(myprofit);


This method does not work for some reason. I am looking for a FIFO structure I can use to store non-continuous data, and am open to other suggestions.

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received


Do you receive any errors?

Have you initialized your queue beforehand:
 
Code
                            
myQ = new Queue<double>(); 


Reply With Quote
The following user says Thank You to gregid for this post:
 
  #4 (permalink)
Elite Member
Tampa, FL
 
Futures Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: 6E, M6E, 6J
 
Xav1029's Avatar
 
Posts: 1,374 since Dec 2011
Thanks: 1,452 given, 3,354 received


gregid View Post
Do you receive any errors?

Have you initialized your queue beforehand:
 
Code
                            
myQ = new Queue<double>(); 


Hey @gregid I had initialized the Queue beforehand. Actually I used the dictionary method you helped me with, but a Queue dictionary. I was able to pass a value directly into the queue, but when I tried to pass a variable, it would not work.

Reply With Quote
 
  #5 (permalink)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received

@Xav1029 I am afraid you will have to post a bit more of your queue/dictionary code (your declared queue, how it is initialized).

Also, are you saying you were able to do:
myQ.Enqueue(99.75);

or was your successful syntax different?

Reply With Quote
The following user says Thank You to gregid for this post:
 
  #6 (permalink)
Elite Member
Tampa, FL
 
Futures Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: 6E, M6E, 6J
 
Xav1029's Avatar
 
Posts: 1,374 since Dec 2011
Thanks: 1,452 given, 3,354 received

Problem Solved

I deleted all the code and gave it another try, and it worked this time. I don't know what I had done wrong before, but had looked over the code 20 times and could not find anything wrong. Time to get some rest now, this project is going to take a while

Reply With Quote
 
  #7 (permalink)
Elite Member
Tampa, FL
 
Futures Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: 6E, M6E, 6J
 
Xav1029's Avatar
 
Posts: 1,374 since Dec 2011
Thanks: 1,452 given, 3,354 received

Here is the code that worked:

 
Code
#region Variables
		double test = .9898;
		
		private Dictionary<int, DataSeries>indicatorD;		//Used to store the indicator values
		
		private Dictionary<int, DataSeries>EPLd;			//Used to store short term expected profit for long trades
		private Dictionary<int, DataSeries>EPSd;			//Used to store short term expected profit for short trades
		private Dictionary<int, DataSeries>MFE_Ld;			//
		private Dictionary<int, DataSeries>MAE_Ld;
		private Dictionary<int, DataSeries>MFE_Sd;
		private Dictionary<int, DataSeries>MAE_Sd;
		
		private Dictionary<int, Queue<double>>Qtest;
		
        #endregion


        protected override void Initialize()
        {
            Overlay				= false;
			//-------------------Eight Data Series for the indicators------------------------------
			indicatorD 			= new Dictionary<int, DataSeries>();
			
			//---------------------Twenty Four of the following-----------------------------------
			EPLd				= new Dictionary<int, DataSeries>();
			EPSd				= new Dictionary<int, DataSeries>();
			MFE_Ld 				= new Dictionary<int, DataSeries>();
			MAE_Ld 				= new Dictionary<int, DataSeries>();
			MFE_Sd 				= new Dictionary<int, DataSeries>();
			MAE_Sd 				= new Dictionary<int, DataSeries>();
			
			Qtest				= new Dictionary<int, Queue<double>>();
			
			
			
        }
		
		protected override void OnStartUp()
		{
			for(int i = 0; i < 8; i++)
			{
				indicatorD[i] = new DataSeries(this);
			}
			
			for (int i = 0; i < 24; i++)
			{
    			EPLd[i] = new DataSeries(this);
				EPSd[i] = new DataSeries(this);
				MFE_Ld[i] = new DataSeries(this);
				MAE_Ld[i] = new DataSeries(this);
				MFE_Sd[i] = new DataSeries(this);
				MAE_Sd[i] = new DataSeries(this);
			}
			
			for(int i = 0; i < 8; i++)
			{
				Qtest[i] = new Queue<double>();
			}
		}


        protected override void OnBarUpdate()
        {
			
			Qtest[0].Enqueue(test);
			//test+=1;
			Print(Qtest[0].Peek());
        }
My previous try was an int Queue, and I could not pass CurrentBar to it or an int variable. Don't know why, but a fresh start worked

Reply With Quote
The following user says Thank You to Xav1029 for this post:
 
  #8 (permalink)
Elite Member
Wrocław, Poland
 
Futures Experience: Intermediate
Platform: NinjaTrader, Racket
Favorite Futures: Ockham's razor
 
gregid's Avatar
 
Posts: 651 since Aug 2009
Thanks: 321 given, 605 received

Glad fresh start worked for you - I do it all the time

Reply With Quote
The following user says Thank You to gregid for this post:
 
  #9 (permalink)
Market Wizard
New Orleans, La (Mardi Gras City)
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: Ninjatrader / Optimus Futures / AmpFutures
Favorite Futures: ES / 6E / 6B / CL
 
DavidHP's Avatar
 
Posts: 1,002 since Aug 2009
Thanks: 802 given, 1,367 received

Here is an indicator that has a routine by jabeztrading that uses enqueue to plot swings.
It is very effective and shows how to set it up.

NinjaTrader Support Forum - View Single Post - Swing indicator edits

I have used the routine in several custom indicators and it works well for me.

Rejoice in the Thunderstorms of Life . . .
Knowing it's not about Clouds or Wind. . .
But Learning to Dance in the Rain ! ! !
Reply With Quote
The following user says Thank You to DavidHP for this post:
 
  #10 (permalink)
Elite Member
Tampa, FL
 
Futures Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker/Data: Mirus Futures/Zen-Fire
Favorite Futures: 6E, M6E, 6J
 
Xav1029's Avatar
 
Posts: 1,374 since Dec 2011
Thanks: 1,452 given, 3,354 received



DavidHP View Post
Here is an indicator that has a routine by jabeztrading that uses enqueue to plot swings.
It is very effective and shows how to set it up.

NinjaTrader Support Forum - View Single Post - Swing indicator edits

I have used the routine in several custom indicators and it works well for me.

Thanks for the response. I am still building the foundation for the tool I am working on, and for some reason Peek is not returning the same values as Dequeue. Please see attatched file and what gets printed in the output window.

EDIT: Disregard this post. I had the beginning and end of the queue mixed up in my head. I thought the beginning was the last item added, but that is actually the end due to the FIFO structure that I am trying to achieve.

Attached Files
Register to download File Type: cs XavGlassBoxX0.cs (31.7 KB, 8 views)

Last edited by Xav1029; August 31st, 2012 at 07:32 AM.
Reply With Quote

Reply



futures io > > > > > Enqueue a variable

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Is there a 64bit Global Variable replacement? Tarkus11 NinjaTrader Programming 4 March 16th, 2011 08:47 AM
Variable Range Bars aligator NinjaTrader 9 December 20th, 2010 02:20 PM
Indicator with variable Text on Chart Henrik EasyLanguage Programming 6 May 14th, 2010 02:01 PM
Variable Bar Chart DavidHP Traders Hideout 0 December 4th, 2009 04:53 PM
When to use BoolSeries rather than simple variable Saroj NinjaTrader Programming 11 November 24th, 2009 11:04 PM


All times are GMT -4. The time now is 09:03 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-11 in 0.13 seconds with 20 queries on phoenix via your IP 54.83.122.227