NexusFi: Find Your Edge


Home Menu

 





Utilizing Multiple Stops - EasyLanguage Setstoploss Setpercenttrailing


Discussion in EasyLanguage Programming

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




 
Search this Thread
  #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?
CFTC Opens First COT Report Review in 20 Years -- Asks W …
Traders Hideout
Roland Garros Final Day: $3M on Zverev at 80.5% -- Leban …
Prediction Markets & Event Contracts
Weekend Update: First Qatari LNG Transit Attempted -- IR …
Traders Hideout
Warsh Rate Hike at 40%, Iran June 15 Expires Tonight at …
Prediction Markets & Event Contracts
June 15 Peace Odds Surge From 3.6% to 12.25% After Trump …
Prediction Markets & Event Contracts
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Big Mike in Ecuador
196 thanks
Sober Journey With S&P
27 thanks
30 Sessions
20 thanks
BERN ALGOS algo trading journal
8 thanks
Volume Indicators
8 thanks
  #3 (permalink)
 ABCTG   is a Vendor
 
Posts: 2,448 since Apr 2013
Thanks Given: 494
Thanks Received: 1,642


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 X 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: 201 since Feb 2020
Thanks Given: 26
Thanks Received: 138

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


© 2026 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 - Downloads - Top
no new posts