Phoenix optimization - page 13

 
daraknor:
PContour, I didn't see any changes listed. I thought I was facing a simple operating system issue, but it appears that my file system is turning to mush. I used to do data recovery techniques and I should be able to salvage most of my data, but I need a new HD :/ So for a little while, I'm going to be writing code blind, and answering questions semi-blind.

It sounds like the optimization is based on the trailing stop changes in 5.7.2? I saw the use of trailing stop P setting overriding the defaults. (Good quick code hack for doing tests without changing the settings file.) Since we have a countertrend system, this probably acts a filter for weak profits where the signal was good.

If I understand correctly (and I am doing this half blind) the system works like this:

If trade is 1 pip profitable, activate trailing stop

Use a 30-45 pip trailing stop so the initial SL=-29 to -44 profit.

As the profits increase, move the trailing stop up.

Have a 999 pip take profit, so the trailing stop is able to run the entire range.

I see a few problems with the system I just described (and I could be wrong on description).

#1 We have (by using backtesting) already removed some of the news based SL. When we profit using this trailing stop, we are really taking full advantage of news events in our favor and maybe a few minor trends. (Not bad, but please keep in mind that backtest looks much better than forward test.)

#2 In order to get a profit of 20 pips with a ts of 40, we need to have had a potential profit of 60 pips and we leave 2/3 of that on the table.

An ideal system of this type would:

A) Reduce losses when profit was reached, but in much smaller amounts than predicted.

B) Not leave so much profit on the table every trade.

C) Have enough cushion to allow Phoenix to operate and wait for larger trade reversals. (A tight trailing stop does A and B, but fails C)

D) Work well with all brokers (Brokers have a different valid 'smallest trailing stop' value and a separate different valid 'smallest stop loss' value.)

