in my archive, I found this Trading System, and the author recommended to do tests with 3 Exit, to improve the efficiency and robustness of the T.S.
If someone could kindly transform the 3 Exit into Easylanguage and insert them into the formula, which I will try one at a time with the use of parentheses: { }.

These are the 3 Exit to be included in the formula; I will also turn them into: (after SellShort): Exit ....:

(after Buy): Exit with a profit after 30 bars, if the closing is less than the exponential moving average of 5 days.
(after Buy): Exit with a limit order if the open profit exceeds 20%.
(after Buy): Exit with a profit if the trade lasts for more than 50 bars.

This is the formula of the T.S. for Tradestation 8 or higher:
-----------------------------------------------------------------

Hi,
yes, of course, also Sellshort (I would have done it , for not to disturb you too much).
Thank you very much.

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

{after Buy}: Exit with a profit after 30 bars, if the closing is less than the exponential moving average of 5 days.
{after Sellshort}: Exit with a profit after 30 bars, if the closing is higher than the exponential moving average of 5 days.

{after Buy}: Exit with a limit order if the open profit exceeds 20%.
{after Sellshort}: Exit with a limit order if the open profit exceeds 20%.

{after Buy}: Exit with a profit if the trade lasts for more than 50 bars.
{after Sellshort}: Exit with a profit if the trade lasts for more than 50 bars.

{after Buy}: Exit with a profit after 30 bars, if the closing is less than the exponential moving average of 5 days.
What do you do your trade is profitable after 30 bars, but closing > mov avg 5 days?

{after Sellshort}: Exit with a profit after 30 bars, if the closing is higher than the exponential moving average of 5 days.

{after Buy}: Exit with a limit order if the open profit exceeds 20%.
You can use setprofittarget, but what is the 20%? 20% of what?

{after Sellshort}: Exit with a limit order if the open profit exceeds 20%.

{after Buy}: Exit with a profit if the trade lasts for more than 50 bars.
if marketposition = 1 and barssinceentry = 50 and close>entryprice then sell this bar at close; //market order
or
if marketposition = 1 and barssinceentry = 50 then sell next bar at entryprice limit; //limit order
And what are you going to do if the trade is not profitable after 50 bars?

{after Sellshort}: Exit with a profit if the trade lasts for more than 50 bars.

If it may be useful to someone, I insert here the 3 Exit translated in Esylanguage (thanks to Tom 1978):

If marketposition=1 and close>entryprice and barssinceentry=30 and close<xaverage(close,5) then Sell("LX 30") next bar at market;
If marketposition=-1 and close<entryprice and barssinceentry=30 and close>xaverage(close,5) then Buytocover("SX 30") next bar at market;

If marketposition=1 and close>1.20*Entryprice then Sell("LX target") this bar at close;
If marketposition=-1 and close<0.8*Entryprice then Buytocover("SX target") this bar at close;

If marketposition=1 and close>entryprice and barssinceentry=50 then Sell("LX 50") this bar at close;
If marketposition=-1 and close<entryprice and barssinceentry=50 then Buytocover("SX 50") this bar at close;

The following user says Thank You to Shaban for this post: