Need Help Plotting the average of a queue - NinjaTrader Programming | futures io social day trading
futures io futures trading


Need Help Plotting the average of a queue
Updated: Views / Replies:946 / 5
Created: by Xav1029 Attachments:3

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
 

Need Help Plotting the average of a queue

  #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

Need Help Plotting the average of a queue

I have a project I have been working on that I just got stuck on. My goal is to track multiple automated strategies inside an indicator and to plot the average profit of the last trades stored in memory(queues). The goal is to track 24 strategies based on 8 indicators (8 based on one indy, 16 based on two indy combos). Right now I think I have most of the information being stored correctly for the single indicator strategies (MAE, MFE, Profit), but can't figure out how to plot the average of the profit queue. All strategies are broken into Long Trades - L at the end- and Short trades-S at the end. I have attached what I have so far, and here is the method I am using:

 
Code
for(int i = 0; i < 8; i++)
			{
				if(LongCount[i] < 20)
				{
					double tp=0;
					double[] profitArray = new double[LongProfit[i].Count];
					LongProfit[i].CopyTo(profitArray,0);
					
					for(int j = 0; j < LongCount[i]; j++)
					{
						//Print(profitArray[0]);
						tp+= profitArray[0];
					}
					myPlotLd[i][0] = tp / (double)LongCount[i];
					Print("Plot"+i+":"+Values[i][0]);
				}
			}
			myStrategy0L.Set(myPlotLd[0][0]);
Any help would be appreciated. There are 48 plots because I plan on splitting everything into Long and short.

Attached Files
Register to download File Type: zip XavGlassBoxX0.zip (8.1 KB, 4 views)

Last edited by Xav1029; August 31st, 2012 at 11:20 PM. Reason: forgot file
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


@Xav1029

In your loop you have fixed 0 index for the profitArray. Change it to j:

 
Code
for(int j = 0; j < LongCount[i]; j++)
{
	//Print(profitArray[j]);
	tp+= profitArray[j];
}

Alternatively you could also use foreach loop, something like this:

 
Code
foreach (var q in LongProfit[i].ToList())
{
	tp += q
}

Reply With Quote
The following 2 users say 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

Once again THANK YOU @gregid. You know its time to get some sleep when you miss something so simple. LongProfit[i] is actually a queue, so I don't know if you can do do tolist()??
I plan on removing the max and min values values before finding the average, so I will be using linq. Thanks again

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

ToList is an extension method of IEnumerable and since Queue:

 
Code
                            
public class Queue<T> : IEnumerable<T>, ICollectionIEnumerable 

You are able to use extension method of IEnumerables for the Queue as well

Reply With Quote
The following 2 users say 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

Slowly coming along

So I got all the single indicator strategies to track correctly. Since this will be a discretionary indicator based on MFE/MAE for PT/SL targets, the plots are Average MFE/Average MAE stored in memory, excluding the minimum and maximums (I don't want a homerun to skew targets). Also if avg MFE is less than MinMFE, the plots are transparent (Minimum PT).

The dash style and color combinations will allow you to distinguish the strategies.

Here is what I have so far with a picture of default indicators, MinMFE 20, and TradeMemory 15.

Now its time to drive up to Gainesville for the Gators Football Game.
GO GATORS!!!

Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).

Attached Files
Register to download File Type: zip XavGlassBoxX0v1.zip (8.7 KB, 9 views)
Reply With Quote

Reply



futures io > > > > > Need Help Plotting the average of a queue

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
Adding to your position, average down or average up? caprica Psychology and Money Management 4 August 22nd, 2014 07:00 PM
Starving Greeks queue for food in their thousands....... kbit News and Current Events 0 June 22nd, 2012 02:37 PM
CQG and estimated position in queue EulerFourier CQG 5 April 30th, 2012 10:16 AM
Portugal Gradually Shuffles Its Way Up Towards The Front Of The Debt Queue GridKing News and Current Events 0 March 11th, 2012 04:22 PM
How do you calculate Position in Queue (PIQ) PeterOhlson The Elite Circle 3 September 5th, 2011 05:38 PM


All times are GMT -4. The time now is 06:06 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-12 in 0.09 seconds with 20 queries on phoenix via your IP 54.167.44.32