E) Not loose drastically when disconnected. (I'm solving E by staying connected all of the time personally with a hosted account, but it is still a criteria.)

I wrote a post about different exit strategies. Phoenix 5.7.2 can handle some variations, but it isn't really equipped to handle Exit Strategies well. A few months ago, I wrote some examples of different exit strategies, and I learned Pip Boxer implemented some of them. Phoenix 6 has almost 400 lines of code, not including any trading signals yet. Phoenix6 allows signals or simple math to be used for exit strategies, and to have several different exits turned off or on. I'm writing blind, but I'm writing every day.

Understanding the system,

I think you got it all right.

Problems

#2 In order to get a profit of 20 pips with a ts of 40, we need to have had a potential profit of 60 pips and we leave 2/3 of that on the table.

That is correct but so is the following. If the system was right and it goes up 150 pips you get 108 instead of 42 of the current system. We don't understand what is left on the table, but there is always something left on the table.

D) Work well with all brokers (Brokers have a different valid 'smallest trailing stop' value and a separate different valid 'smallest stop loss' value.) E) Not loose drastically when disconnected. (I'm solving E by staying connected all of the time personally with a hosted account, but it is still a criteria.)

There is something I'm not clear about, When we modify the order, and use the trailing stop, do we really have a trailing stop or does Phoenix really move the SL up a little higher? If so then the worst we do is to hit the stop loss, when we lose our connection, and we have no chance to get a profit.

This makes me think, it is a good idea to keep the TP as many points ahead of where we are as the TL is behind us, so if the power goes off on our PC we have an equal chance of hitting the TP as the SL.

(Not bad, but please keep in mind that back test looks much better than forward test.)

I want to make my point about apples vs oranges again. If we compare two back tests with identical data and different source code we would have an indication that the the one with the better result would be more likely to get us more profit, but, the profit is never as good as our back test.

 

I enhanced the new Trailing Stop

I enhanced the new Trailing Stop

Now with a configurable shrinking Trailing Stop. You use the field P_M3_CloseTrade_23, the trailing stop will shrink by 1 for every P_M3_CloseTrade_23 points into the profit that you position move. Set it to 5 and if you are 45 points in profit the TS is changed to 45 - (45/5) = 36. My little sample improved to 4094, another 3%. Best value in my optimization was any value over 65. Code is here

I didn't enhance the TP point it is still 999. Maybe on the weekend to add that safety factor. Set it to zero and the Trailing stops stays where you set it.

Additional testing would be great.

 

I'm looking at the code, and trying to figure out what the trailing stop would be at a certain point. I'm assuming that as my profit increases, my trailing stop increases? Please keep in mind that each broker has a minimum distance between current price and the SL value you are allowed to set, and breaching that minimum distance results in trade errors. MODE_STOPLEVEL is the constant with the minimum distance, in pips.

An alternative might be:

(tp-CurProfit)/tsScale >=MODE_STOPLEVEL

With a profit of 10 pips, and a take profit of 50 pip, the trailing stop would be 40 pips if the tsScale=1, 20 pips if tsScale=2.

With a profit of 30 pips and a tp of 50 pip, the ts would be 20 pip (locking in 10 pip profit) if the tsScale=1, and 10 pip if tsScale=2

Having a really large ts just means you're running a trending system. An optimized value might look great, but a forward test might look horrible. Run it with 3 months optimization and then 3 months testing on unoptimized data. I bet in many cases, they will look vastly different. What is your largest profit (in pips if you can) in testing? Was it a news event?

 

Phoenix Chart Template

Here is a sample of the Phoenix Chart Template I am working on. The idea is to display indicators for the Phoenix trade symbols in order to facilitate visual optimization. The symbols on the main chart are Signal 1, the Envelope (pair of black lines) and Signal 2, the Simple Moving Averages (pink for current, aqua for previous). At the bottom is the Moving Average of Oscillator (incomplete because I believe that a second MA must be shown on the chart), and between the two is the Traders Dynamic Index for comparison. (The function of the Envelope is analogous to the Price Action Channel in EASY, although the Envelope is not smoothed as much as the PAC, which uses two SMAs shifted up and down by 5).

The background colour is chosen to be reminiscent of the Phoenix's home in the sands of Egypt. I would also like to add Phoenix Buy and Sell arrows, as in the other indicator, but these do not seem to work on this chart template.

If anyone has suggestions for improvements or can offer instructions to incorporate Signals 3 and 4 into the chart, I would be very grateful.

 

Phoenix 6 is close, maybe you would prefer to wait for it instead, because the system is much easier to change. I'll move some variables around so you can see the contents if you like.

 

Phoenix 5.7.2 Chart Template

Now that I've wasted so much time trying to create this template, I'm not in a hurry to abandon it. What signals does Phoenix 6 use?

Could someone suggest how I can incorporate Phoenix's Signal 3 into the Chart Template? Does it require a modification of MACD or something else?

 
daraknor:
I'm looking at the code, and trying to figure out what the trailing stop would be at a certain point. I'm assuming that as my profit increases, my trailing stop increases? Please keep in mind that each broker has a minimum distance between current price and the SL value you are allowed to set, and breaching that minimum distance results in trade errors. MODE_STOPLEVEL is the constant with the minimum distance, in pips.

An alternative might be:

(tp-CurProfit)/tsScale >=MODE_STOPLEVEL

With a profit of 10 pips, and a take profit of 50 pip, the trailing stop would be 40 pips if the tsScale=1, 20 pips if tsScale=2.

With a profit of 30 pips and a tp of 50 pip, the ts would be 20 pip (locking in 10 pip profit) if the tsScale=1, and 10 pip if tsScale=2

Having a really large ts just means you're running a trending system. An optimized value might look great, but a forward test might look horrible. Run it with 3 months optimization and then 3 months testing on unoptimized data. I bet in many cases, they will look vastly different. What is your largest profit (in pips if you can) in testing? Was it a news event?

What the code is doing is shrinking the trailing stop as you get higher to decrease what is on the table the higher you get. That is what someone was asking for. I will need to ensure that the ts will not go below the minimum like you are telling me.

The weird thing about it is that only once the profit - TS exceeds zero will my new code get executed. I want my code to operate as soon as we get 1 pip in the profit not the way it is now. The journal shows the print statement output, so I could see if the code was working correctly. I left it in so people can see what is happening for the time being. I will work on a couple more fine tunings.

1. Make it kick in above zero.

2. Make a TP an equal number of pips above current price as TS is below point.

3. Make sure that the SL or TS is not too tight to make the trade illegal.

Optimized vs non-optimized data. I think this is a very crucial point, and the details of this testing needs to be in a testing guide. I would want to optimize over two entire years. Look at the graph and be happy the more straight the profit line is. This is the opposite of trying to tune it for the latest month. One month can be totally different than the next month. I think that kind of optimization is relatively useless.

I fix bugs, and try coding, you Daraknor warn me about these details that kill the beginners and someone else can test and determine the suitability for live testing.

The thing about these two new parameters is that if someone uses these, they are not using the SL or TP because I will be controlling those. Now the added problem might be if they decide to use breakeven after pips, I don't know what the code will do. That would be a fourth item to fix if the results are terrible.

I think a TS of 45 is not as wacky as a SL of 82 which is what Phoenix does in some pref settings.

Phoenix, breaks conventional Forex advice. That advice being the TP should be twice the SL. I know it's counter trending system.

Even with the TS in place right now the system will still go down the 82 points and hit the SL.

 
autumnleaves:
Now that I've wasted so much time trying to create this template, I'm not in a hurry to abandon it. What signals does Phoenix 6 use? Could someone suggest how I can incorporate Phoenix's Signal 3 into the Chart Template? Does it require a modification of MACD or something else?

Putting MA on the chart and visually detecting MA crosses may help, but it is hard to use that to figure out what Phoenix is doing. Phoenix 6 will assist you (using the same signals) by reporting the magnitude as well as sign of result data.

 

Honestly it doesn't matter what the ratio of tp:sl is. Ours is 0.5, but 1.0 is common advice so certain math is easier.

sl/(tp+sl) is a critical number. Win percentage must be greater than this number, or you're loosing money. (see edit below)

Most essentially random systems will have a win percentage = (tp-spread)/(tp+sl) which means that they loose money at a rate equal to 'the house take' to use gambling terms. Multi step Martingale systems demonstrate this principle *very clearly*, even with complicated exit strategies.

One thing I try to do, which seems rather rare, is 'grok' the essence of what I'm doing. When I look at charts, I don't see numbers or patterns. I see dynamic forces pushing and pulling different directions, and I want to figure out why. Lots of techniques will optimize well, but they won't work because the technique is lacking fundamental understanding of pushing and pulling forces.

A physics friend describes financial markets as (and I paraphrase) "an oscillating pendulum riding a wave struck by a hammer" because that describes the type of graphs he sees. Why? We need to ask the hammer (noise within candlestick), the pendulum (short term movements) and the wave (trends). I probably have the quote wrong too.

Edit: Sorry about the bad math above, I'm rather sleepy. Use MACD EA sample without trailing stop to verify.

Random Win chance = ((sl-spread)/(tp+sl))

Random Loss chance = 1-((sl-spread)/(tp+sl))

 

about optimization

Hi daraknor and all friends...

I'm planning to try Phenix with 5 different pairs in one account at the same time. Deposit in this account will be for example - 5000.

What deposit level I need to place in the expert settings to optimize each pair?

May be 5000 (depo)/5 (pairs number)=1000.? Or I'm wrong?

Reason: