Multi Time Frames - Ninja Trader - NinjaTrader | futures io social day trading
futures io futures trading


Multi Time Frames - Ninja Trader
Updated: Views / Replies:4,499 / 9
Created: by jdumanic Attachments:5

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
 

Multi Time Frames - Ninja Trader

  #1 (permalink)
Trading Apprentice
Zagreb, Croatia
 
Futures Experience: Intermediate
Platform: NinjaTrader, Prodigio
Favorite Futures: Stocks
 
Posts: 5 since Jun 2011
Thanks: 3 given, 2 received

Multi Time Frames - Ninja Trader

I really have a hard time figuring out how to use Filters in my Strategy which have different time frames than my primary indicators.

For example, I want to trade using 5 min price bars indicators, but only during those days when 10 DAY moving average > 50 DAY moving average (Filter).

Hence, my trouble is setting up Filters using DayPeriods while other indicators should have MinutePeriods. Any ides?

Thanx

Jere

Reply With Quote
 
  #2 (permalink)
Elite Member
las vegas
 
Futures Experience: Intermediate
Platform: Sierra Chart
Broker/Data: Velocity/IB
Favorite Futures: 6E
 
Posts: 1,147 since Feb 2010
Thanks: 304 given, 836 received

Answer
This post has been selected as an answer to the original posters question Answer

Taken from the ninjatrader help file for the add() function.

 
Code
protected override void Initialize()
{
    // Add a 5 minute Bars object - BarsInProgress index = 1 
    Add(PeriodType.Minute, 5);
 
    // Add a 100 tick Bars object for the ES 12-06 contract - BarsInProgress index = 2 
    Add("ES 12-06", PeriodType.Tick, 100); 
} 
 
protected override void OnBarUpdate() 
{ 
    // Ignore bar update events for the supplementary Bars object added above 
    if (BarsInProgress == 1 || BarsInProgress == 2)
        return; 
 
    // Go long if we have three up bars on all bars objects 
    if (Close[0] > Open[0] && Closes[1][0] > Opens[1][0] && Closes[2][0] > Opens[2][0]) 
         EnterLong();
}

Reply With Quote
The following 2 users say Thank You to vegasfoster 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,238 since Jun 2009
Thanks: 29,350 given, 83,218 received



jdumanic View Post
I really have a hard time figuring out how to use Filters in my Strategy which have different time frames than my primary indicators.

For example, I want to trade using 5 min price bars indicators, but only during those days when 10 DAY moving average > 50 DAY moving average (Filter).

Hence, my trouble is setting up Filters using DayPeriods while other indicators should have MinutePeriods. Any ides?

Thanx

Jere



Have you looked at the other examples found by using the search feature?
Please register on futures.io to view futures trading content such as post attachment(s), image(s), and screenshot(s).


How to search:
https://futures.io/help-tutorials-how-tos/6664-how-search-big-mike-trading.html

Post your code so we can see how far you are and where you are stuck.

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
 
  #4 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,599 received
Forum Reputation: Legendary


jdumanic View Post
I really have a hard time figuring out how to use Filters in my Strategy which have different time frames than my primary indicators.

For example, I want to trade using 5 min price bars indicators, but only during those days when 10 DAY moving average > 50 DAY moving average (Filter).

Hence, my trouble is setting up Filters using DayPeriods while other indicators should have MinutePeriods. Any ides?

Thanx

Jere

The use of daily price bars in parallel with intraday price bars in NinjaTrader is probelmatic. Let me give an example first:


Example 1: segmented session


Chart 1 shows a multi bar series chart of YM 06-11. The session template divides the day into 2 subsessions, the night session and the day session. The daily data comes from Kinetick EOD.

Problem here is that the daily bars are time-stamped at 15:30 CET (Central European Time). This is the start of the RTH session. The correct time-stamp would be 22:15 CET. As you can see from the indicator that I added on the chart, it does not display the daily close (settlement) of the pior day correctly.


Example 2: non-segmented session

Chart 2 uses a non-segmented session template, which means one session per trading day. As you can see the time-stamp of the daily bars are correct and the daily data is added correctly.


Conclusion

If you want to add daily data to an intraday data bar series you should pay attention that the session template under instrument settings is non-segmented, otherwise NinjaTrader will not add daily data properly.

Have you considered the option to add minute bars with a bar period of 1440 minutes? You would be on the safe side.

I have added the indicator below, which you can use to test the behavior on NinjaTrader.

Attached Thumbnails
Multi Time Frames - Ninja Trader-ym-segmented-session.jpg   Multi Time Frames - Ninja Trader-ym-non-segemented-session.jpg  
Attached Files
Register to download File Type: zip PriorDaySettlementSync.zip (1.8 KB, 41 views)

Last edited by Fat Tails; June 9th, 2011 at 09:18 AM.
Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #5 (permalink)
Trading Apprentice
Zagreb, Croatia
 
Futures Experience: Intermediate
Platform: NinjaTrader, Prodigio
Favorite Futures: Stocks
 
Posts: 5 since Jun 2011
Thanks: 3 given, 2 received

@Fat Tails

Thanx for the effort. However, my problem is not displaying data on the chart ... it's rather about computing data using different Time Values and using it as a Filter. For example, if I set a Filter to trade only during those days when Price (5 min) > SMA10 (days) > SMA50 (days), than I need to access the value of 3 variables (Price is minute based, while SMA is based on daily closing prices). Unfortunately, after reading all related materials on this Board, I still don't know how to do it.


It would be a lot easier if Ninja Trader guys would just insert the „Time Value“ field within each Parameter, so you can choose individual values for each indicator, instead of having only one „Period Value“ for all Parameters.


Cheers.

Reply With Quote
The following user says Thank You to jdumanic for this post:
 
  #6 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,599 received
