stevehopwoodforex.com
https://www.stevehopwoodforex.com/phpBB3/
Print view

Trend Trading EA with Automated Loss Recovery
https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3719
Page 3 of 14
Author:  Gordon [ Thu Jul 10, 2014 1:57 am ]
Post subject:  Trend Trading EA with Automated Loss Recovery

Hi Spider,

Thank you for this fine work. I was just backtesting it on my criminal, FXCM, which is not an ECN broker in that the SL and TP can be entered all at once with the order. Not to critisize but just report my findings, when CriminalIsECN is set to false in the inputs, it doesn't work, so I just left it to true, no problem. I tested EURUSD H4 with 10k start balance from 01-01-2013 to present. I wanted to try it with a NON-HEDGE mode, so I tried setting the StopLoss = 49 (instead of 200) to close the already open trade before it reached the other side of the ALR zone, however the StopLoss stayed fixed at 200. But something must have changed because the profits went up from $898.80 on default to $4268.65. The drawdown also increased slightly from 7.37% RDD to 12.67% RDD. Also, I noticed if you set TradeShort=false, it will ignore that and trade short anyway. Perhaps you could add a NON-HEDGE mode so it can't buy and sell at the same time when activated. Being handicapped here in the U.S. with no hedging, I also consider to buy only on EURUSD and sell only on the EURCAD for instance. With this EA I would have to test if the basket would close them both at TP. Without a multicurrency backtest, forward testing could be done and would take longer. Thanks again. :good:
Author:  SpiderX [ Thu Jul 10, 2014 2:03 am ]
Post subject:  Trend Trading EA with Automated Loss Recovery

Gordon » Thu Jul 10, 2014 9:57 am wrote:Hi Spider,

Thank you for this fine work. I was just backtesting it on my criminal, FXCM, which is not an ECN broker in that the SL and TP can be entered all at once with the order. Not to critisize but just report my findings, when CriminalIsECN is set to false in the inputs, it doesn't work, so I just left it to true, no problem. I tested EURUSD H4 with 10k start balance from 01-01-2013 to present. I wanted to try it with a NON-HEDGE mode, so I tried setting the StopLoss = 49 (instead of 200) to close the already open trade before it reached the other side of the ALR zone, however the StopLoss stayed fixed at 200. But something must have changed because the profits went up from $898.80 on default to $4268.65. The drawdown also increased slightly from 7.37% RDD to 12.67% RDD. Also, I noticed if you set TradeShort=false, it will ignore that and trade short anyway. Perhaps you could add a NON-HEDGE mode so it can't buy and sell at the same time when activated. Being handicapped here in the U.S. with no hedging, I also consider to buy only on EURUSD and sell only on the EURCAD for instance. With this EA I would have to test if the basket would close them both at TP. Without a multicurrency backtest, forward testing could be done and would take longer. Thanks again. :good:
Hi Gordon,

The basis of ALR is that you must trade Long and Short at the same time.
So if you cant, then it would not be helpful for you...please read the previous discussions and spreadsheets from Dewey.

ALR mode would automatically modify the initial stoploss and tp to the settings input for ALR.
Tradeshort and TradeLong only applies to the initial position and ...if this limitation was coded into the ALR...it just wouldnt work anymore.

If you wish to just trade this strategy without the ALR, you can set useAutomatedLossRecovery to false.

Cheers
Author:  SpiderX [ Thu Jul 10, 2014 2:09 am ]
Post subject:  Trend Trading EA with Automated Loss Recovery

Gordon » Thu Jul 10, 2014 9:57 am wrote:Hi Spider,
But something must have changed because the profits went up from $898.80 on default to $4268.65. The drawdown also increased slightly from 7.37% RDD to 12.67% RDD.
imo...ALR works like a grid, i.e get ready to risk 10-15% to earn 1%. That is the price to pay for increasing your win rate to almost 100% (if you are very very lucky)

Cheers
Author:  Gordon [ Thu Jul 10, 2014 12:41 pm ]
Post subject:  Trend Trading EA with Automated Loss Recovery

Hi Spider,
Thanks for replying. I had watched a good portion of Dustin Passes' presentation on ALR and I believe he claimed it would still function in a non-hedging mode. I figured out what happened to the profits. Although I kept the Risk_Percent=2, the lot size adjusted itself based on the smaller StopLoss. So when I decreased the StopLoss by a factor of 4, from 200 to 49, it automatically increases the starting lot size from 0.1 to 0.4 thereby maintaining the the same risk. This calculation makes sense. The bug is that the StopLoss does not actually change on the chart, even though you change it in the inputs. :lol:
Author:  SpiderX [ Thu Jul 10, 2014 2:02 pm ]
Post subject:  Trend Trading EA with Automated Loss Recovery

