NexusFi: Find Your Edge


Home Menu

 





Auto Trailing Stop Strategy


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one sandptrader with 8 posts (1 thanks)
    2. looks_two master trader with 3 posts (1 thanks)
    3. looks_3 MrYou with 1 posts (0 thanks)
    4. looks_4 Daytrader999 with 1 posts (2 thanks)
      Best Posters
    1. looks_one Hansen with 2 thanks per post
    2. looks_two Daytrader999 with 2 thanks per post
    3. looks_3 traderlange with 1 thanks per post
    4. looks_4 master trader with 0.3 thanks per post
    1. trending_up 13,765 views
    2. thumb_up 9 thanks given
    3. group 10 followers
    1. forum 19 posts
    2. attach_file 7 attachments




 
 

Auto Trailing Stop Strategy

 
 sandptrader 
Valdosta, GA. U.S.A
 
Experience: Advanced
Platform: Sierra , TOS
Trading: 6E, ES, CL, GC
Posts: 498 since Sep 2010
Thanks Given: 1,881
Thanks Received: 472

Here is another Trailing Stop Shell/Program
If anyone wants to work with this and try and see if it works reliably for Auto Trailing.
My Goal is to use any Program that would be Reliable for Auto Trailing your Stop, Preferably Parabolic Sar.
I have not found that Program yet, but wanted to post what i can find here at futures.io (formerly BMT) to see if i can get some help and maybe by way of a few folks Testing these Programs we could have a Decent Auto Trailing Stop for our Trading.
I have seen where i could have made so much more if i had this type program.
Anyone who wants to try these for Testing on Demo first and then make comments on their Reliability are welcome to Post.
Like i said before i am not a programmer, or do i know much at all about code, so i am asking for help.
One of these Programs may be what i am looking for to Trade GC & CL with an Auto Trailing Stop.
just now started to try an implement these into the platform, so i am a bit lost with using them.
Link to thread where i found this one, Post # 10.....https://nexusfi.com/ninjatrader-programming/3799-possible-trail-stop-per-parabolic-sar.html
Thanks for your help.

Attached Files
Elite Membership required to download: FDAX1LBtrail.zip
Elite Membership required to download: FDAX1LBtrail.cs
Started this thread

Can you help answer these questions
from other members on NexusFi?
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
Trade idea based off three indicators.
Traders Hideout
NT7 Indicator Script Troubleshooting - Camarilla Pivots
NinjaTrader
MC PL editor upgrade
MultiCharts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Diary of a simple price action trader
20 thanks
My NQ Trading Journal
19 thanks
Just another trading journal: PA, Wyckoff & Trends
17 thanks
Tao te Trade: way of the WLD
12 thanks
HumbleTraders next chapter
9 thanks
 
privacy8
Bogota, Cundinamarca, Colombia
 
Posts: 1 since Jul 2014
Thanks Given: 0
Thanks Received: 0

Hi,

I have programmed a trailing SAR stop for my strategy; i can modify it to suit your needs. Let me know if this still interests you.

 
 MrTrader 
ITAJAI SC/BRAZIL
 
Experience: Intermediate
Platform: NinjaTrader
Broker: Clear Corretora
Trading: DOLFUT, WINFUT
Posts: 334 since Jun 2014
Thanks Given: 1,318
Thanks Received: 226


Hi @privacy8,

If you could share your trailing solution I think it would be useful for others.
@pepbosch is a user i know is looking for this kind of solution. He asked for this a few days ago on other thread (want your strategy created free)

Thank you and best regards,

Thanked by:
 
 traderlange 
NY NY
 
Experience: Advanced
Platform: NinjaTrader
Broker: Amp/CQG
Trading: Futures - CL/GC/YM
Posts: 42 since Aug 2011
Thanks Given: 31
Thanks Received: 209

I built a PSAR trail into this: might help?

Visit my NexusFi Trade Journal
Thanked by:
 
Hansen
Freiburg, Germany
 
Posts: 1 since Apr 2012
Thanks Given: 1
Thanks Received: 1

You can add this to your strategy with the edit strategy wizard:

For Exit Long:
CrossAbove(SMA(ParabolicSAR(0.02, 0.2, 0.02),1),SMA(1),1)
This means, a 1 period SMA of the ParabolicSAR crosses above a standard 1 period SMA.

