[EA] – Charles 2.1.5
Author:afabiani (2012.09.25 16:37)
mq4 [EA]   Charles 2.1.5 Charles2.1.5.mq4 (81.4 Kb) View
mq4 [EA]   Charles 2.1.5 Charles2.1.8a.mq4 (83.6 Kb) View

StrategyTester small [EA]   Charles 2.1.5


This version of the EA is much more complex than prior versions. The main concept is the same, uses stop orders on break-outs and hedges loosing orders, trying to close always on positive.

Other than this this version introduces a lot of capabilities:

  • Checks for special volatility conditions in order to open Orders below the spike
  • Checks for trening condition in order to try to follow the trend when possible
  • Introduces the concept of Pivot, Resistances and Supports, computed every hour in order to minimize the loss of loosing orders by catching a good price retrace
  • Introduces the concept of Orders Basket in order to compensate loosing orders as soon as possible and minimize the drawdown
  • Exposes a lot of configuration parameters allowing to tweak out the strategy


NOTE: In case of “zero divide” error, you must check the list of symbols provided on “Symbols” parameter. There can be two possible issues 1) your broker does not support all or some of the symbols specified (you MUST use only supported symbols by your broker) – 2) your broker uses different names for symbols, as an istance intead of EURUSD it uses EURUSDm or EUR_USD … you MUST use the names provided by your broker.

If you plan to use the EA on a single chart and a single symbol at time, just attach the EA to the corresponding chart, pay attention to the MagicNumber and leave the Symbols filed empty.


0) The TimeFrame is not important. The EA check internally the timeframes he needs.

1) Symbols; Comma separated list of symbols you want the EA to manage on a single instance. If empty the EA works *ONLY* on the current chart/symbol


2) MagicNumber; Assigned to *every* order handled by the EA
MagicNumber = 3939;

3) xFactor; Multiplier for *HEDGE* orders.
xFactor = 1.8;

4) TimeSet; Broker time. It’s used to reset the pending orders every day.
TimeSet = “07:32”;

5) RiskPercent; Try to recover loosing orders if the balance goes down this percentage.
RiskPercent = 5;

6) RiskPerTrade; Risk for every LOT automatically computed by the EA. In any case the EA cannot open a LOT minor than the MINLOT. If “0” the EA will use the fixed LOT value taken from Lots field.
RiskPerTrade = 10;

7) MaxAllowedOrders; Max number of *accessory* orders. Those orders are special orders opened under particular conditions, i.e. special Volatility spikes or RSI+MMA trend condition matched.
MaxAllowedOrders = 15;

8) MaxOpenHours; Every opened order will be closed if it’s age is higher than this value. “0” means do not check the order age.
MaxOpenHours = 0;

9) ProfitCheckPeriod; Number of 15m bars of flattened market to take into account in order to close a winning order. This works *ONLY* if the whole profit is positive.
ProfitCheckPeriod = 3;

10) Aggressive; If TRUE means consider H1 timeframes for breakouts instead of H4 and Daily. Rise up considerably the amount of trades. Dangerous.
Aggressive = false;

11) UsePivots; If TRUE pivots, resistances and supports will be used to recalculate TakeProfits of loosing orders. In that case they can be closed in negative, trying to minimize the loss. Pivots are checked every hour.
UsePivots = true;

12) Params used for RSI+MMA trend condition checks.
FastPeriod = 18;
SlowPeriod = 60;
Selectivity = 14;

13) Lots; Fixed value to use in case RiskPerTrade = 0.
Lots = 0.01;

14) Slippage; Slippage in PIPS.
Slippage = 3;

15) ECN; Support for ECN accounts.
ECN = true;

16) MarginPercent; Try to preserve this amount of margin before opening more orders. Does not prevent losses for already opened trades.
MarginPercent = 20;

17) StopLoss; Stoploss in PIPS.
StopLoss = 0;

18) Trailings values applied to the winning order *ONLY* when you have ALL positive profits. In other cases a *BASKET* is used by the EA which will try to close as much as possible loosing orders with just one winning order.
TrailStart = 20;
TrailingAmount = 3;

19) TakeProfit; Offset applied to the Pivots computed TakeProfits.
TakeProfit = 20;

20) AllOrders; If TRUE will ignore the MagicNumber and will manage all the orders doeneding on the AllSymbols setting.
AllOrders = true;

21) AllSymbols; It TRUE will ignore the managed Symbols and will manage all the orders.
AllSymbols = true;

22) LogToFile; If TRUE writes logs to a file.
LogToFile = false;

23) InitResetOrders; If TRUE resets the Pending Orders at init time.
InitResetOrders = true;


StartHour = 0;
EndHour = 24;
CloseAllNow = false;
FridayCloseTime = 0;

Traiding allowed hours and force close conditions. CloseAllNow will forcibly *CLOSE* ALL ORDERS. FridayCloseTime will forcibly *CLOSE* ALL ORDERS after this Friday hour; “0” means ignore this and leave the orders opened.

17 comments: 1 2   To post a new comment, please log in or register



Could you explain me , because when I try to backtest , Ihave two errors :

one volume error

and ex. gbp/usd divide 0

04.07.2013 17:29 patrickmql

This is a good, EA, if some one use with MM rules,  Good work, keep it
20.05.2013 20:18 nanoforex

Also what is the difference between 2.1.5 and 2.1.8a?

This EA is really interesting. I forwardtest both 2.1.5. and 2.1.8a. aparently there are no differences, but:

*  2.1.5. works very goog untill it gets crazy and start opening a lot of orders with no sens and blow the account.

*  2.1.8a, so far so good. Maybe the bugs are fixed and that is the difference between both versions..

29.03.2013 18:30 azure

I would know when it’s necessary to open a graph for each currency taht i want to trade with this EA ?
04.03.2013 10:28 jeanclaudecanar

Just got my account blown out wtf!
24.02.2013 16:12 zsuperpips

I just have a quick look to your ea’s code, you  are a very good coder. Just to thank you for your gift to the community. I hope I had more time to analyze it in detail. I read so many codes that I suppose I am now able to recognize a great work at a glance. 10/10
16.02.2013 14:24 lobev

76% modelling quality is not a valid backtest…
03.01.2013 23:55 Radiologyandrew

Grafiknya Mantabs
08.12.2012 17:55 Darman

05.12.2012 16:58 forfolio