Gordon » Thu Jul 10, 2014 8:41 pm wrote:Hi Spider,
Thanks for replying. I had watched a good portion of Dustin Passes' presentation on ALR and I believe he claimed it would still function in a non-hedging mode. I figured out what happened to the profits. Although I kept the Risk_Percent=2, the lot size adjusted itself based on the smaller StopLoss. So when I decreased the StopLoss by a factor of 4, from 200 to 49, it automatically increases the starting lot size from 0.1 to 0.4 thereby maintaining the the same risk. This calculation makes sense. The bug is that the StopLoss does not actually change on the chart, even though you change it in the inputs. :lol:
Hi Gordon,

The ALR takes over the stoploss once it is active.
Maybe to make realistic sense of the stoploss, you should set it to be the same as ALRTargetPips + ALRZonePips and yes..this makes the stoploss larger than the tp.
If you can elaborate more on how the non-hedging mode works, we can consider how to code it into the EA.

Cheers
Author:  Gordon [ Thu Jul 10, 2014 3:49 pm ]
Post subject:  Trend Trading EA with Automated Loss Recovery

Set Hedging_Allowed=false to test it. The SellEntryPrice will become the StopLoss for a long position and visa versa. I think it is working the way I intended.
Author:  SpiderX [ Thu Jul 10, 2014 4:16 pm ]
Post subject:  Trend Trading EA with Automated Loss Recovery

Gordon » Thu Jul 10, 2014 11:49 pm wrote:Set Hedging_Allowed=false to test it. The SellEntryPrice will become the StopLoss for a long position and visa versa. I think it is working the way I intended.
Hi Gordon,

Maybe it is good that you explain to everyone what you are trying to do since not everyone is code-literate.

Cheers
Author:  Gordon [ Thu Jul 10, 2014 7:05 pm ]
Post subject:  Trend Trading EA with Automated Loss Recovery

Quite simply StopLoss input doesn't work and I would prefer to have it work so that I can set it to any level I want; inside the ALR zone or outside the ALR zone. Inside the ALR zone would let it close a buy order before it hits a pending sell order. If the StopLoss was outside the ALR zone, it could still work fine if the broker allows hedging. I do not consider myself code literate. I posted the code v1.03 with my hope being that one of the masters here could take a look at it and see a better way to code the changes than what I did. The test results graph I posted does not look very impressive on the surface until you realize that the big loss at the end of the graph was a trade from earlier which did not get a stoploss at all. When the test ended, that one trade took a $3000.00 loss. If this happened in live trading you would have noticed the failure soon enough and placed a stop in manually. I still think this EA is a great concept and has legs. The complex part is already completed and nicely done.

I don't know too much about code, but I will share with you this concept; it is always good to have a backup plan or system built into the EA. You may have noticed some EA's have a "stealth" mode for example where the broker doesn't see the stoploss while other EA's use a firm stoploss placed on the brokers' server. Well what happens if your EA was suppose to modify an order to place a stoploss and for whatever reason it failed to deliver. Now you are exposed to potential losses. So in my opinion it is best to have both types of stoploss running at the same time. If the modify order fails, you still have some code running in the background taking measurements until the invisible "stealth" stoploss is hit and the close trade order is given. The "stealth" code stoploss for a sell trade might resemble something like:

if (Close[0] - OrderOpenPrice() > stoploss * points) close_all;

Good luck and trade safely :!!:
Author:  Dewey McG [ Sat Jul 12, 2014 5:10 pm ]
Post subject:  Trend Trading EA with Automated Loss Recovery

I finally had a chance to do some testing. I used the EURNZD and have attached the preset so you can check to make sure I didn't make any errors. The good news is that it works well in that the most turns over the last 5 years was 7 and it makes a nice little profit. The bad news is that there are some errors in that the lot sizes are not calculated correctly. The sequence with .1 lots should go as follows: 0.10, 0.14, 0.09, 0.12, 0.17, 0.22, 0.29, 0.39, 0.52, 0.70, 0.93 1.24 1.66, 2.21, 2.95. The EA goes .2, .2, .1, .2, .2 etc.
Author:  Fibotrend [ Sat Jul 12, 2014 11:58 pm ]
Post subject:  Trend Trading EA with Automated Loss Recovery

Dewey McG » Sat Jul 12, 2014 5:10 pm wrote: The bad news is that there are some errors in that the lot sizes are not calculated correctly. The sequence with .1 lots should go as follows: 0.10, 0.14, 0.09, 0.12, 0.17, 0.22, 0.29, 0.39, 0.52, 0.70, 0.93 1.24 1.66, 2.21, 2.95. The EA goes .2, .2, .1, .2, .2 etc.

Does that mean the system works even if you open and close the same lot size? :?
All times are UTC Page 3 of 14