SuperTrendU11 Strategy Query - NinjaTrader Programming | futures io social day trading
futures io futures trading


SuperTrendU11 Strategy Query
Updated: Views / Replies:1,875 / 14
Created: by sburtt Attachments:3

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
 3  
 
Thread Tools Search this Thread
 

SuperTrendU11 Strategy Query

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

SuperTrendU11 Strategy Query

Hi All,

I am trying to use the SuperTrendU11 indicator as a stop loss in my strategy.

However I need the uptrend and downtrend lines (respectively my short stop loss and long stop loss) to be generated only when my strategy enters position. e.i. my strategy is a MovingAverageCrossOver, I would need SuperTrendU11 to switch from uptrend to downtrend on the MovingAverageCrossOver. Is this possible?

Could somebody please indicate me what part of the code I must modify in order to make this possible.

Thanks!

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
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


I don't have NT installed anymore, but I would try adding the condition to the supertrend code and then replace the two parts highlighted here with that condition

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


Anyone feel free to correct me, but I think something like this will work,

 
Code
bool UP = EMA(13)[0] > EMA(21)[0];
bool DOWN = EMA(13)[0] < EMA(21)[0];

else 
			{
				if (priorUpTrend && DOWN)
					currentUpTrend = false;
				else if (!priorUpTrend && UP)
					currentUpTrend = true;
				else
					currentUpTrend = priorUpTrend;
			}

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


vegasfoster View Post
I don't have NT installed anymore, but I would try adding the condition to the supertrend code and then replace the two parts highlighted here with that condition

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


Anyone feel free to correct me, but I think something like this will work,

 
Code
bool UP = EMA(13)[0] > EMA(21)[0];
bool DOWN = EMA(13)[0] < EMA(21)[0];

else 
			{
				if (priorUpTrend && DOWN)
					currentUpTrend = false;
				else if (!priorUpTrend && UP)
					currentUpTrend = true;
				else
					currentUpTrend = priorUpTrend;
			}

I used this
 
Code
			else 
			{
				if (priorUpTrend && CrossBelow(EMA(13),EMA(21),1))
					currentUpTrend = false;
				else if (!priorUpTrend && CrossAbove(EMA(13),EMA(21),1))
					currentUpTrend = true;
				else
					currentUpTrend = priorUpTrend;
as the bool was giving me an error, not sure why.

does it make anydifference if I use CrossAbove rather than >? graphically looks the same

THANKS FOR YOUR HELP


Last edited by sburtt; May 27th, 2013 at 06:14 PM.
Reply With Quote
 
  #5 (permalink)
Elite Member
London, UK
 
Futures Experience: Advanced
Platform: NinjaTrader
Favorite Futures: EUR/USD
 
Posts: 58 since Jul 2012
Thanks: 3 given, 4 received

Would somebody know how to use the SuperTrend as a stoploss?

I am using this code, but in multiple occasions my strategy enters an exits at exactly the same time, not what I would like it to do (see below)

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


Clearly i am not doing it right, I would appreciate if you had any tips.
Thanks

 
Code
        protected override void OnBarUpdate()
        {				
			if (Position.MarketPosition != MarketPosition.Long)
			{
				SetStopLoss(CalculationMode.Price,Instrument.MasterInstrument.Round2TickSize(anaSuperTrendU11(24, 9, 4, false, anaSuperTrendU11BaseType.TEMA, anaSuperTrendU11OffsetType.Default, anaSuperTrendU11VolaType.Standard_Deviation).StopLine[0]));
			}

Reply With Quote
 
  #6 (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,366 since Jun 2009
Thanks: 3,572 given, 3,982 received

You can try this:
 
Code
                            
Print(Instrument.MasterInstrument.Round2TickSize(anaSuperTrendU11(2494falseanaSuperTrendU11BaseType.TEMAanaSuperTrendU11OffsetType.Default, anaSuperTrendU11VolaType.Standard_Deviation).StopLine[0]))) 

That should help the debugging process.

Success requires no deodorant! (Sun Tzu)
Reply With Quote
 
  #7 (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

My initial thought is that the strategy code is calculating before the supertrend has a chance to flip over and so it is entering and then immediately getting the signal to exit because the supertrend is still in the opposite state. In Sierra Chart you can control precedence to determine if this is the problem, but I am not sure how to do it in NT. Or...???

Reply With Quote
 
  #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
You can try this:
 
Code
                            
Print(Instrument.MasterInstrument.Round2TickSize(anaSuperTrendU11(2494falseanaSuperTrendU11BaseType.TEMAanaSuperTrendU11OffsetType.Default, anaSuperTrendU11VolaType.Standard_Deviation).StopLine[0]))) 

That should help the debugging process.

sam028, thanks. whereabouts in the code should I include this script? and what exactly would this help doing? I am just asking because I would like to learn

thanks

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


vegasfoster View Post
My initial thought is that the strategy code is calculating before the supertrend has a chance to flip over and so it is entering and then immediately getting the signal to exit because the supertrend is still in the opposite state. In Sierra Chart you can control precedence to determine if this is the problem, but I am not sure how to do it in NT. Or...???

it could be the case, but in theory the script should not action on the same timeframe, as it has a Position.MarketPosition check

Reply With Quote
 
  #10 (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


IC, I dunno then.

Reply With Quote

Reply



futures io > > > > > SuperTrendU11 Strategy Query

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
SuperTrendU11 backtesting GaryD NinjaTrader Programming 8 December 8th, 2014 05:25 PM
Three Line Break on FX Query Zhorny MultiCharts 1 November 21st, 2012 06:12 AM
Direct query for account balance? drmartell Reviews of Brokers and Data Feeds 4 November 15th, 2012 02:01 PM
Using Excel to query MySQL database Big Mike The Elite Circle 3 November 7th, 2012 08:40 AM
Database - A Simple Query ab456 Traders Hideout 1 October 15th, 2011 03:04 PM


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