In the view code it looks like this:
// Condition set 2
if (CrossAbove(SMA(ParabolicSAR(0.02, 0.2, 0.02), 1), SMA(1), 1))
{
ExitLong("LoEx", "Lo");

Reverse for Short Exits:
// Condition set 4
if (CrossBelow(SMA(ParabolicSAR(0.02, 0.2, 0.02), 1), SMA(1), 1))
{
ExitShort("ShEx", "Sh");

This is my solution for the Trailing Stop with ParabolicSAR.

Thanked by:
 
 
master trader's Avatar
 master trader 
Calgary AB, Canada
 
Experience: Master
Platform: NinjaTrader
Broker: Zen-Fire
Trading: CL, GC, ZB
Posts: 124 since Apr 2010
Thanks Given: 43
Thanks Received: 41


Hansen View Post
You can add this to your strategy with the edit strategy wizard:

For Exit Long:
CrossAbove(SMA(ParabolicSAR(0.02, 0.2, 0.02),1),SMA(1),1)
This means, a 1 period SMA of the ParabolicSAR crosses above a standard 1 period SMA.

In the view code it looks like this:
// Condition set 2
if (CrossAbove(SMA(ParabolicSAR(0.02, 0.2, 0.02), 1), SMA(1), 1))
{
ExitLong("LoEx", "Lo");

Reverse for Short Exits:
// Condition set 4
if (CrossBelow(SMA(ParabolicSAR(0.02, 0.2, 0.02), 1), SMA(1), 1))
{
ExitShort("ShEx", "Sh");

This is my solution for the Trailing Stop with ParabolicSAR.


Many thanks.
Can you or anyone reading this do a similar solution using SuperTrend Trailing Stop instead of parabolic SAR. Will be much appreciated.

 
 
master trader's Avatar
 master trader 
Calgary AB, Canada
 
Experience: Master
Platform: NinjaTrader
Broker: Zen-Fire
Trading: CL, GC, ZB
Posts: 124 since Apr 2010
Thanks Given: 43
Thanks Received: 41


master trader View Post
Many thanks.
Can you or anyone reading this do a similar solution using SuperTrend Trailing Stop instead of parabolic SAR. Will be much appreciated.


@Hansen:

Don't worry about that. Turns out the plots are exposed in anaSuperTrend so I was able to do that myself. For anyone who may need the code here's how to add anaSuperTrend trailing stop to a Strategy.

//For Longs:

if (Position.MarketPosition == MarketPosition.Long && (anaSuperTrendU11(2, 1.5, 18, false, anaSuperTrendU11BaseType.Median, anaSuperTrendU11OffsetType.Default, anaSuperTrendU11VolaType.Simple_Range).StopDot[0] >= Close[0]))

{
ExitLong();
}


//For Shorts:

if (Position.MarketPosition == MarketPosition.Short && (anaSuperTrendU11(2, 1.5, 18, false, anaSuperTrendU11BaseType.Median, anaSuperTrendU11OffsetType.Default, anaSuperTrendU11VolaType.Simple_Range).StopDot[0] <= Close[0]))

{
ExitShort();
}



Don't forget to add the anaSuperTrend indicator to the chart.


Hope that helps.

Thanked by:
 
 KrazyTrader 
Dallas, TX/USA
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES, CL
Posts: 51 since Aug 2013
Thanks Given: 56
Thanks Received: 9


master trader View Post
@Hansen:

Don't worry about that. Turns out the plots are exposed in anaSuperTrend so I was able to do that myself. For anyone who may need the code here's how to add anaSuperTrend trailing stop to a Strategy.

//For Longs:

if (Position.MarketPosition == MarketPosition.Long && (anaSuperTrendU11(2, 1.5, 18, false, anaSuperTrendU11BaseType.Median, anaSuperTrendU11OffsetType.Default, anaSuperTrendU11VolaType.Simple_Range).StopDot[0] >= Close[0]))

{
ExitLong();
}


//For Shorts:

if (Position.MarketPosition == MarketPosition.Short && (anaSuperTrendU11(2, 1.5, 18, false, anaSuperTrendU11BaseType.Median, anaSuperTrendU11OffsetType.Default, anaSuperTrendU11VolaType.Simple_Range).StopDot[0] <= Close[0]))

{
ExitShort();
}



Don't forget to add the anaSuperTrend indicator to the chart.


Hope that helps.

Thanks much. Will this create a server side stop (like trailing) or exit when the stop line breaks?

Thanks in advance.

Difference between discomfort and pain = 1 tick
 
 
master trader's Avatar
 master trader 
Calgary AB, Canada
 
Experience: Master
Platform: NinjaTrader
Broker: Zen-Fire
Trading: CL, GC, ZB
Posts: 124 since Apr 2010
Thanks Given: 43
Thanks Received: 41


KrazyTrader View Post
Thanks much. Will this create a server side stop (like trailing) or exit when the stop line breaks?

Thanks in advance.


I believe it works like OCO, it resides in your PC.

 
 George P 
Ath. Gr.
 
Experience: Intermediate
Platform: NinjaTrader
Trading: ES, 6E
Posts: 40 since Nov 2016



sandptrader View Post
The Chart shows the Trade and Parabolic Sar for Trailing.
Things to Consider would be as Follows:

- Platform Disconnects....what happens to the Trailing Stop or would there be any Stop Protection?
- would the Parabolic Sar Trailing Stop be Unwantedly Executed by way of either Bid/Ask quotes and not True
Executed Prices?
- Any other suggestions would be appreciated as this is ongoing project for me until i get this Strategy completed.

Hello sandptrader,

Interesting chart. I am mostly interested about the "line-type" oscillator (on the bottom of the chart). Is it possible for me to have it (download it or buy it) ? Or can you please tell me where can I find it ? I have developed similar (private) indicators of my own, but I would like to see yours as well. Thank you.


 



Last Updated on February 27, 2017


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts