Multi Time Frame Clarification - NinjaTrader | futures.io
futures io futures trading


Multi Time Frame Clarification
Started: by resirca52009 Views / Replies:121 / 1
Last Reply: Attachments:5

Welcome to futures io.

Welcome, Guest!

This forum was established to help traders (especially futures traders) by openly sharing indicators, strategies, methods, trading journals and discussing the psychology of trading.

We are fundamentally different than most other trading forums:
  • We work extremely hard to keep things positive on our forums.
  • We do not tolerate rude behavior, trolling, or vendor advertising in posts.
  • We firmly believe in openness and encourage sharing. The holy grail is within you, it is not something tangible you can download.
  • 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, and we will never resell your private information.

-- Big Mike

Reply
 
Thread Tools Search this Thread
 

Multi Time Frame Clarification

  #1 (permalink)
Elite Member
Indianapolis, Indiana/ USA
 
Futures Experience: Advanced
Platform: MT4, Ninjatrader
Broker/Data: AMP / CQG
Favorite Futures: Futures
 
Posts: 43 since Oct 2012
Thanks: 108 given, 11 received

Multi Time Frame Clarification

Can someone clarify the following for me. See my text annotations scattered throughout :

Below is the code from the NT 7 Sample Multi Time Frame

public class SampleMultiTimeFrame : Strategy
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion

/// <summary>
/// This method is used to configure the strategy and is called once before any strategy method is called.
/// </summary>
protected override void Initialize()
{
// Add a 5 minute Bars object to the strategy
Add(PeriodType.Minute, 5);

// Add a 15 minute Bars object to the strategy
Add(PeriodType.Minute, 15);

// Note: Bars are added to the BarsArray and can be accessed via an index value
// E.G. BarsArray[1] ---> Accesses the 5 minute Bars object added above

// Add simple moving averages to the chart for display
// This only displays the SMA's for the primary Bars object on the chart
Add(SMA(5));
Add(SMA(50));

CalculateOnBarClose = true;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
// OnBarUpdate() will be called on incoming tick events on all Bars objects added to the strategy
// We only want to process events on our primary Bars object (index = 0) which is set when adding
// the strategy to a chart
if (BarsInProgress != 0)
return; //So I set the strategy on a 30 minute chart; this becomes the primary series.

// Checks if the 5 period SMA is above the 50 period SMA on both the 5 and 15 minute time frames
if (SMA(BarsArray[1], 5)[0] > SMA(BarsArray[1], 50)[0] && SMA(BarsArray[2], 5)[0] > SMA(BarsArray[2], 50)[0])
{
// Checks for a cross above condition of the 5 and 50 period SMA on the primary Bars object and enters long
if (CrossAbove(SMA(5), SMA(50), 1))
EnterLong(1000, "SMA");
}
// This states below that the 5 and 15 period SMA on the 15 minute time frame but the code says 5 and 50 period SMA
//on the 15 minute time frame, minor typo, the code appears legitimate.
// Checks for a cross below condition of the 5 and 15 period SMA on the 15 minute time frame and exits long
if (CrossBelow(SMA(BarsArray[2], 5), SMA(BarsArray[2], 50), 1))
ExitLong(1000);
}

#region Properties
#endregion

See my screen shots below which highlight my confusion :

I could not get my multi time frame code to work so I decided to go back and
test the Sample Multi Frame code in NT from which I drew my inspiration.
Here a trade is fired off on 12/18 @ 6pm on the primary series ( 30 min ).
All code seems correct for the entry -
Inline image 1


// Checks if the 5 period SMA is above the 50 period SMA on both the 5 and 15 minute time frames
if (SMA(BarsArray[1], 5)[0] > SMA(BarsArray[1], 50)[0] && SMA(BarsArray[2], 5)[0] > SMA(BarsArray[2], 50)[0])

The prior code statement is validated by the next two screen shots :
5 minute - 12/18 @ 6 pm
Inline image 2


15 minute - 12/18 @ 6 pm
Inline image 3

What I am confused about is the exit.According to the following code :

// Checks for a cross below condition of the 5 and 15 ( supposed to say 50 ) period SMA on the 15 minute time frame and exits long
if (CrossBelow(SMA(BarsArray[2], 5), SMA(BarsArray[2], 50), 1))
ExitLong(1000);

This should exit when the 5 SMA crosses below the 50 SMA on the 15 minute
time frame. You can see below on the primary series chart it runs for several days.

Inline image 4


In the following screenshot the 5 SMA color has been changed to Fuschia
for clarity. You can see that the 5 SMA crosses below the 50 SMA on the
15 minute time frame at approx 5:15 am on the 19th and not the 21st as
shown on the primary series ( 30 min ). Am I misinterpreting something here
or is there another issue ?



Inline image 5

Thanks for your time and help,
Richard

Reply With Quote
 
  #2 (permalink)
Elite Member
Indianapolis, Indiana/ USA
 
Futures Experience: Advanced
Platform: MT4, Ninjatrader
Broker/Data: AMP / CQG
Favorite Futures: Futures
 
Posts: 43 since Oct 2012
Thanks: 108 given, 11 received

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

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

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

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

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

Reply With Quote

Reply



futures io > > > > Multi Time Frame Clarification

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)
 

NinjaTrader 8: Tips and Tricks (part 2)

Mar 2
 

An Afternoon With FIO member @michaelleemoore

Elite only
 

Jigsaw Trading: Keys to successfully trading the open

Mar 9

Macro view: Trump Market Risk w/Piers Curran @ Amplify Trading

Elite only

Reading the Psychology of the Market w/Brett Steenbarger & Trading Technologies

Elite only

Hybrid Machine Learning (R and TradeStation) w/Murray Ruggiero

Elite only

Spring Grains Outlook w/Sean Lusk @ Walsh Trading

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Stochastics multi time frame ? curleta NinjaTrader 3 September 24th, 2015 07:23 AM
multi time frame indicator lags microsat NinjaTrader Programming 5 September 21st, 2015 12:16 PM
R Quantstrat and multi time frame pipsalottle Matlab, R project and Python 3 June 2nd, 2015 09:51 PM
multi time-frame questions -- this is different balance NinjaTrader Programming 4 January 12th, 2013 03:27 AM
ADX Multi Time Frame bellair NinjaTrader 9 November 10th, 2011 11:14 AM


All times are GMT -4. The time now is 05:06 AM.

no new posts
Page generated 2017-02-25 in 0.10 seconds with 24 queries on phoenix via your IP 54.211.182.82