| stevehopwoodforex.com https://www.stevehopwoodforex.com/phpBB3/ Print view |
|
| StackMan (A profit-based scale-in manager) https://www.stevehopwoodforex.com/phpBB3/viewtopic.php?t=3151 |
Page 1 of 3 |
| Author: | Radar [ Fri Sep 13, 2013 7:29 am ] |
| Post subject: | StackMan (A profit-based scale-in manager) |
Hey Gang, Just over 12 months ago, I wrote this post, http://www.stevehopwoodforex.com/phpBB3 ... 963#p21963 hoping that someone would be interested in coding a basic manual traders' EA, as I have no idea how to code. From the replies I received, it seems most manual traders prefer to use scripts, and so I didn't pursue it. A few months later, I dropped a few posts here, http://www.stevehopwoodforex.com/phpBB3 ... 650#p38650 about what I called, (for want of a better term), Martinscaling. The idea was to only use a portion of a trend trade's locked-in profit to cover the potential loss of a scale-in trade, thereby possibly compounding the profit, without compounding the risk to our balance. As the trend continues, we continue scaling in, eventually doubling the lotsize, (hence the silly term). Well, I've finally gotten to the point where I can CPE code, and so I've merged the two ideas into my first working EA Here's the user inputs... LotSize & Scale-In Settings BaseLot = 0.01; Minimum LotSize you want to use for the first trade of a run... When there is enough profit locked in with stoplosses, this will be doubled, then eventually doubled again. InitialSLPips=60; StopLoss of first trade of a run only... Scale-In trades' stoploss is calculated based on type of moving stoploss used... If using JumpingStop, then scale-in trades' stoploss at entry is JumpingStopPips + BreakEvenTargetProfit, (even if you don't use BreakEven). If using JumpingStop with TrailingStop, then scale-in trades' stoploss at entry is the larger of either JumpingStopPips + BreakEvenTargetProfit, or TrailingStopPips + BreakEvenTargetProfit. If using CandlestickTrailingStop, then scale-in trades' stoploss at entry is CstTrailCandles + 1 Candlestick. BuyProjectedProfitPips=1200; Used to determine when to stop scaling-in... Added to Ask to determine BuyPPPrice... When Ask is either JumpingStopPips*2, TrailingStopPips*1.5, or BreakevenPips*1.5 (the lowest value of whichever combination that you enable) below BuyPPPrice, stop scaling-in. SellProjectedProfitPips = 1200; Subtracted from Bid to determine SellPPPrice. When Bid is either... (as above), above SellPPPrice, stop scaling-in. UsePPAsTakeProfit=false; If true, sets the same TakeProfit price for all trades in this run. ProfitToRisk=1; How much of your locked-in profit do you want to risk? 1 = All, 2 = 1/2, 3 = 1/3, etc. MaxSILevel=3; Maximum times you want to double-up your lotsize for this run. Trade Management Settings BreakEven=true; Move stoploss to BreakEven before activating JumpingStop, TrailingStop, or CandlestickTrailingStop. BreakEvenTargetPips=20; How far into profit price action has to be before moving stoploss to BreakEven. BreakEvenTargetProfit=5; When moving stoploss to BreakEven, add this many pips, for a bit of profit in your pocket. If using BreakEven, you must use either JumpingStop or CandlestickTrailingStop, in order to lock in enough profit to allow scaling-in. JumpingStop=true; Use a Jumping StopLoss? JumpingStopTargetPips=20; Every time that market price is +40 pips away from our stoploss, move stoploss +20 pips AddBEP=false; Add BreakEvenTargetProfit to each jump of stoploss... Market price is +40pips from SL, move SL +25pips. JumpingStop is the only moving stoploss that can be used on its own, as it both locks in enough profit to allow scaling-in, and has a consistant "look forward" distance, which is used with (Buy/Sell)ProjectedProfitPips to determine when to stop scaling-in. UseCandlestickTrailingStop=false; CstTimeFrame=0;//Defaults to current chart CstTrailCandles=1;//Defaults to previous candle If using CandlestickTrailingStop, you must use either BreakEven, or TrailingStop, as they both have a consistant "look forward" distance, which is used with (Buy/Sell)ProjectedProfitPips to determine when to stop scaling-in, whereas CandlestickTrailingStop does not. TrailingStop=false; TrailingStopTargetPips=20; How far do you want your trailing stop to be behind market price? The TrailingStop is hidden from the broker... It is monitored only on your Empty4 client... Lose your connection, and you lose your trailing stop. If using TrailingStop, you must use either JumpingStop or CandlestickTrailingStop, in order to lock in enough profit to allow scaling-in. Trade Comment, ECN Crim, etc. TradeComment="StackMan"; The EA will add _Symbol()_Period() to the comment, in case you run it on multiple symbols and timeframes. IsGlobalPrimeOrECNCriminal=true; Does your crim require orders to be sent in 2 parts? MaxSpread=12; Obvious? MaxSlippagePips=5; Obvious? Button Co-Ordinates BuyButtonX=1500; I was in a rush to get the buttons working, so didn't look to find out how to BuyButtonY=100; automatically park the buttons in the corner the user prefers... You'll have to CloseAllButtonX=1500; experiment, until I update the EA. CloseAllButtonY=150; SellButtonX=1500; SellButtonY=200; Margin Checks (See Steve's shell for an explanation of these). UseScoobsMarginCheck=false; UseForexKiwi=true; FkMinimumMarginPercent=1500; See next message for usage. Things to do... Find a better way to re-position the buttons... Add quick-keys... Find a way to automatically determine (Buy/Sell)ProjectedProfit... Enable updating of settings via GlobalVariables, using scripts.... Find a way to automatically determine StopLosses (& BreakEven?). Have fun! Radar =8^) |
|
| Author: | Radar [ Fri Sep 13, 2013 7:47 am ] |
| Post subject: | Re: StackMan (A profit-based scale-in manager) |
StackMan Usage. This is a scale-in manager for manual trend trading. If you can consistantly... Enter early on long trends... Hit a high TakeProfit target, (or low, as the case may be)... Select a JumpingStop that gets to your TP within 6 or more jumps, or Select a CandlestickTrailingStop distance (plus BreakEven), that gets to your TP, ...then this EA will put a little extra into your balance with every successful run, (a failed run just isn't a run, it's just your initial trade, gone to stoploss), whilst you minimize your risk at entry. So, you spot a potentially good mover, drop the EA on your chart, and configure as you would for a normal trading/management EA... What you would normally use for TakeProfit is entered into either the BuyProjectedProfitPips setting, or the SellProjectedProfitPips setting... Depending on your settings for selecting objects on the chart, either single-click or double-click the Buy or Sell button, then click and drag the button quickly. DON'T sit there holding the button... I've put a Sleep(1000) command between the send trade command, and the re-position button command, but if you hold the button too long, it will keep sending trades until you release it!!! (I'll eventually add quick-keys, but don't know how to do that yet). Now, you can either walk away, or sit back and watch. Each time your stoploss is moved further into profit, the EA uses your settings to determine whether there's enough profit locked in to cover the potential loss of a new trade... Once there's enough, it will enter the first scale-in trade, of BaseLot size. Scale-in trades will have their stoploss placed behind the previous in-profit trade's stoploss, (Below for Buys, above for Sells). From then on, with each move of your JumpingStop, a new scale-in trade is entered... By the third or fourth scale-in, there's enough profit locked in to cover the potential loss of a 2*BaseLot trade, and so the EA will double up... The EA will continue entering trades of the same size, then doubling up (up to MaxSILevel), whenever there's enough profit locked in to cover the potential losses. Once the EA has doubled up, it won't enter trades below that size again for the rest of that run. Each time you move a button to start a new run, CurrentBuySILevel or CurrentSellSILevel is zeroed, with BuyPPPrice, or SellPPPrice being re-calculated. If you use CandlestickTrailingStop, things look a little different... Due to the varying sizes of candlesticks, and the fact that I've set the EA up to place the scale-in trades' stoploss to CstTrailCandles +1 candlestick, scale-ins can take a bit longer to start, and doubling up may never happen in some runs. The best way to see how it works is to play with it in Empty4's slacktester... Drop it in there, and cherry-pick a good run... Play with the settings, try different combinations of stops, and watch it at work... Just don't try using those numbers in live trading. Have fun! Radar =8^) |
|
| Author: | Mike [ Wed Dec 04, 2013 7:33 am ] |
| Post subject: | Re: StackMan (A profit-based scale-in manager) |
Hi Radar I dropped on your contribution by chance. I will give it a try, because it might be what I am looking for, for quite some time. Does it work, did you find any bugs? Ready for life trading? How come your scale-in manager passed unobserved? Thanks. Mike |
|
| Author: | Radar [ Wed Dec 04, 2013 9:37 am ] |
| Post subject: | Re: StackMan (A profit-based scale-in manager) |
Hey Mike, I'm extremely crap at trading, so haven't had much luck with it I tested it over and over again on the same chart in Empty4's slacktester, cherry-picking my entries and adjusting stops until I could get a few good runs... The idea was to test the coding, not to find the best stop sizes for trading. I spent weeks coding and testing it... Around 4 hours every week-night, and all weekends, and, as far as I can tell, I've killed all the bugs. That being said, I cannot stress enough that you need to test it out thoroughly in the slacktester first... Cherry-pick long runs, use the various combinations of stops, and adjust the stops, ProfitToRisk, MaxSILevel, and ProjecteProfit until you get the maximum number of trades from each big move. Do this until you know exactly what the EA will do in any situation, then throw all of those numbers in the bin! You really need to know your manual system so that you can enter trades and stops, etc in your sleep, because the EA will be moving stops and scaling in based on your knowledge of the system and the Symbol/TimeFrame that you're working on. Once you know what it will do, then demo trade with it for at least a month. I most definitely don't recommend going straight to live trading with it after you've learnt how it handles things, but if you really want to, then do the following... 1) Set ProfitToRisk to something like 4 or 5. (1/4 or 1/5 of Locked-In Profit). 2) Set MaxSILevel to 0. (Scale-in trades will be BaseLot size). 3) Make sure you adjust BuyProjectedProfitPips and/or SellProjectedProfitPips to suit current market conditions before pulling the trigger. Once you are happy that your preferred combination of stops are working properly, you can begin lowering the number in ProfitToRisk, to increase the percentage of locked-in profit to be used to pay for scale-in trades, but don't increase the MaxSILevel for at least another month of successful usage. Once you're at the point where the majority of your final scale-in trades are closing in profit, then you can look at increasing MaxSILevel. Remember, this sucker doubles up! So, if you set MaxSILevel to 2, and price keeps running in your favour, it will enter a scale-in trade of BaseLot size, (as long as there's enough locked in profit to cover the trade), then when that trade hits BreakEven it will enter another trade of BaseLot size, then another 2 trades (one at a time), this time at 2*BaseLot... Any scale-in trades after that are at a max of 4*BaseLot. As to why it's just sitting here in a quiet corner of the forum... No idea... It's been downloaded 23 times, yet I've had no feedback... Either it's working so well that ppl want to keep it a secret, or it's utter crap, and ppl just threw it in the bin with a "Not worth the effort!". Follow the testing procedure, and decide for yourself which category it belongs to Good luck with your trading, and I hope the bot does the trick for you:) Have fun! Radar =8^) |
|
| Author: | Tebis [ Wed Dec 04, 2013 2:24 pm ] |
| Post subject: | Re: StackMan (A profit-based scale-in manager) |
Radar, thanks for sharing your EA. I started testing today: 1. pending trade EURUSD with MC No.5. was open at 15:44 2. 10 minutes later I took your EA on the chart (MC No.5) -> the first trade was 20 pips in profit 3. EA opened right away 8 additional trades = 0.32 Lot (with the right setup 2 x lotsize of first manual Trade) What could be the reason that it opened the 8 trades ? See att. setfile. Cheers Tebis |
|
| Author: | Radar [ Wed Dec 04, 2013 7:32 pm ] |
| Post subject: | Re: StackMan (A profit-based scale-in manager) |
Hey Tebis, It looks like it counted points as pips I'm seeing a bit of weirdness with the numbers... 1) The stoploss for the first trade is 15 pips into profit, yet BreakEvenTargetProfit is set to only 5 pips. 2) The average stoploss for the scale-in trades is 43 pips... Given that you've set CstTrailCandles to 2 candles, and scale-in trades get their stoploss set at CstTrailCandles + 1, it should have calculated a stoploss of approx 90 pips (given current ATR) for a potential scale-in, and not have entered any trades I've looked through the code, and can see no reason why this has happened For now, I can only recommend that you use MPTM to manage your trades, and set pending orders for your scale-in trades. Meanwhile, use StackMan in the backtester (visual mode), using your usual trading method, and see if it does the same thing... If it does, then pause it, and take pictures of the results tab, and the chart, and send those, with a copy of the log file, (the log file will be in tester\logs) thanks... They may tell me what's going on. I hope you were able to close those trades in profit, and that it was only demo. Have fun! Radar =8^) |
|
| Author: | Mike [ Thu Dec 05, 2013 3:18 pm ] |
| Post subject: | Re: StackMan (A profit-based scale-in manager) |
Thanks a lot for your very clear and detailed testing procedure description - for me its a great help Mike |
|
| Author: | Tebis [ Sun Dec 08, 2013 1:20 pm ] |
| Post subject: | Re: StackMan (A profit-based scale-in manager) |
All trades closed in Profit !! |
|
| Author: | Radar [ Mon Dec 09, 2013 7:41 am ] |
| Post subject: | Re: StackMan (A profit-based scale-in manager) |
Hey Tebis, I'm glad that worked out well for you, then Have fun! Radar =8^) |
|
| Author: | Tebis [ Mon Dec 09, 2013 11:01 am ] |
| Post subject: | Re: StackMan (A profit-based scale-in manager) |
Radar, I get the following message in the Expertlogfile |
|
| All times are UTC | Page 1 of 3 |
|
Powered by phpBB® Forum Software © phpBB Limited |
|