Trailing Stop Loss - EasyLanguage - futures io
futures io



Trailing Stop Loss - EasyLanguage


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one tradestation18 with 3 posts (1 thanks)
    2. looks_two Shaban with 1 posts (1 thanks)
    3. looks_3 kevinkdog with 1 posts (0 thanks)
    4. looks_4 FuManChou with 1 posts (0 thanks)
    1. trending_up 805 views
    2. thumb_up 2 thanks given
    3. group 4 followers
    1. forum 5 posts
    2. attach_file 0 attachments




Welcome to futures io: the largest futures trading community on the planet, with well over 150,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)

 
Search this Thread
 

Trailing Stop Loss - EasyLanguage

(login for full post details)
  #1 (permalink)
tradestation18
Porto Portugal
 
 
Posts: 15 since May 2018
Thanks: 0 given, 1 received

Hi,
Canīt find any pre-build code in TradeStation for Trailing Stop Loss strategy. Can someone help to get the code in EL for Trailing Stop Loss strategy?
Thanks

Reply With Quote

Can you help answer these questions
from other members on futures io?
Move SL or TP with pointer and keys
NinjaTrader
Historical Tick Data for E-mini Futures
The Elite Circle
NT8 Batch load strategies from xml
NinjaTrader
Hey! Is there a way to change the date and symbol on a c …
EasyLanguage Programming
Moving Average Price Scan
ThinkOrSwim
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Spoo-nalysis ES e-mini futures S&P 500
12 thanks
Cycle Analysis... a way of looking at price action.
8 thanks
Basic Education for Beginner Trader
7 thanks
Want your NinjaTrader indicator created, free?
7 thanks
TST/OneUp/LeeLoo/Earn2Trade
4 thanks
 
(login for full post details)
  #2 (permalink)
 FuManChou 
Saint Paul, Minnesota, United States
 
Experience: Beginner
Platform: MultiCharts
Broker: Edge Clear
Trading: Micros & Small Exchange Futures
 
FuManChou's Avatar
 
Posts: 91 since Jun 2019
Thanks: 1,003 given, 99 received

Try this.

inputs:
TrailingAmount$(0);

If TrailingAmount$ > 0 then
SetDollarTrailing(TrailingAmount$);

Reply With Quote
 
(login for full post details)
  #3 (permalink)
tradestation18
Porto Portugal
 
 
Posts: 15 since May 2018
Thanks: 0 given, 1 received


Thanks, but SetDollarTrailing is a profit taking strategy.
What I look for is a Stop Loss Trailing strategy...

Reply With Quote
 
(login for full post details)
  #4 (permalink)
 kevinkdog   is a Vendor
 
 
Posts: 3,322 since Jul 2012
Thanks: 1,757 given, 6,701 received


tradestation18 View Post
Thanks, but SetDollarTrailing is a profit taking strategy.
What I look for is a Stop Loss Trailing strategy...

SetDollarTrailing is a trailing STOP, not a profit target.

In any event, I would not recommend SetDollarTrailing or SetPercentTrailing for any backtesting, unless you use 1 tick LIBB. It gives inaccurate results otherwise.


From Tradestation Help File:

SetDollarTrailing (Reserved Word)

image\trumpet2.gif Disclaimer

This built-in stop reserved word is used to set a trailing stop to exit a position based on a specified dollar Amount that trails the greatest position profit. A stop order is generated at the calculated price based on the trailing Amount.

SetDollarTrailing(Amount)

Amount is the greatest open position profit that you are willing to give back.

Use with SetStopContract or SetStopPosition.

Strategy

Dollar Risk Trailing

Example

To place a dollar risk trailing stop at $500 for the entire position, write:

SetDollarTrailing(500);

As the price rises in a long position, so does the placement of the stop. It is maintained at a dollar value that results in a total of $500 loss for the entire position.

Additional Example

To place a dollar risk trailing stop at $5 below the greatest share price, write:

SetStopShare;

SetDollarTrailing(5);

As the price rises in a long position, so does the placement of the stop. It is maintained at a stop value $5 below the greatest share price.

Follow me on Twitter Reply With Quote
 
(login for full post details)
  #5 (permalink)
Shaban
Turin + Italy
 
 
Posts: 162 since Feb 2020
Thanks: 17 given, 90 received

If it is helpful, this is a Stop loss that is based on volatility with the ATR (however, be careful, because if volatility increases, the Stop loss also increases):

---------------------------------------------------------------------

Inputs: StopMult(3);
Vars: mystop(0);



mystop=StopMult*AvgTrueRange(14)*BigPointValue;
if mystop>0 then setstoploss (mystop);

------------------------------------------------------------------------

P. S: I sent you a P.M.

Reply With Quote
The following user says Thank You to Shaban for this post:
 
(login for full post details)
  #6 (permalink)
tradestation18
Porto Portugal
 
 
Posts: 15 since May 2018
Thanks: 0 given, 1 received

Thanks all for your comments. The best trailing stop loss I have come to is something like this:

inputs:
PositionBasis( true ),
Amount ( 0 ),
Trailingpercent (0) ;

Variables: TrailValue(0),TrailExit(0);


if PositionBasis then
SetStopPosition
else
SetStopShare ;
SetStopLoss( Amount ) ;

If marketposition>=1 and currentbar>2 then begin
TrailValue=Highest(High,BarsSinceEntry);
TrailExit=TrailValue-Trailingpercent*0.01*Close;
If Close<=TrailExit then sell ("LX") next bar at market;
end;

If marketposition<=-1 and currentbar>2 then begin
TrailValue=Lowest(Low,BarsSinceEntry);
TrailExit=TrailValue+Trailingpercent*0.01*Close;
If Close>=TrailExit then buy to cover ("SX") next bar at market;
end;

Regards

Reply With Quote
The following user says Thank You to tradestation18 for this post:


futures io Trading Community Platforms and Indicators EasyLanguage Programming > Trailing Stop Loss - EasyLanguage


Last Updated on June 1, 2022


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
     



Copyright © 2022 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada), 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