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^)