SuperTrendU11 Strategy Query - futures io
futures io futures trading



SuperTrendU11 Strategy Query


Discussion in NinjaTrader

Updated by sburtt
      Top Posters
    1. looks_one sburtt with 8 posts (0 thanks)
    2. looks_two vegasfoster with 3 posts (0 thanks)
    3. looks_3 sam028 with 2 posts (0 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 2,566 views
    2. thumb_up 1 thanks given
    3. group 4 followers
    1. forum 14 replies
    2. attach_file 3 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 100,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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

(If you already have an account, login at the top of the page)

 
Thread Tools Search this Thread
 

SuperTrendU11 Strategy Query

  #1 (permalink)
London, UK
 
Experience: Advanced
Platform: NinjaTrader
Trading: 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

Can you help answer these questions
from other members on futures io?
Convert NinjaTrader NT7 indicator to Tradestation EasyLanguage and RADARSCREEN
Platforms and Indicators
Issue meeting order entry conditions
Elite Automated NinjaTrader Trading
Last 5 minutes Label
ThinkOrSwim
Moving average with Lag reduction
NinjaTrader
Linux?
ThinkOrSwim
 
Best Threads (Most Thanked)
in the last 7 days on futures io
June Charity Fundraiser - Feeding hungry families
50 thanks
Spoo-nalysis ES e-mini futures S&P 500
45 thanks
FIO Journal Challenge - June 2020 edition w/SharkIndicators
41 thanks
Fixed vs trailing stops
30 thanks
AMP Futures / AMP Global Review
26 thanks
 
  #3 (permalink)
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
 
Posts: 1,147 since Feb 2010
Thanks: 304 given, 837 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



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)
London, UK
 
Experience: Advanced
Platform: NinjaTrader
Trading: 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



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 05:14 PM.
Reply With Quote
 
  #5 (permalink)
London, UK
 
Experience: Advanced
Platform: NinjaTrader
Trading: 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)



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
Rennes France
 
Experience: Advanced
Platform: NinjaTrader
Broker: IB/Kinetick
Trading: Futures
 
sam028's Avatar
 
Posts: 3,617 since Jun 2009
Thanks: 3,755 given, 4,420 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)
Follow me on Twitter Reply With Quote
 
  #7 (permalink)
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
 
Posts: 1,147 since Feb 2010
Thanks: 304 given, 837 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)
London, UK
 
Experience: Advanced
Platform: NinjaTrader
Trading: 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)
London, UK
 
Experience: Advanced
Platform: NinjaTrader
Trading: 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)
las vegas
 
Experience: Intermediate
Platform: Sierra Chart
Broker: Velocity/IB
Trading: 6E
 
Posts: 1,147 since Feb 2010
Thanks: 304 given, 837 received


IC, I dunno then.

Reply With Quote



futures io Trading Community Platforms and Indicators NinjaTrader > SuperTrendU11 Strategy Query




Upcoming Webinars and Events
 

Free BloodHound Licenses to everyone!

June
 

Every journal equals ten meals for the hungry

June
     



Copyright © 2020 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