NexusFi: Find Your Edge


Home Menu

 





Utilizing Multiple Stops - EasyLanguage Setstoploss Setpercenttrailing


Discussion in EasyLanguage Programming

Updated
      Top Posters
    1. looks_one ABCTG with 1 posts (0 thanks)
    2. looks_two futuresgwb with 1 posts (0 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 bfiselin with 1 posts (0 thanks)
    1. trending_up 3,552 views
    2. thumb_up 0 thanks given
    3. group 4 followers
    1. forum 4 posts
    2. attach_file 0 attachments




 
Search this Thread

Utilizing Multiple Stops - EasyLanguage Setstoploss Setpercenttrailing

  #1 (permalink)
bfiselin
Cleveland Ohio
 
Posts: 1 since Mar 2015
Thanks Given: 0
Thanks Received: 0

I am new to tradestation and to easy language and I am trying to set up some stops in my strategy. What I would like to have happen is for a stop to be set when I enter a trade as a stop loss then if a trade begins to show a profit I want to change this to a percent trailing stop that tightens as the profit increases. I am sure it has something to do with the way the language executes the code but I can't figure it out how to do it. Do I need some sort of If statement?

When I do this the only thing that seems to happen is the stop loss: I was expecting that the stops would override the previous ones as they became valid but that is not the case when I backtest it. I truly appreciate any help anyone can provide as I'm sure I'm probably going about this the wrong way.

SetStopPosition;
SetStopLoss(1000);
SetPercentTrailing((tradecost*.03),15);
SetPercentTrailing((tradecost*.06),10);
SetPercentTrailing((tradecost*.09),5);

Reply With Quote

Can you help answer these questions
from other members on NexusFi?
MC PL editor upgrade
MultiCharts
ZombieSqueeze
Platforms and Indicators
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
How to apply profiles
Traders Hideout
Trade idea based off three indicators.
Traders Hideout
 
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,436 since Apr 2013
Thanks Given: 482
Thanks Received: 1,629


bfiselin,

I don't think more than one SetPercentTrailing reserved word can actually be active in the code. What might work is changing the amounts or percentages when certain conditions trigger.

Regards,
ABCTG

Follow me on Twitter Reply With Quote
  #4 (permalink)
futuresgwb
Baltimore Maryland USA
 
Posts: 2 since Jan 2019
Thanks Given: 0
Thanks Received: 0

I think the first number is the floor price for starting the stop. I would think you would want it to be slightly higher than the entry price.

So instead of "SetPercentTrailing((tradecost*.03),15);" you might want to set the floor price to 3% above the entry price. That would be "SetPercentTrailing((tradecost*1.03),15);" The 1.03 makes your floor price 3% above entry.

Reply With Quote
  #5 (permalink)
Shaban
Turin + Italy
 
Posts: 194 since Feb 2020
Thanks Given: 24
Thanks Received: 129

If it is helpful, I have included in addition to the StopLoss that can be optimized, a ProfitTarget based on volatility (ATR)
and with a percentage retracement, so:
activates the stop (ProfitTarget) if, after the profit of 1.5 times the ATR is reached, the Market goes back 20%.

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

Inputs: Amount(1000);


value1=AvgTrueRange(10);
value2=value1*1.5;

SetStopLoss(Amount);
SetPercentTrailing(value2,20);

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


If you also want to optimize the percentage retracement value, the formula becomes like this:


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

Inputs: Amount(1000), n1(20);


value1=AvgTrueRange(10);
value2=value1*1.5;

SetStopLoss(Amount);
SetPercentTrailing(value2,n1);

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

Reply With Quote




Last Updated on June 6, 2022


© 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