Question going by tick - NinjaTrader Programming | futures io social day trading
futures io futures trading


Question going by tick
Updated: Views / Replies:1,101 / 2
Created: by jeffbg123 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
 

Question going by tick

  #1 (permalink)
Elite Member
Chicago
 
Futures Experience: Advanced
Platform: Other
 
Posts: 35 since Feb 2010
Thanks: 3 given, 1 received

Question going by tick

I am new to NinjaTrader but know C# and need some advice.

I want to run a strategy that relies on the previous 2 5000 tick bars. However I don't really want to do it by bar, I want to have a moving window of the last 5000 ticks and the 5000-10000th ticks. So what I was doing is just keeping a list of my own of these ticks.

 
Code
public class scalper : Strategy
{
List<double> barFar = new List<double>();
List<double> barNear = new List<double>();


.....
protected override void Initialize()
        {
            CalculateOnBarClose = false;
            EntryHandling        = EntryHandling.UniqueEntries;
        }

protected override void OnBarUpdate()
{
double curPrice = Close[0];
            numTicks++;
            
            barNear.Add(curPrice);
            
            while(barNear.Count > ticksTimeFrame)
            {
                barFar.Add(barNear[0]);
                barNear.RemoveAt(0);
            }
            
            while(barFar.Count > ticksTimeFrame)
            {
                barFar.RemoveAt(0);
            }
            
            List<double> barFarCopy = new List<double>(barFar);
            List<double> barNearCopy = new List<double>(barNear);
            
            if(barFar.Count == ticksTimeFrame && barNear.Count == ticksTimeFrame)
            {
                
                barFarCopy.Sort();
                barNearCopy.Sort();
                double barNearMid = Math.Min(barNearCopy[0], barNearCopy[barNearCopy.Count - 1]) + Math.Abs(barNearCopy[0] - barNearCopy[barNearCopy.Count - 1]);

                double barFarMid = Math.Min(barFarCopy[0], barFarCopy[barFarCopy.Count - 1]) + Math.Abs(barFarCopy[0] - barFarCopy[barFarCopy.Count - 1]);
Will this just keep the last 2 windows of ticks and find their middle price?

Thanks
-Jeff

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)
Trading for Fun
Dallas TX/USA
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: AMP/CQG
Favorite Futures: ES
 
Posts: 154 since Jun 2009
Thanks: 33 given, 281 received



jeffbg123 View Post
Will this just keep the last 2 windows of ticks and find their middle price?

well you generally don't need to copy and then sort 10k-sized lists on every tick when all you want is the average of their largest and smallest values. As a first step you can just scan the list and locate the high and low in O(n) time. If you'd like to do better than that, I've written up an algorithm for maintaining a sorted sliding window with expected O(n/2) performance, which is article #5 on this page: Move the Markets| Articles.

I guess I wasn't totally clear on if you wanted the median, or the midpoint. Assuming the latter, then you'd want (H+L)/2... but as far as I can tell your code doesn't do that. It seems to be calculating Min(L, L + Abs(L - H))... which would always evaluate to L.

Hope this helps.

Reply With Quote

Reply



futures io > > > > > Question going by tick

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
CL question about how much per tick skyfly Traders Hideout 3 April 16th, 2011 04:10 AM
trying to make a chartinig program that goes through data tick by tick acdrew0 Platforms and Indicators 11 January 27th, 2011 01:55 PM
Tick charts question martifc Traders Hideout 3 January 21st, 2011 12:43 PM
Intrabarpersist and Historical tick data Question marketstudent EasyLanguage Programming 2 August 13th, 2010 03:07 PM
historical tick by tick market for many European mea109 Traders Hideout 2 December 7th, 2009 11:00 AM


All times are GMT -4. The time now is 10:49 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.08 seconds with 19 queries on phoenix via your IP 54.90.207.75