MultiTimeFrame getting wierd backtest results - NinjaTrader Programming | futures io social day trading
futures io futures trading


MultiTimeFrame getting wierd backtest results
Updated: Views / Replies:703 / 5
Created: by rymonroe Attachments:1

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
 

MultiTimeFrame getting wierd backtest results

  #1 (permalink)
Elite Member
Los Angeles, CA
 
Futures Experience: Beginner
Platform: NT
Favorite Futures: ES, ZN
 
rymonroe's Avatar
 
Posts: 15 since Nov 2012
Thanks: 5 given, 4 received

MultiTimeFrame getting wierd backtest results

I am creating a multi time-frame strategy with four time frames and two indicators
 
Code
                        Add(PeriodType.Minute,15);
			Add(PeriodType.Minute,30);
			Add(PeriodType.Minute,60);
			Add(PeriodType.Day, 1);
			Add(LongIndicator());
			Add(ShortIndicator);
In the onBarUpdate, I check for the primary bars (barsinprogress==0 return) and ignore it. When I backtest in 1 min ticks, I only get long trades. When I switch to 15 min, I get both. My questions is, are there 4 instances of each indicator running (5 if you count primary bars) when my strategy is active? I'm missing something but I just don't know what it is?

[NOTE]The Long and Short Indicators are not optimized in any way for multi-time frames. They were meant to be run in one time frame[/NOTE]

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)
Elite Member
Northern Germany
 
Futures Experience: Intermediate
Platform: NT
Favorite Futures: FDAX, CL
 
vvhg's Avatar
 
Posts: 1,583 since Mar 2011
Thanks: 1,016 given, 2,807 received



rymonroe View Post
I am creating a multi time-frame strategy with four time frames and two indicators
 
Code
                        Add(PeriodType.Minute,15);
			Add(PeriodType.Minute,30);
			Add(PeriodType.Minute,60);
			Add(PeriodType.Day, 1);
			Add(LongIndicator());
			Add(ShortIndicator);
In the onBarUpdate, I check for the primary bars (barsinprogress==0 return) and ignore it. When I backtest in 1 min ticks, I only get long trades. When I switch to 15 min, I get both. My questions is, are there 4 instances of each indicator running (5 if you count primary bars) when my strategy is active? I'm missing something but I just don't know what it is?

[NOTE]The Long and Short Indicators are not optimized in any way for multi-time frames. They were meant to be run in one time frame[/NOTE]

There will only be one instance, this method of adding indicators will just display them on the chart afaik.

vvhg

Hic Rhodos, hic salta.
Reply With Quote
 
  #4 (permalink)
Elite Member
Los Angeles, CA
 
Futures Experience: Beginner
Platform: NT
Favorite Futures: ES, ZN
 
rymonroe's Avatar
 
Posts: 15 since Nov 2012
Thanks: 5 given, 4 received


vvhg View Post
There will only be one instance, this method of adding indicators will just display them on the chart afaik.

vvhg

I don't think this is the case because when I call

 
Code
LongIndicator().BarsPeriod.Value
I get different results depending on what BarsInProgress is.

Reply With Quote
 
  #5 (permalink)
Elite Member
Los Angeles, CA
 
Futures Experience: Beginner
Platform: NT
Favorite Futures: ES, ZN
 
rymonroe's Avatar
 
Posts: 15 since Nov 2012
Thanks: 5 given, 4 received

SOLVED

I have found and solved the problem. I was setting avariable in the Short indicator, as seen below...

 
Code
                        Add(PeriodType.Minute,15);
			Add(PeriodType.Minute,30);
			Add(PeriodType.Minute,60);
			Add(PeriodType.Day, 1);
			Add(LongIndicator());
			Add(ShortIndicator());

                        ShortIndicator().shortVal = true;

From what I gather by debugging it, there were 5 instances of LongIndicator and 5 instances of ShortIndicator running in my strategy at any given time. The code you see above is from the Initialize method method and it turns out that I was changing the value of shortVal in only the primary bars (which is what called the Initialize method) and not the 15/30/60/day bars. This was causing my unexpected results and once I changed the default value of shortVal to true, everything worked fine.

Reply With Quote
 
  #6 (permalink)
Trading Apprentice
Dallas Texas United States
 
Futures Experience: Intermediate
Platform: Ninja Trader
Favorite Futures: Futures, TF, ES, YM, 6E
 
Posts: 5 since Apr 2014
Thanks: 1 given, 0 received

Clearly I'm screwing something up. The code below works partially. It appears to do everything except account for the EMA positions on the primary bars [0]. EMA 21 > EMA 34 for example.

It also freaks out and floods with placing and cancelling orders when I change the EnterLong or EnterShort to a limit order. The limit order is to be placed at the 13 MA, if that makes any difference.

/// <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(PeriodType.Tick, 2584);
Add(PeriodType.Second, 30);
Add(Swing(SwingStrength));

CalculateOnBarClose = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if (CurrentBars[0] <= BarsRequired || CurrentBars[1] <= BarsRequired || CurrentBars[2] <= BarsRequired)
return;
if(BarsInProgress !=0)
return;
if (EMA(BarsArray[1],8)[0] > EMA(BarsArray[1],13)[0] + 1 * TickSize && Stochastics(BarsArray[2],7, 23, 2).K[0] < 80)
{
if (EMA(21)[0] > EMA(34)[0]
&& ToTime(Time[0]) >= ToTime(7, 00, 0)
&& ToTime(Time[0]) < ToTime(15, 00, 0)
&& Close[0] > Swing(SwingStrength).SwingHigh[0] + 3 * TickSize)
EnterLong(OrderQty, "MA1");
DrawTriangleUp("My triangle up" + CurrentBar, false, 0, EMA(13)[0], Color.Green);
}

if(EMA(BarsArray[1],8)[0] < EMA(BarsArray[1],13)[0] + -1 * TickSize && Stochastics(BarsArray[2],7, 23, 2).K[0] > 20)
{
if (EMA(21)[0] < EMA(34)[0]
&& ToTime(Time[0]) >= ToTime(7, 00, 0)
&& ToTime(Time[0]) < ToTime(15, 00, 0)
&& Close[0] < Swing(SwingStrength).SwingLow[0] + -3 * TickSize);
EnterShort(OrderQty, "MA1");
DrawTriangleDown("My triangle down" + CurrentBar, false, 0, EMA(13)[0], Color.Crimson);
}

The flood of cancels also occurs when I attempt to add more exit and entry commands below the preceding script.

if (Position.MarketPosition == MarketPosition.Long
&& CrossBelow(Stochastics(BarsArray[2],7, 23, 2).K, 21, 1))
{
DrawTriangleUp("My triangle up" + CurrentBar, false, 0, Low[0] + -1 * TickSize, Color.Lime);
EnterLong(OrderQty, "O1");

Thank you in advance for any help.

Conrad
Skype: kconradbell

Attached Thumbnails
MultiTimeFrame getting wierd backtest results-ninjascriptcapture.png  
Reply With Quote

Reply



futures io > > > > > MultiTimeFrame getting wierd backtest results

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
Strategy #1 Backtest Results Journal MrYou Elite Automated NinjaTrader Trading 49 January 5th, 2013 07:01 PM
Cool Multitimeframe Chart MWinfrey NinjaTrader 45 February 20th, 2012 11:44 PM
Anyone want to backtest!!!!!!! incometrade Traders Hideout 7 September 22nd, 2010 10:42 PM
Multitimeframe backtest chart MyTraderAdvisor NinjaTrader Programming 3 July 25th, 2010 04:43 PM
Backtest Big Mike Terms (Glossary) 0 June 27th, 2010 02:28 PM


All times are GMT -4. The time now is 12:42 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.12 seconds with 20 queries on phoenix via your IP 54.82.79.109