routine for getting range statistics - NinjaTrader Programming | futures io social day trading
futures io futures trading


routine for getting range statistics
Updated: Views / Replies:1,927 / 3
Created: by zeller4 Attachments:0

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
 

routine for getting range statistics

  #1 (permalink)
Elite Member
Florida
 
Futures Experience: Intermediate
Platform: NT7
Favorite Futures: CL, NQ, NG
 
Posts: 456 since Jun 2009
Thanks: 1,359 given, 383 received

routine for getting range statistics

Hey BigMike and all you other programmers!

Thanks Mike for a great site!

I'm advancing my understanding of C# - currently going through C#2008 For Dummies.
I'm attempting to see what the hourly or daily range (or whatever variable time I want) is over a certain quantity of bars so I can apply a moving average and review other statistics. I've finally figured out how to get a barcount for the session using the following(in the OnBarUpdate section):
 
Code
if (Bars.FirstBarOfSession)
{ // first bar initialization

barCount = 0;
return;
}
 
for (int i = 0; i < 1; i++)
{
if (FirstTickOfBar)
{
barCount++;// = barCount+1;
}
 
}
Now, i'm trying to use this barcount with the range per bar and I'm not sure how to use this barcount with the following or similar to get the array and average range.
 
Code
double range = High[s] - Low[s];
Eventually, I'm going to attempt getting statistics with results similar to the following:
(these are examples only!)
1. for CL, the average daily range is 52 ticks
2. for CL on Tuesday during 9am-10am, the average hourly range is 35 ticks
3. for CL on Tuesday during 11am-12am, the average hourly range is 7 ticks

I know I need some "data holders" such that the range data gets plugged into the right location - "like colored marbles in the correct sack"


any help or direction anyone could give is much appreciated. Any code snippets would be welcome.
thanks,
Kirk

Reply With Quote
 
  #2 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,352 given, 83,233 received

Hmm.

Well first, there is CurrentBar and Bars.Count. No need to do your own barcount variable from my understanding of what you want.

If you want to use High - Low as a dataseries, instead of Close for instance, create a new dataseries like so:

#var
private DataSeries hl;

#init
hl = new DataSeries(this);

#onbarupdate
hl.Set(High[0] - Low[0]);

Then you can pass that dataseries to your indicator, like if you want an SMA of the high low, it would be

double _smahl = SMA(hl, 10)[0];

If you are trying to get the range of a period of bars, try using HighestBar and LowestBar, it returns the bar number within a certain period that was the Highest or Lowest. Then you can use that Bar # and lookback at it for more info, like:

double _highestbar = HighestBar(10);

Print(Time[0] + ": the highest bar was " + _highestbar + " bars ago, with a value of " + High[_highestbar]);

You can also use MIN and MAX, but be careful using them over large dataseries, they are a real performance drag.

If you want to limit your lookback period to just today, use Bars.BarsSinceSession.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:
 
  #3 (permalink)
Site Administrator
Manta, Ecuador
 
Futures Experience: Advanced
Platform: My own custom solution
Favorite Futures: E-mini ES S&P 500
 
Big Mike's Avatar
 
Posts: 46,240 since Jun 2009
Thanks: 29,352 given, 83,233 received


Ok either you added some new stuff to your post or I missed the bottom part before I replied. Probably my bad, been a rough week for me

For ATR stuff, you can do a few things. First if you can't use a real daily chart, you can use a 1440m chart. But I would focus on just the cash session if it were me, so I would treat your "daily" request similar to your 9am-10am request and be specific with the time frame, instead of using a 24 hour clock.

Time[0] is your friend. Just use it to figure out what time it is. That way one script can handle multiple requests, like the 'daily' request, the 9am-10am, etc.

GetBar() is your friend, too. You can tell it to look at a specific time frame. This will help you narrow down what bar has happened at 9am, and what bar number ended at 10am. Then use those two bar numbers and a combination of MIN or MAX, or even HighestBar or LowestBar depending on when you're calling them, to get your high and low range.

Sorry, no time to give you more than this right now.

Mike

Due to time constraints, please do not PM me if your question can be resolved or answered on the forum.

Need help?
1) Stop changing things. No new indicators, charts, or methods. Be consistent with what is in front of you first.
2) Start a journal and post to it daily with the trades you made to show your strengths and weaknesses.
3) Set goals for yourself to reach daily. Make them about how you trade, not how much money you make.
4) Accept responsibility for your actions. Stop looking elsewhere to explain away poor performance.
5) Where to start as a trader? Watch this webinar and read this thread for hundreds of questions and answers.
6)
Help using the forum? Watch this video to learn general tips on using the site.

If you want
to support our community, become an Elite Member.

Reply With Quote
The following user says Thank You to Big Mike for this post:
 
  #4 (permalink)
Elite Member
Florida
 
Futures Experience: Intermediate
Platform: NT7
Favorite Futures: CL, NQ, NG
 
Posts: 456 since Jun 2009
Thanks: 1,359 given, 383 received

that's okay,
yes i thought there were a couple points you didn't address in that first post.
hope your week is better (and mine too - didn't even get to open NT today - having a withdrawal or tantrum lol)

the only reason i'm using daily now is so i can easily count the bars in the group, then, i'll start enlarging the pool and explore other details

I appreciate about the Bars.Count. The setup of an array with the possible plot to a screen text grid is where i'm eventually headed.

There's some value in getting the current picture of where we are in relation to a "normal" day. ie on high-end of the typical range, on a low-range or narrow day, within 5 ticks of the bottom of the range and below the open, etc. there's a screenshot of some data coming back to the chart to update in realtime.

2009-10-15_1520

appreciate the help.
kz

Reply With Quote

Reply



futures io > > > > > routine for getting range statistics

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
Trade Statistics GentleTrader Psychology and Money Management 0 October 22nd, 2010 10:31 PM
ES Statistics Laserdan Emini Index Futures Trading 27 October 6th, 2010 06:24 PM
Public site statistics Big Mike Feedback and Announcements 0 January 3rd, 2010 02:50 AM


All times are GMT -4. The time now is 04:58 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-14 in 0.09 seconds with 19 queries on phoenix via your IP 54.221.73.186