SuperTrendU11 backtesting - NinjaTrader Programming | futures io social day trading
futures io futures trading


SuperTrendU11 backtesting
Updated: Views / Replies:2,269 / 8
Created: by GaryD Attachments:2

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
 

SuperTrendU11 backtesting

  #1 (permalink)
User requested to be banned
Orlando, Florida
 
Futures Experience: None
Platform: shoes
Favorite Futures: happy
 
GaryD's Avatar
 
Posts: 6,462 since May 2011
Thanks: 2,090 given, 5,027 received

SuperTrendU11 backtesting

Can anyone explain how to use the indicator "SuperTrendU11" in a simple backtest? I am trying to understand the three settings it offers.

Beyond that, if you know;

1) Can you test just a simple crossover backtest?

and,

2) Can you use it as a trailing stop in a backtest?

and,

3) A real bonus would be if there is a way to have the "Baseline Smoothing" type also be a backtest variable?

Thanks to anyone who can help with this.

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

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


@GaryD :

1) yes, you can test a crossover

2) yes, you can use it as a trailing stop

3) yes, you can select the moving average and offset type

But you need to code the strategy for a backtest.

If you call the SuperTrendU11 from a strategy, you need to

- declare the parameters under variables
- declare the SuperTrend under variables
- then call the SuperTrend in Initialize

Example:

 
Code
#region Variables
private double	multiplier = 2.5; 
private int basePeriod = 13;
private int rangePeriod = 14;       
private bool reverseIntraBar = false;
private anaSuperTrendU11BaseType thisBaseType	= anaSuperTrendU11BaseType.Median; 
private anaSuperTrendU11OffsetType thisOffsetType = anaSuperTrendU11OffsetType.Median; 
private anaSuperTrendU11VolaType thisVolaType = anaSuperTrendU11VolaType.True_Range; 
Indicator.anaSuperTrendU11 mySTU = null;

protected override void Initialize()
{
   mySTU = anaSuperTrendU11(basePeriod, multiplier, rangePeriod, reverseIntraBar, thisBaseType, thisOffsetType, thisVolaType);
...
}

Now, if you want to access the parameters of the strategy for a backtest, you need to serialize them within the strategy.

That is about all.


P.S: I have updated the anaSuperTrendU11 today, as it did not catch the correct baseline period for the Butterworth, Gauss and Supersmoother filters. Please download it again.


Last edited by Fat Tails; July 4th, 2012 at 08:57 PM.
Reply With Quote
The following 3 users say Thank You to Fat Tails for this post:
 
  #4 (permalink)
User requested to be banned
Orlando, Florida
 
Futures Experience: None
Platform: shoes
Favorite Futures: happy
 
GaryD's Avatar
 
Posts: 6,462 since May 2011
Thanks: 2,090 given, 5,027 received


Fat Tails View Post
@GaryD :

1) yes, you can test a crossover

2) yes, you can use it as a trailing stop

3) yes, you can select the moving average and offset type

But you need to code the strategy for a backtest.

If you call the SuperTrendU11 from a strategy, you need to

- declare the parameters under variables
- declare the SuperTrend under variables
- then call the SuperTrend in Initialize

Example:

 
Code
#region Variables
private double	multiplier = 2.5; 
private int basePeriod = 13;
private int rangePeriod = 14;       
private bool reverseIntraBar = false;
private anaSuperTrendU11BaseType thisBaseType	= anaSuperTrendU11BaseType.Median; 
private anaSuperTrendU11OffsetType thisOffsetType = anaSuperTrendU11OffsetType.Median; 
private anaSuperTrendU11VolaType thisVolaType = anaSuperTrendU11VolaType.True_Range; 
Indicator.anaSuperTrendU11 mySTU = null;

protected override void Initialize()
{
   mySTU = anaSuperTrendU11(basePeriod, multiplier, rangePeriod, reverseIntraBar, thisBaseType, thisOffsetType, thisVolaType);
...
}

