Creating your own dynamic bar period - NinjaTrader Programming | futures io social day trading
futures io futures trading


Creating your own dynamic bar period
Updated: Views / Replies:1,559 / 1
Created: by caprica 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
 

Creating your own dynamic bar period

  #1 (permalink)
Elite Member
USA
 
Futures Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 109 received

Creating your own dynamic bar period

Until/if NT7 ever gets here, I have been trying to create my own bars with dynamic sizing so my strategy can adjust the size of the bar on-the-fly.

I am talking about a dynamic equivalent to
Add(PeriodType.Volume, xxxxx);

Here is what I have but it is a rough draft and far from perfect. I am looking for suggestions from people who have done the same thing and have it working or know how to make it work.

The idea is once the procedure is written, it will be accessed instead of BarsArray[x]. ie:
old:
CustomCCI(BarsArray[3], CCIperiod, CCIsmooth, CCIpitch)
new:
dynamicbar.Set(DynamicPeriod("Volume", "Median", dynamicvolsize);
CustomCCI(dynamicbar, CCIperiod, CCIsmooth, CCIpitch)

 
Code
                            
protected double DynamicPeriod(string charttypestring bartypeint periodsize)

        {
            
double _retvalue     0;
            
double _tempvalue     0;
            
            try
            {
            
            if (
charttype == "Volume" && bartype == "High")
                {
                
int x 0;
                while ((
Volumes[1][x] + _tempvalue) < periodsize)
                    {
                        
_tempvalue += Volumes[1][x];
                        
x++;
                        
//Print(Time[0] + ": Volume of " + x + " = " + Volumes[1][x]);
                    
}
                
_retvalue MAX(Highs[1], x)[0];
                }
                
            if (
charttype == "Volume" && bartype == "Low")
                {
                
int x 0;
                while ((
Volumes[1][x] + _tempvalue) < periodsize)
                    {
                        
_tempvalue += Volumes[1][x];
                        
x++;
                        
//Print(Time[0] + ": Volume of " + x + " = " + Volumes[1][x]);
                    
}
                
_retvalue MIN(Lows[1], x)[0];
                }
                
            if (
charttype == "Volume" && bartype == "Median")
                {
                
_retvalue = (DynamicPeriod("Volume""High"periodsize) + DynamicPeriod("Volume""Low"periodsize)) / 2;
                }
                
            if (
charttype == "Volume" && bartype == "Time")
                {
                
int x 0;
                while ((
Volumes[1][x] + _tempvalue) < periodsize)
                    {
                        
_tempvalue += Volumes[1][x];
                        
x++;
                    }
                
_retvalue ToTime(Times[1][x]);
                }
                
            }
            catch(
Exception e)
            {
                
Log("Exception " eLogLevel.Error);
            }
            return 
_retvalue;
        } 

"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

Reply With Quote
 
  #2 (permalink)
Elite Member
USA
 
Futures Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 109 received

failed to mention BarsArray[1] in above example is my favored 1-range size Add(PeriodType.Range, 1); method.

"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

Reply With Quote

Reply



futures io > > > > > Creating your own dynamic bar period

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
Dynamic Properties baruchs NinjaTrader Programming 23 March 18th, 2017 11:02 AM
pivotindicator for a time period tulasi MetaQuotes MetaTrader MQL Programming 5 October 13th, 2015 02:36 AM
Cooling off period for trades krakken NinjaTrader Programming 4 August 16th, 2011 04:45 PM
Breakout after Congestion period emini_Holy_Grail Traders Hideout 3 May 9th, 2011 09:38 PM
RSI value for a previous period arjfca EasyLanguage Programming 4 November 9th, 2010 02:29 PM


All times are GMT -4. The time now is 10:41 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-13 in 0.07 seconds with 19 queries on phoenix via your IP 54.226.113.250