Cut important losses

Subject: cut important losses

Dear colleagues,

I have developed a formula that works well enough and, without having to optimize it to the fullest extent, gives many good results, but I can not find the way to limiting absolute losses to a reasonable level.

It is a system designed for an account of USD 200,000 and for a portfolio of 15 very active shares.

I have set the maximum risk for trading at 2% of the capital, but when this capital increases with reinvestment, this relative risk achieves absolute levels so exaggerated that, even not exceeding the 2% limit, I consider them unbearable.

Equity: USD 200,000.00

Risk% of total equity on single trade: 2% = USD 4,000.00

As capital increases, this can happen,

Equity: USD 1,000,000.00

Risk% of total equity on single trade: 2% = USD 20,000.00 or more ... !!

I would like to include instructions that would make possible the following,

"IF Trade loss <2% * Equity AND Trade loss> USD 6,000.00 then Close Position"

Because I think it is not necessary to reach the end of a bad operation and lose too much money, especially if it is already seen that it will not work well. This would also reduce the Dawdowns.

The formula I have developed is very simple, and I am well advocated in AFL but I am not fully aware of its resources.

I thank you in advance for your guidelines,

Linx

Hi Linx --

Pardon me for jumping in. But you might consider taking the position sizing out of the signal generation model and putting it into whatever trading management model you are using. The signal generator does not know the recent performance and is not capable of adjusting for the drift in the relationship between the data and the model's rules.

Not having the information and rules necessary to determine system health and set position size in the trading management model means that there is no "knob to turn" there to adjust trading.

Best, Howard

1 Like

Greetings --

Linx is correct in trying to avoid serious losing trades.

There are two categories of losses.

  1. Lost money -- when the system predicts a gain and enters a position, but it turns out to be wrong and the trade loses money.
  2. Lost opportunity -- when the system fails to predict a gain, remains flat, and a profit is missed.

By far, by very far, it is more important to avoid losses than to avoid lost opportunity.

Best, Howard

3 Likes

Dear Dr. Bandy,

I did not expect this pleasant surprise, because when I opened your email, I had my-your book "Quantitative Trading Systems" (second edition) on the table, open in front of the PC and with the other five books published by you at my side in a shelf.

Currently, your books are not in bookstores here, but four years ago I bought and read a book written by a Spanish author, Oscar G. Cagigas, entitled " Trading con sistemas automaticos" that mentions you and your work as an important reference and, thanks to Amazon, now I have them in my home in Barcelona.

That said, I would want to know how I can implement a condition that will force the exit or closure of the trade, if its loss is equal to or greater than a certain amount, even if it has not reached the limit of the highest risk for trade ccepted.

If that can be done, of course!

The Formula is very simple, It BUY when the market go in up and SELL when It go in down

Thank you very much for your offer of help me,

yours faithfully

Linx

Greetings --

The traditional method for exiting a losing position intra-trade -- and exit made before the model's Sell signal has been received -- is a Stop order. There are two types of Stop orders that can be included in a trading system's model.

One is the Exit at a Maximum Loss. The performance of most trading systems is worse when this type of exit is used. You can check whether it helps or hurts your system with a series of test runs. Write the exit into your code as one of several Sell orders. For example, give the variable name "SellNormal" to the normal sell -- the one that comes from your logic. Give the variable name "SellMaxLoss" to the maximum loss rule. Define your model's Sell rule as "Sell = SellNormal or SellMaxLoss" Begin your first test with the maximum loss exit set so far away that it is never triggered. Record the result. Make a series of tests, each time moving the maximum loss closer to the entry. If having a close maximum loss exit helps, consider using it. Do not be surprised if performance deteriorates as the stop price is moved closer to the entry. Also, this is a Stop order as compared with a Limit order. Expect slippage.

The second is a trailing exit, such as the "parabolic" or "chandelier" stop order. Trailing exits can work well. They begin by placing an exit below the entry (for a long trade), then moving the exit upward as time passes. They require 1) enough time for the trailing exit price to catch up to the current market price. And 2) regular monitoring of and management of the order. If the order is in place with the broker, these will be "cancel and replace" orders, or the equivalent. This is also a Stop order, so expect slippage.

A better solution is to identify the conditions that lead to the losing trade and avoid entry. Using state signals can help. Assuming the system is using daily data and evaluating at the close, compute a state signal every day -- either beLong or beFlat. If the signal for tomorrow is beLong, enter or remain in a long position. If it is beFlat, remain flat or exit the long position.

There is a discussion state signals on this web page: http://blueowlpress.com/system-development/impulse-versus-state-signals/