Now, if you want to access the parameters of the strategy for a backtest, you need to serialize them within the strategy.

That is about all.


P.S: I have updated the anaSuperTrendU11 today, as it did not catch the correct baseline period for the Butterworth, Gauss and Supersmoother filters. Please download it again.




That is how YOU do it... lol!

For a guy who barely understands anything about programming language, is there a simpler way? or am I making it complicated?

Oh, and I now see the gauss baseline thing, may be a problem I was seeing. Thanks so much.

Reply With Quote
 
  #5 (permalink)
User requested to be banned
Orlando, Florida
 
Futures Experience: None
Platform: shoes
Favorite Futures: happy
 
GaryD's Avatar
 
Posts: 6,462 since May 2011
Thanks: 2,090 given, 5,027 received

I figured it out. It took a few tries to determine what I was looking for, but I managed to get the SuperTrend to function in a backtest for entries and/or exits. I was calling for price to be above, below, equal, etc, and it did not work, but it took at "crosses..."

Reply With Quote
 
  #6 (permalink)
Elite Member
London, UK
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: EUR/USD
 
Posts: 58 since Jul 2012
Thanks: 3 given, 4 received


Fat Tails View Post
@GaryD :

1) yes, you can test a crossover

2) yes, you can use it as a trailing stop

3) yes, you can select the moving average and offset type

But you need to code the strategy for a backtest.

If you call the SuperTrendU11 from a strategy, you need to

- declare the parameters under variables
- declare the SuperTrend under variables
- then call the SuperTrend in Initialize

Example:

 
Code
#region Variables
private double	multiplier = 2.5; 
private int basePeriod = 13;
private int rangePeriod = 14;       
private bool reverseIntraBar = false;
private anaSuperTrendU11BaseType thisBaseType	= anaSuperTrendU11BaseType.Median; 
private anaSuperTrendU11OffsetType thisOffsetType = anaSuperTrendU11OffsetType.Median; 
private anaSuperTrendU11VolaType thisVolaType = anaSuperTrendU11VolaType.True_Range; 
Indicator.anaSuperTrendU11 mySTU = null;

protected override void Initialize()
{
   mySTU = anaSuperTrendU11(basePeriod, multiplier, rangePeriod, reverseIntraBar, thisBaseType, thisOffsetType, thisVolaType);
...
}

Now, if you want to access the parameters of the strategy for a backtest, you need to serialize them within the strategy.

That is about all.


P.S: I have updated the anaSuperTrendU11 today, as it did not catch the correct baseline period for the Butterworth, Gauss and Supersmoother filters. Please download it again.

Hi Fat Tails,

sorry to bother you, but I am incurring in the following message error when attempting to optimize the values of anaSuperTrendU11 in StrategyAnalyzer:

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


Below is the code I am using, I would really appreciate if you could tell me what I am doing wrong. Thanksfor your help, and wish you a good day

 
Code
#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Indicator;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Strategy;
#endregion

namespace NinjaTrader.Strategy
{
    [Description("")]
    public class aaaAnaSuperTrendLong : Strategy
    {
    
        #region Variables
		
		private int period = 14;
		private int multiplier = 2;
		private int rngPeriod = 4;
		private bool reverseIntraBar = false;
		private anaSuperTrendU11BaseType thisBaseType	= anaSuperTrendU11BaseType.TEMA; 
		private anaSuperTrendU11OffsetType thisOffsetType = anaSuperTrendU11OffsetType.Default; 
		private anaSuperTrendU11VolaType thisVolaType = anaSuperTrendU11VolaType.Standard_Deviation; 
		Indicator.anaSuperTrendU11 mySTU = null;

        #endregion

        protected override void Initialize()
        {
			mySTU = anaSuperTrendU11(period, multiplier, rngPeriod, reverseIntraBar, thisBaseType, thisOffsetType, thisVolaType);
			Add(anaSuperTrendU11(period, multiplier, rngPeriod, reverseIntraBar, thisBaseType, thisOffsetType, thisVolaType));
            CalculateOnBarClose = true;
			EntryHandling 	=	EntryHandling.UniqueEntries;
			ExitOnClose = false;
		}
        