Forum Reputation: Legendary


jdumanic View Post
@Fat Tails

Thanx for the effort. However, my problem is not displaying data on the chart ... it's rather about computing data using different Time Values and using it as a Filter. For example, if I set a Filter to trade only during those days when Price (5 min) > SMA10 (days) > SMA50 (days), than I need to access the value of 3 variables (Price is minute based, while SMA is based on daily closing prices). Unfortunately, after reading all related materials on this Board, I still don't know how to do it.


It would be a lot easier if Ninja Trader guys would just insert the „Time Value“ field within each Parameter, so you can choose individual values for each indicator, instead of having only one „Period Value“ for all Parameters.


Cheers.

Whether you use an indicator on a chart or use a strategy without a chart, the instrument will use its underlying session template. I only wanted to show that there is a NinjaTrader bug, which prevents the use of daily bars and intraday bars, if you use a segmented session template. Just used the chart, because it explains the problem better than lots of data extracted from a strategy.

In case that you use a simple session template there is no problem and it is feasible.

If you describe a simple strategy, I can have a look at it.

Reply With Quote
 
  #7 (permalink)
Trading Apprentice
Zagreb, Croatia
 
Futures Experience: Intermediate
Platform: NinjaTrader, Prodigio
Favorite Futures: Stocks
 
Posts: 5 since Jun 2011
Thanks: 3 given, 2 received


vegasfoster View Post
Taken from the ninjatrader help file for the add() function.

 
Code
protected override void Initialize()
{
    // Add a 5 minute Bars object - BarsInProgress index = 1 
    Add(PeriodType.Minute, 5);
 
    // Add a 100 tick Bars object for the ES 12-06 contract - BarsInProgress index = 2 
    Add("ES 12-06", PeriodType.Tick, 100); 
} 
 
protected override void OnBarUpdate() 
{ 
    // Ignore bar update events for the supplementary Bars object added above 
    if (BarsInProgress == 1 || BarsInProgress == 2)
        return; 
 
    // Go long if we have three up bars on all bars objects 
    if (Close[0] > Open[0] && Closes[1][0] > Opens[1][0] && Closes[2][0] > Opens[2][0]) 
         EnterLong();
}

Thanx for the info.

Btw, when I do all this the Ninja Script sends an "error" message, so most likely I'm doing something wrong. Programming in C.# is really difficult (and frustrating) for someone w/o any programming experience (:

Reply With Quote
 
  #8 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,651 since Mar 2010
Thanks: 4,226 given, 25,599 received
Forum Reputation: Legendary


jdumanic View Post
Thanx for the info.

Btw, when I do all this the Ninja Script sends an "error" message, so most likely I'm doing something wrong. Programming in C.# is really difficult (and frustrating) for someone w/o any programming experience (:

It is a long way to go, I am not a programmer either. Best you buy a book with the basic stuff (250 pages), work through it, install the free Microsoft Visual C# Express Edition and go through all the exercises in this book. Once you have done that, progress will be fast, you just need to look how others are coding indicators and strategies and copy and paste. After some time the copy and paste approach will automatically vanish and be replaced with your own ideas and coding style.

Reply With Quote
 
  #9 (permalink)
Elite Member
Tucson, AZ
 
Futures Experience: Intermediate
Platform: Ninjatrader
Broker/Data: Mirus/Zen-Fire
Favorite Futures: CL, TF
 
LostTrader's Avatar
 
Posts: 74 since Sep 2009
Thanks: 21 given, 62 received

Answer
This post has been selected as an answer to the original posters question Answer


jdumanic View Post
For example, I want to trade using 5 min price bars indicators, but only during those days when 10 DAY moving average > 50 DAY moving average (Filter).

If the second post did not answer your question, then try studying this indicator code. All it does is add a second bar series, use that second series as the input to two SMA functions and save the comparison result, which is available as an external variable.

You can apply the same principle in your strategy code.

Bear in mind that this does not address the concern that Fat Tails raised: regardless of where you use the data (chart or strategy code) if you are not careful with your session template, the data will be wrong.

Attached Files
Register to download File Type: zip jereFilter.zip (4.2 KB, 91 views)
Reply With Quote
The following 2 users say Thank You to LostTrader for this post:
 
  #10 (permalink)
Trading Apprentice
Zagreb, Croatia
 
Futures Experience: Intermediate
Platform: NinjaTrader, Prodigio
Favorite Futures: Stocks
 
Posts: 5 since Jun 2011
Thanks: 3 given, 2 received



LostTrader View Post
If the second post did not answer your question, then try studying this indicator code. All it does is add a second bar series, use that second series as the input to two SMA functions and save the comparison result, which is available as an external variable.

You can apply the same principle in your strategy code.

Bear in mind that this does not address the concern that Fat Tails raised: regardless of where you use the data (chart or strategy code) if you are not careful with your session template, the data will be wrong.


This helps a lot. I understand the script logic much better now. Big thanx

Reply With Quote

Reply



futures io > > > > Multi Time Frames - Ninja Trader

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
Powerlanguage and Multi time frames Laurent EasyLanguage Programming 10 December 2nd, 2016 03:54 AM
ninja 7 info on multiple time frames for indicators jrs659 NinjaTrader 6 August 16th, 2011 02:16 PM
Bug in Ninja Trader time and sales? Bob324 NinjaTrader 5 July 8th, 2011 11:20 AM
I think Ninja trader drops ticks real time gomi NinjaTrader Programming 2 November 23rd, 2010 11:50 PM
Multi time frames in one chart emini_Holy_Grail NinjaTrader 1 December 16th, 2009 08:09 AM


All times are GMT -4. The time now is 08:59 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.15 seconds with 40 queries on phoenix via your IP 54.83.122.227