Adaptive Trailing Stop

Post Reply
jb68
Trader
Posts: 71
Joined: Mon Jan 30, 2012 11:30 pm

Adaptive Trailing Stop

Post by jb68 »

For some time I was working to develop an Adaptive Trailing Stop.

Here are some facts from my studies..
If we have a random bet with TP=SL (1:1) the probability of win is a little less then 50%. (due to spread)
If we put a random bet with TP = 2SL (2:1) the probability of win is somewhere at 34%. This is above theoretical 33% and that 1% is how we make money... :) (in reality is less then 1%)
Having an educated bet will increase these probabilities but no more (that why is so hard to make money). But I will consider the random thing to explain my idea.

For a system with 2:1 if Ask= OpenOrder we have 66% to hit SL and 33% to hit TP. When ASK is half distance between OpenOrder and TP the odds reverse to 66% to hit the TP and 33%. At this point traders do 2 things, some move to Break even and some close 1/2 of the order to obtain a free trade. For this specific ratio it is obvious the Break Even move will change again the odds to 50% so will have 16% less chances to win then the closing 1/2. However for a 4:1 or more system moving to BE is the best strategy.
No matter which strategy is used I will consider this the BE point.

After the BE is hit if price will move in our favor people use a trailing SL. A trailing SL will move the SL with 1pips for every Pip of increase. After some probability and testing I find out the best SL value is somewhere around TP-OpenOrder/K where K is about 2 to 3. So our trade will have to wait a lot till it start to bank some pips. Being a greedy person I was looking to find a way to bank more pips while keeping the odds to have the TP hits.

My Idea was to bank 1 pips for every 10 pips increase for the first part of Price movement and increase this up to 1:1 when Price go more into our favor. When price is closing to TP I tried to bank even more then 1:1 lets say for each 10 pips move I tried to bank 15 pips while keeping SL far enough.

I started a linear equation for the first part and came up with:
MySL = MathMax(FixAmt, SLCoef*(OrderOpenPrice()-Ask)/Point)

Depending on tested strategy SLCoef came up to around 0.6 to 0.8 and FixAmt close to 5 -10Pips and grow between 10-20%. (for each 10 pips we bank 2-4) .
The equation for the second part didn't came up with any improvement. I'm not sure what I did wrong for second part but I suspect is the fact the probability of the trend reversal increase too much.
From what I can guess a quadratic equation would be way better but this overcome my math and time capability at this time.

I'm sure i didn't invent the wheel so maybe somebody has more info in this.
jb68
Trader
Posts: 71
Joined: Mon Jan 30, 2012 11:30 pm

Re: Adaptive Trailing Stop

Post by jb68 »

I found an article on this...
http://articles.mql4.com/643

However this guy used
double Coeff_down = NormalizeDouble((OrderOpenPrice()-Ask)*0.382,Digits);
New_S_Loss = Ask+Coeff_down+6*Point;

He used 0.382 .. a fibo number and is way lower, meaning he will bank more pips.
The_Snowman
Trader
Posts: 383
Joined: Sun Nov 27, 2011 8:24 am
Location: Australia

Re: Adaptive Trailing Stop

Post by The_Snowman »

These guys have an EA that will enter on your parameters, then trail & exit using 8 different methods.

The Approaching is somewhat similar to what is discussed here, but for me, the Parabolic SAR would probably catch the most of those sudden huge spikes - depends on your time frame, I suppose, among other variables.

http://www.landofcash.net/

:)
User avatar
SteveHopwood
Owner
Posts: 9754
Joined: Tue Nov 15, 2011 8:43 am
Location: Misterton - an insignificant village in England. Very pleasant to live in.

Re: Adaptive Trailing Stop

Post by SteveHopwood »

jb68 wrote:I'm sure i didn't invent the wheel so maybe somebody has more info in this.
Ask Gary. He will confirm whether or not you are on the right track.

Brace yourself though. Most of us turn out to be howling at the wrong moon. :lol:

:D
Read the effing manual, ok?

Afterprime is the official SHF broker. Read about them at https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?p=175790#p175790.

I still suffer from OCCD. Good thing, really.

Anyone here feeling generous? My paypal account is always in the market for a tiny donation. [email protected] is the account.

To see The Weekly Roundup of stuff you guys might have missed Click here

My special thanks to Thomas (tomele) for all the incredible work he does here.
garyfritz

Re: Adaptive Trailing Stop

Post by garyfritz »