        protected override void OnBarUpdate()
        {							

			//StopLoss Reset
			if (Position.MarketPosition == MarketPosition.Flat)
				SetStopLoss(CalculationMode.Ticks,100);
				
			//Enter Long
			if (CrossAbove(...))
				EnterLong("Long");

			//Set StopLoss anaSuperTrendU11
			if (Position.MarketPosition == MarketPosition.Long)
             SetStopLoss(CalculationMode.Price,Instrument.MasterInstrument.Round2TickSize(anaSuperTrendU11(period, multiplier, rngPeriod, reverseIntraBar, thisBaseType, thisOffsetType, thisVolaType).StopDot[0]));
			
        }

        #region Properties
				
		[Description("")]
        [GridCategory("Parameters")]
        public int Period
        {
            get { return period; }
            set { period = Math.Max(0, value); }
        }
		
		[Description("")]
        [GridCategory("Parameters")]
        public int Multiplier
        {
            get { return multiplier; }
            set { multiplier = Math.Max(0, value); }
        }		
		
		[Description("")]
        [GridCategory("Parameters")]
        public int RngPeriod
        {
            get { return rngPeriod; }
            set { rngPeriod = Math.Max(0, value); }
        }		
	
		[Description("")]
        [GridCategory("Parameters")]
        public bool ReverseIntraBar
        {   get { return reverseIntraBar; }
            set { reverseIntraBar = value; }
        }
 		#endregion
    }
}

Reply With Quote
 
  #7 (permalink)
Administrator: Retired Backtester
 Vendor: speedytradingservers.com 
Rennes France
 
Futures Experience: Advanced
Platform: NinjaTrader
Broker/Data: IB/Kinetick
Favorite Futures: Futures
 
sam028's Avatar
 
Posts: 3,367 since Jun 2009
Thanks: 3,574 given, 3,983 received

Please show a screenshot of the parameters.
I replaced the "if (CrossAbove(...))" by an "if (true)", and the optimization works fine...

Success requires no deodorant! (Sun Tzu)
Reply With Quote
The following user says Thank You to sam028 for this post:
 
  #8 (permalink)
Elite Member
London, UK
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: EUR/USD
 
Posts: 58 since Jul 2012
Thanks: 3 given, 4 received


sam028 View Post
Please show a screenshot of the parameters.
I replaced the "if (CrossAbove(...))" by an "if (true)", and the optimization works fine...

effectively your right, i tried that, I was using the multiplier with a double instead of int value. thanks!

Reply With Quote
The following user says Thank You to sburtt for this post:
 
  #9 (permalink)
Elite Member
Olivos, Buenos Aires, _Argentina
 
Futures Experience: Intermediate
Platform: ninjatrader
Favorite Futures: futures
 
Posts: 34 since Nov 2014
Thanks: 10 given, 2 received

Hello guys ..

He has served this indicator ranges 1 minute, 3 minutes or f5 minutes?
that difference with the "chandelier stop" that also takes the trend?


they rank them work better? I have not tried it but I think it is not like any other trend indicator, I think it really is very good.

sorry for my English ..
thanks

Reply With Quote

Reply



futures io > > > > > SuperTrendU11 backtesting

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
Best Application for Backtesting? waverider Platforms and Indicators 20 August 14th, 2016 10:43 PM
Ninjatrader and backtesting ehlaban NinjaTrader Programming 3 December 15th, 2011 11:24 AM
Does backtesting work? mogplus8 Elite Automated Trading 41 August 3rd, 2011 10:48 AM
Backtesting Big Mike Terms (Glossary) 0 June 27th, 2010 06:42 AM
Help with backtesting nqemini Traders Hideout 5 January 16th, 2010 12:00 PM


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

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-18 in 0.14 seconds with 36 queries on phoenix via your IP 54.226.113.250