| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| Automatic Loss Recovery System (ALR) - read this first https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3682 |
Page 8 of 40 |
| Author: | Dewey McG [ Tue Jun 24, 2014 10:50 am ] |
| Post subject: | Automatic Loss Recovery System (ALR) |
Thanks for all your hard work. I will look at this tonight when I will have more time. |
|
| Author: | kotsh [ Tue Jun 24, 2014 3:57 pm ] |
| Post subject: | Automatic Loss Recovery System (ALR) |
Hey Dewey, After a bit of re-thinking, the trade opening logic I wrote might be a bit overly complicated since I somehow "forgot" we could just open pending trades rather than the EA tracking the price movement. So below is an alternative way to write the EA code based on pending orders. Coding wise I think this approach would be much simpler than the first one and also it gives us more flexibility in which trades to include for net profit calculation and the ability to re-attach the EA to the chart. Let me know your thoughts and if you can find anything wrong with the logic. ================================= The EA Input section in the sheet would obviously be the input parameters when the EA is attached to the chart. We should add here a few more parameters: - Initial_TradeID: the ticket number of the trade we want to apply ALR to, this will allow us to open other trades on the same pair without interfering with the ALR EA operation - H_Trade_count: number of already active hedge trades, 0 by default - P_Prade_count: number of already active P trades in original direction, 0 by default' These 2 counters would be particularly useful if we for some reason have to re-attach the EA to the chart when there was already previously opened trades. The EA should make a sanity check that the H counter is either equal to the P trade count or larger by exactly 1. (H_Trade_count-P_Trade_count = 0 OR 1) - Trades_to_monitor: 1: Only Initial_TradeID+ALR trades: means the EA will monitor the net profit of the original trade that started ALR recovery 2: Monitor net profit of all trades on the pair regardless if they were opened by ALR or any other means 3: Monitor net profit of all trades on the account regardless if they were opened by ALR or any other means - Magic_number: the ALR EA should attach a unique magic number or comment to each trade it opens so it can track the trades for total profit and only closes the relevant trades. Also if we re-attach the EA to the chart we want it to know which trades were previously opened The EA initialization section in the sheet would be the initial calculations that the EA performs and stores the values in 2 arrays, one is the H (hedge) array, and the other is the P (position) array. Note: The formulas I posted in my first post had a typo in it, the correct version was used in the excel sheet H(n) = {[(sum_of_P(n-1)+A)(z+h) +C]/[s+h]} - sum_of_H(n-1) P(n) = {[(sum_of_H(n)(z+h+s) + C]/[p+s]} - [sum_of_P(n-1) + A] Lets assume that the ALR zone boundary levels are named as follows: - Zp = original trade entry level - Zh = original trade SL level When the EA initializes it will do the following: if (H_trade_count = P_Trade_count ) --> this means first pending order placed should be H order then - place a pending order from the H_array[position H_Trade_count] at level Zh and set magic_number, TP and SL from inputs - store trade ID of pending order - Increment H_Trade_count by 1 (now H_trade_count will be larger than P_Trade_count by 1, which means the next trade EA opens is a P trade) else if (H_trade_count = P_Trade_count+1) ----> this means first pending order placed should be P order then - place a pending order from the P_array[position P_Trade_count] at level Zp and set magic_number, TP and SL from inputs - store trade_id of pending order - Increment P_Trade_count by 1 (now P_trade_count will be equal to H_Trade_count, which means the next trade EA opens is a H trade) Steady State: The EA monitors the net profit of the Initial_TradeID + ALR trades (magic_number) and other trades based on the "Trades_to_monitor" setting. Once the net profit of the "Trades_to_monitor" reaches the predefined value in the EA input, all trades are closed. If pending order with trade_id is triggered, then just repeat the steps described in the initial operation. Because of the counter values, it will know whether to open a H or P trade and the position in the array from which it can determine the pending order size. |
|
| Author: | wealthmaster [ Tue Jun 24, 2014 5:49 pm ] |
| Post subject: | Automatic Loss Recovery System (ALR) |
I think your calculation on spreadsheet is abit out.. Please check yourself.. Attached is my screenshot. |
|
| Author: | Dewey McG [ Tue Jun 24, 2014 11:38 pm ] |
| Post subject: | Automatic Loss Recovery System (ALR) |
I did a quick look and saw that the lot sizes were much larger, this vastly increasing the exposure and the risk. Joseph Nemeth was the original person who came up with this idea. The numbers I used came from Gary who took them from a post showing Joseph's numbers. I believe he tweaked them to make them even better. I believe Dustin Pass' formula came from an earlier version of Joseph's system. In any event we should use the numbers provided by Gary which are on the ALR Calculator because the lot sizes increase at a slower rate which means less exposure and risk. I really like Kotsh's idea of adding spread to the calculations and using logical TP levels, but we need to use the safer numbers as a baseline. I am dead tired from working some crazy hours this week so I might not be checking back until tomorrow. |
|
| Author: | wealthmaster [ Tue Jun 24, 2014 11:41 pm ] |
| Post subject: | Automatic Loss Recovery System (ALR) |
yes, That's what my take too, lots should increase at a slower pace. |
|
| Author: | alextavares [ Wed Jun 25, 2014 12:13 am ] |
| Post subject: | Automatic Loss Recovery System (ALR) |
Hello, congratulation for good work, here is myfxbook link runnig 28 pairs http://www.myfxbook.com/members/alextav ... alr/956422 |
|
| Author: | garyfritz [ Wed Jun 25, 2014 5:20 am ] |
| Post subject: | Automatic Loss Recovery System (ALR) |
I chose the sizes that "just barely" got the ALR trades into breakeven/profit. I believe those numbers will result in the slowest growth, assuming you don't want to accept any losers in the ALR turns. Larger sizes would produce more profit from the losers, but the size will grow much faster. Eventually, if the market keeps going against you, you'll have to bail out and accept a Martingale blowup. Here's an alternate idea: rather than ever accepting a Martingale blowup, you can set the thing up so it gradually unwinds the position. In this example, you go long X for the first trade. If that fails, you go short 2*x-.01, so now you're net short X-.01. Then each step you reduce the size a bit, reducing the net exposure until you ease out of the trade. So let's assume the original trade has a 25% chance of hitting the TP. (That's the chance of a random entry hitting a 3:1 TP.) 25% of the time your initial trade wins, and you win 15.00. 25% of the remaining 75% of the time you reverse once and win 8.50, and so on, gradually reducing the position size until you unwind the whole thing. You NEVER have a Martingale blowup this way. However if you calculate the probabilities of making N turns (assuming the 25% win rate) and figure how often you make 15.00, 8.50, etc -- then the long-term average profit per "trade and N ALR reversals" is ... zero. And that's before costs. You just can't spin straw into gold. Dewey, I believe you've been working with a model that risks a limited blowup on rare occasions, yes? I VERY VERY STRONGLY suspect it does the exact same thing, over a longer timeframe. You make lots of trades showing lots of small profits, and then the limited blowups give all those profits back. You might get lucky and make some profits before you quit, or you might get unlucky and take a bunch of blowup losses right at the start. But over the very long run, I suspect the net profits will be zero -- before costs. TANSTAAFL... Gary |
|
| Author: | kotsh [ Wed Jun 25, 2014 9:14 am ] |
| Post subject: | Automatic Loss Recovery System (ALR) |
Hi Wealthmaster, thanks for pointing that out. I should have divided the C parameter by 10 assuming we are using standard lots because the pip value of std lot = 10 $ not 1 $. I corrected this in the sheet and it should be ok now. Find attached below. until we agree on the formula, is anyone keen to start writing the EA code? Static values can be used in the table that holds the trade sizes for testing. Cheers! |
|
| Author: | Dewey McG [ Wed Jun 25, 2014 11:34 am ] |
| Post subject: | Automatic Loss Recovery System (ALR) |
I will be gone all day and then we have guests arriving tonight. Before we start any serious coding I want to do a side by side comparison between the different settings (Original vs Kotsh vs Gary's new ones) so we can decide which is the best way to go. I will try to do this late tonight but if I can't then will do so tomorrow. |
|
| Author: | alextavares [ Wed Jun 25, 2014 7:27 pm ] |
| Post subject: | Automatic Loss Recovery System (ALR) |
Today the EA close a gbpnzd trades, but was closed in loss, if the ea leave the price going dow it could be in profit, we need that EA include comission and swap and close a trade when in profit total trade is in excel , comission= 7,91 , swap = 2,72 trade =5,18 total = 15,81 loss |
|
| All times are UTC | Page 8 of 40 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|