jb68 wrote:For a system with 2:1 if Ask= OpenOrder we have 66% to hit SL and 33% to hit TP. When ASK is half distance between OpenOrder and TP the odds reverse to 66% to hit the TP and 33%. At this point traders do 2 things, some move to Break even and some close 1/2 of the order to obtain a free trade.
Those are effectively the same, at least for the losing case. Either way if the market goes against you, it's a breakeven. You might be right that the probabilities are different, though.
No matter which strategy is used I will consider this the BE point.
I.e. when the ask is halfway to the TP?
After the BE is hit if price will move in our favor people use a trailing SL. A trailing SL will move the SL with 1pips for every Pip of increase. After some probability and testing I find out the best SL value is somewhere around TP-OpenOrder/K where K is about 2 to 3. So our trade will have to wait a lot till it start to bank some pips.
You move to BE at +(TP-OpenOrder)/2. When K = 2, you move the stop one pip per pip of price movement beyond +(TP-OpenOrder)/2. So you start banking pips as soon as the price passes your breakeven point, no? But none before that.

Being a greedy person I was looking to find a way to bank more pips while keeping the odds to have the TP hits.
My Idea was to bank 1 pips for every 10 pips increase for the first part of Price movement and increase this up to 1:1 when Price go more into our favor. When price is closing to TP I tried to bank even more then 1:1 lets say for each 10 pips move I tried to bank 15 pips while keeping SL far enough.
You've gone from scaling things by (TP-OpenOrder) to fixed pip values. That confuses things.

So instead of going to BE at +(TP-OpenOrder)/2, you're going to BE+1 at 10 open pips?
I started a linear equation for the first part and came up with:
MySL = MathMax(FixAmt, SLCoef*(OrderOpenPrice()-Ask)/Point)

Depending on tested strategy SLCoef came up to around 0.6 to 0.8 and FixAmt close to 5 -10Pips and grow between 10-20%. (for each 10 pips we bank 2-4) .
The equation for the second part didn't came up with any improvement.
I'm not completely sure what you're doing with this. This is your SL offset from OrderOpenPrice() ? So you start out with a 5-10 pip stop? Then as price moves in your favor, the second half increases, so now you have a LARGER stop? Either I'm misunderstanding or that's not what you want.

That equation isn't anything like the "bank 1 pip per 10" idea you were talking about before. Say in words what you want to do and we can come up with the equations. It might take several equations and one or more if's.
Over60
Trader
Posts: 153
Joined: Thu Sep 13, 2012 12:58 pm

Re: Adaptive Trailing Stop

Post by Over60 »

To develop an adaptive stop might be a good idea.
But I think, there is no mathematical approach to solve the problem in the way you described.

In the starting period after entering an order, maybe you will use a stop, at first to let the price enough space to breath. This stop call it margin- or emergency-stop, will cut your loss, if the stop will hit e.g. your margin-invest in the worst case.
This stop will remain appr. in a range of appr. 30-35 pips distance from entry and this pip-distance remains always equal, independant, what lotsize (margin) you positioned.
Chances 50:50.
I don´t think about RR, because I can only calculate the loss.
You can also work without a stop loss or using an extrem emergency-stop far away from entry e.g. considering a max. daily or weekly price-movement.
It depends on your risk-management and maybe a high-probability setup, you have developed.

Such an extrem emergency-stop-distance you will use to protect your account during a heavy spike movement with remaining trend reversal against you, if you are not in the position to cut the losing-run live. I talk in terms of daytrading, not swing or longterm.
Such spikes seen in the EURUSD last week with a daily strike of 250 Pips short.
It occures rarely, but nothing is impossible and such homeruns can ruin your account very fast.

In terms of programming a trailing-stop-EA, an emergency-stop (not stealth, have to be routed to the criminal) besides of a hidden (stealth) trailing-stop. It should be a must.
Such a trade-manager with a lot of advanced features you will found at FF.
Search for “FXTR51”.

Now I will try to describe the scenario, if the price moves in your favor.
“Garyfritz” did already mentioned, that the area near by entry (because of BE-protection) will be dangerous, due by normal price-movements oscillating in a range of appr. 5-7/10 Pips, depends on ATR during different trading hours.

But that is not the main problem for trailing. Live we can control ATR, we watch SR-Zones, fibos, pivots, what ever you prefer and we have to consider the time-cycles and TFs, where the other traders will get tired or engaged to sell or buy and corrections occur.
There are a lot of criteria to consider.
Please consider also partial-profit (OM).
It depends in generell, how a trailing-robot should perform and how many pips you intend to scalp in the basic-approach.
There are statistics, that 5 pips in TP in the fast TFs are the maximum.
Certainly, that is only and also half the true, but I think, that with linear optimization, the problem will not solved by an equation.

But I´m not a mathematic expert.
Anyway, concerning trailing and considering several variables (price-action, volume, momentum, trend-intensity, trading hours, even with indicators), which interact dynamically, I will draw your attention to the mathematic field of decision-making, which seems to me easier to realize (0 or 1, counted and weighted ) to cover several independent variables by simple probability studies.

Trade well my friends
Over60
Post Reply

Return to “Trading Psychology & Money Management”