One of the major problems we all have is identifying conditions when we should be long or be flat. A single indicator and rule, such as beLong when RSI(C,2) < 20, can be helpful, but there are many times when the price drops further following an already low RSI. The discussion of Indicators beginning on page 161 of the Quantitative Technical Analysis book illustrates the relationship between the value of the indicator and the gain for the trade. When the indicator is ideal, everything works well. As the indicator becomes "fuzzy", results deteriorate. (Those same illustrations are included on this web page: http://blueowlpress.com/system-development/indicators/).

Best, Howard

Dear doctor Bandy,

Thank you very much for your directions, I am working on this, but I want to suggest you something else to see if it can be achieved.

The ideal of avoiding entering losing positions is very difficult to achieve for me, by the moment.

I miss in AFL, a function that, when I call it, delivers me the current trade loss at this time, if any, to evaluate it and decide to close the position (Stop), if it exceeds an absolute amount in USD, established a priori by me (the trader).

We could call it "TradeLoss" to this function, for example.

Moreover, this "TradeLoss" function could be combined with another conditional function that decides if it exceeds the established limit and to execute the STOP command automatically, to force get out of the market and avoid significant and unnecessary losses.

This combination could be called "Escape" or "TradEscape".

All stops should work independently, one on the other, the first to receive the signal will be the first to act. Initial Stop-Loss, Profit Trailing-Stop and “TradeEscape”.

ADVANTAGES:

LOSS: Reducing unnecessary losses, even if they do not exceed the initial stop-loss, for exemple 2% or 3%, are too large due to an important portfolio equity, or even worse, that the price jump the inicial Stop-Loss or the Trailing-Stop.

GAP: Avoid an important loss in the case of a GAP that is contrary to our position and jumping the protection stop, this possibility would lead to uncontrolled loss.

DRAWDOWND: surely it would be reduced considerably.

DISADVANTAGES:

LOSS OF OPPORTUNITY: surely sometimes, closing positions, could will be a lost opportunities, due to posterior possible trade recovery.

But, as you say very well, it is always more serious to lose real money than to lose hypothetical opportunities! The opportunities can return, but the money is more difficult to make it come back, because the equity is minor.

CONTROL: This new function would not allow closing the position at an exact level of losses, but it did not allow them to run much more.

In summary, it is about reducing unnecessary losses, even if they are within the established limits and avoid uncontrolled losses due to price jumps, since the function is defined by the level of losses and not by the situation of the stops at a certain level.

Without a doubt, Mr. Tomasz Janeczkco and his team, it would be very easy to implement all this, I think...

Best regards

Linx

PD: I've tried to do all of this with three ApplyStop but it does not work for me, maybe I did it badly

Hi Linx --

I believe everything you are asking for is already in AmiBroker.

I assume you are describing the model fitting process -- using historical data and determining which rules and parameters give the best results.

The stop you are asking for in your third sentence -- "the current trade loss at this time" -- seems to be Type 0, the Maximum Loss Stop, described here: https://www.amibroker.com/guide/afl/applystop.html As the backtesting and optimization takes place, profit or loss is computed for each bar. If you ask for ExitAtStop mode 1, your trade will be exited intra-bar when the loss is recognized.

You can have as many exit rules and stop applications as you wish. If you write your own rules, they look like this:

Sell1 = ...

Sell2 = ...

Sell = Sell1 or Sell2

You do not need to include stops in your sell rules. Stops are managed by AmiBroker and the first stop to be triggered will cause the exit.

If using daily bars does not give you the granularity of control you need, use intra-day data.

Best regards, Howard

Dear Dr. Bandy,

First of all, thank you for your continued directions. Yes, I am on model fitting process.

His final clarification has helped me a lot to understand the powerful possibilities to solve the problem, but I have a doubt that does not let me continue.

I want to implement ApplyStop in my Formula and I am confused.

When I want to enter the amount of the maximum loss in its absolute value, I do not find the clear way where to enter it, May be I not interpret the syntax correctly and ask for help.


Syntax Copied from the original

ApplyStop (type, mode, amount, exitatstop, volatile = False, ReEntryDelay = 0, ValidFrom = 0, ValidTo = -1)

type =
0 = stopTypeLoss - maximum loss stop,
1 = stopTypeProfit - profit target stop,
2 = stopTypeTrailing - trailing stop,
3 = stopTypeNBar - N-bar stop

mode =
0 - disable stop (stopModeDisable),
1 - amount in percentage (stopModePercent), or number of bars for N-bar stop (stopModeBars),
2 - amount in points (stopModePoint);
3 - amount in percent of profit (risk)

amount =
percent / point loss / profit trigger / risk amount.
This could be a number (static stop level) or an array (dynamic stop level)

ExitAtStop
ExitAtStop = 1 - check High-Low prices and exit intraday on price equal to stop level on the same bar when stop was triggered


Confusion points:

Type: no problem

Mode: Confussion, no option for amount in absolute value

Amount: Cofusion, Risk amount probably is referred to mode 3 (amount in percent of profit (risk))

ExitAtStop: no problem

Thank you in advance
Linx