KLEO SYSTEM SET
KLEO SYSTEM SET - multicurrency, multisystem and multifunctional Expert Advisor. Using only two level sets (KLEO INDICATOR SET), as well as various types of position tracking and closing, selected money management system and other additional conditions, the Expert Advisor allows creating profitable trading systems meeting the requirements of different categories of users.
The Expert Advisor contains 5 independent parameter groups. Each group allows using up to 10 currency pairs (up to 50 symbols in total). The product also allows performing a limited number of operations per day or trading around the clock. It supports semi-automatic trading - trailing positions opened manually according to the Expert Advisor parameters. The Expert Advisor includes two trailing types, four money management systems (including Martingale for fans), filtration system for loss-making deals, the way to quickly leave a "drawdown", etc. The product works with 4 and 5-digit quotes, has plenty of built-in checks allowing it to work in real trading conditions more confidently.
You can download KLEO INDICATOR SET indicator to be able to visually control the Expert Advisor's operation (it is not needed for the Expert Advisor's operation itself) and the free version of the offered Expert Advisor - KLEO SYSTEM TEST - allowing you to check the operation of trading functions and semi-automatic mode.
1. Description of the Systems, Operation Modes and the Product's Features
- Names of modes and parameters are written in bold type. In the table, the parameters are located in the same successive order as in the Expert Advisor.
- All the input parameters are specified as for 4-digit dimension. Recalculation for 5-digit quotes is automatic.
- Parameters having fl_ prefix are the switches (flags).
The Expert Advisor uses H1 for its operation regardless of the chart's time frame. If All input symbols mode is selected, the chart's symbol also does not matter.
The Expert Advisor contains two basic trading systems using channels of two types: modernized Price Channel (generated by price Highs/Lows for the specified period) and the channel consisting of fixed levels generated relative to the specified hour's Open price. Each system has several operation modes.
1.1. Opening Modes
SYSTEM 1 - the market entry signal is generated when the price exceeds the bounds of the channel consisting of equally spaced levels (the distance is defined by Level 1 parameter). If Level 1 parameter is positive, a position is opened following the breakthrough direction. Otherwise, the future rollback is considered. If Random parameter is enabled, market entry direction is randomized. The system has two modes:
- MODE 1 - the levels are calculated based on the Open price of the hour set in Open Hour parameter and saved till the same hour of the next day.
- MODE 2 (EVERY HOUR) - levels are calculated based on the Open price of the current hour and re-calculated every hour.
SYSTEM2 - the market entry signal is generated when the price exceeds the bounds of UPDATINGPRICE CHANNEL. Find out more about this channel and its operation principles in KLEO INDICATOR SET indicator description. The system has several sub-modes:
- Using the "false" breakthrough. One level "breakthrough" is skipped. The system waits for the next "breakthrough" to enter the market. If a position is not opened during the time set by Lifetime of breakthrough parameter, the system waits for the new "false" breakthrough.
- No "false" breakthrough is used. Position is opened after the first crossing of the channel level.
- Rollback mode. If disabled, a position is opened only following the "breakthrough". If enabled, positions can be opened following either "breakthrough" or "rollback". The market entry direction is defined by relative positions of UPDATINGPRICE CHANNEL levels and the levels set by Switch level on High or Switch level on Low parameters.
SYSTEM2 has a higher priority. It means that if the market entry signals arrive simultaneously, the deal is performed using SYSTEM2.
If Retry deals mode is enabled, a position may be re-opened after closing the previous one. If disabled, only one deal per trading session at the current symbol-system pair is performed. If Retry deals = REOPEN, a position is re-opened if a signal from another system arrives.
Independent StopLoss and TakeProfit are placed for each of the systems (SYSTEM 1, SYSTEM 2). SYSTEM 2 has the mode for placing StopLoss to the opposite channel's level (LossOnLev=ON). Also, other closing modes can be used.
1.2. Closing Modes
CLOSE MODE 1 - positions are closed if the profit exceeds the value specified by MinLevelClose parameter within the hour set by Close time parameter. Otherwise, position's TakeProfit is moved to fl_ModLevelTP level. If MinLevelClose definitely has a large negative value, positions are closed in any case. If the mode is not used, positions are closed using other closing modes or re-opened following the system's new signals.
CLOSE MODE 2 - positions are closed if the profit exceeds the value specified by Min Profit fo close position parameter within the hour set by fl_Time from open position parameter. The value of fl_Time_from_open_position parameter is the time from opening a position (0 - market entry hour, 1 - next hour, etc.). If the mode is not used, positions are closed using other closing modes or re-opened following the system's new signals.
TRAILING - two types of trailings are supported:
- TYPE 1 - when profit specified by TtrailLevel parameter is reached, position's StopLoss shifts by TtrailLevel points closer to the Open price and then moves at a pitch of TrailStep. If TrailStep is above 0, profit level is checked at each tick. If it is equal to 0, the check is performed once per minute at the beginning of every minute. If TtrailLevel and TrailStep are equal to 0, StopLoss is modified right after profit appears. If an initial StopLoss has not been specified, the trailing is not set, as there is nothing to move. In this case, use TYPE 2 (BREAKEVEN) mode.
- TYPE 2 (BREAKEVEN) - when profit specified by TtrailLevel or TrailStep parameter (with TtrailLevel not specified) is reached, position's StopLoss shifts (or set if it has been equal to 0) to the break-even point (i.e., to the Open level) and then moves at a pitch of TrailStep. If TrailStep=0, there is no further movement and StopLoss remains at the Open price level.
Also, the number of days during which a position is held can be limited.
1.3. Loss-Making Deals Filtration Mode
TRADE FILTER - if the total profit in the series of deals exceeds Points for restraint in trade parameter value, trading is "blocked" (switched to the minimum lot) till the first loss-making deal. After that, the trading mode appropriate to your money management system resumes. The profit in the series is calculated for each currency pair.
1.4. Working Hours or Trading Time
Trading time is set by Start time (starting the work) and Close time (ending the work) parameters. Start time > Close time means overnight working time. Start time = Close time means twenty-four-hour operation. After ending the trading activity, positions are closed or modified according to CLOSE MODE 1 parameter within the hour specified by Close time parameter.
The Expert Advisor uses the terminal's time. Time shift parameter is used for shifting all time parameters.
You can set specific days of the week for trading in Days for trade parameter by specifying their numbers: 1 - Monday ... 5 - Friday. Numbers of days allowed for trading can be entered randomly.
1.5. Money Management Systems
- ММ1 - using fixed lot. The lot is specified by Start Lot parameter.
- ММ2 - "Fixed fractional" system. The lot is calculated as a percentage from the current account's balance. Example: if fl_Margin=10, while the current balance is 2 400, the lot is 0.24, the balance is 300, the lot is 0.03.
- ММ3 - "Fixed proportional" system of Ryan Jones. The lot is increased by Step value when certain balance levels are reached. Each next level = (previous level + fl_Delta*N), where N is the number of steps. Example: Start Depo initial balance=10 000, Start Lot initial lot=0.5, fl_Delta=200, Step=0.1. Then, the first level of increasing the lot = (10 000+200*1) = 10 200, the lot here is 0.5 + 0.1 = 0.6, the second level = (10 200 + 200*2) = 10 600 and the lot is 0.6 + 0.1 = 0.7, the third one = (10 600 + 200*3) = 11 200, the lot is 0.7 + 0.1 = 0.8, etc.
- ММ4 - "Martingale". The lot is doubled after a loss-making trade. There may be two cases: calculation for each symbol individually or for the entire account.
To let the operation of a system with a lower number, systems with larger numbers should be disabled. For example, "Martingale" system should be disabled and fl_Margin and fl_Step parameters should be equal to 0 if you want to use a fixed lot.
1.6. Semi-Automatic Mode
When this mode is activated, the Expert Advisor serves all positions: its own ones, the ones opened by other robots and opened manually. If position's symbol is present in the input parameters, position tracking conditions are taken from the appropriate group of parameters. Otherwise, parameters of the first group are used. When "third-party" deals are opened, StopLoss and TakeProfit are immediately placed if they have been equal to 0 during the opening. CLOSE MODE 1, CLOSE MODE 2, TRAILING modes take part in tracking a position.
In ONLY SEMIAUTO mode, opening mode is disabled and only "third-party" deals are tracked. For example, it is possible to enter the deal manually or using another trading robot. The present Expert Advisor then tracks the position.
1.7. Other Parameters and Features
- Several Expert Advisor copies can be launched on a single account. In addition, the number of parameter groups and system operation types increase. In this case, different Magic number values should be set and semi-automatic mode for each copy should be disabled.
- If print is enabled in Print languages parameter, data on "breaking through" the channel's levels, market entry, modification and market exit requests, current profit in the series of deals and other information are displayed in the Expert Advisor's log. If printing additional data is allowed, messages on all StopLoss level modifications during the trailing operation, as well as changes in the levels while using LossOnLev mode are displayed.
- Print comment parameter allows including comments into orders. A comment contains the Expert Advisor's magic number, system number and mode.
- fl_Maxlot parameter allows limiting a lot size. A specified limitation is considered when positions are opened and closed.
- Deviation (from a requested price) is also considered when the level is "broken through" at the moment a market entry signal is being generated.
- If Stop levels are less than permissible ones, position is opened without them. StopLoss and TakeProfit are placed as soon as possible.
2. Input Data Table
|Magic number||Expert Advisor's magic number.|
|Semiauto mode||OFF - semiautomatic mode is disabled - only the Expert Advisor's own deals are served. Manually opened positions are not processed.
ON - the Expert Advisor handles all systems and serves "third-party" deals using appropriate parameters.
ONLY SEMIAUTO - only "third-party" deals are processed. Opening mode is disabled.
|Symbol mode||All input symbols - working or testing on all symbols specified in the input parameters regardless of the chart's or strategy tester's symbol.
Selected symbol - working or testing only on the selected chart/symbol. If it is present in the input parameters, the appropriate group of parameters is used. Otherwise, the settings are taken from the first group.
|Print languages||OFF - log print is disabled, Russian - select Russian language, English - select English language.|
|Print additional information||Displaying additional information in the log: ON/OFF - enabled/disabled.|
|Print comment||Write comments to an order - ON/OFF.|
|Time shift||Time shift.|
|fl_OpenDays||Maximum number of days during which a position is held. Positions are closed in Close time. If the parameter is negative, there are no limitations.|
|MONEY_MANAGEMENT||Money management system parameters.|
|Start Lot (MM 1,3,4)||The lot used when working with a fixed lot (ММ1), initial lot for MM3 systems - "Fixed proportional" (Jones) and ММ4 - "Martingale".|
|fl_Margin (MM 2,3)||If above 0, "Fixed fractional" system is enabled. The lot is calculated as a percentage of the account's current balance.
|fl_Step (MM 3)||If above 0, "Fixed proportional" system is enabled. Parameter value is a basic step for changing the lot.|
|Delta (MM 3)||The value, by which the lot is changed when the balance alters at the current pitch.|
|Start Depo (MM 3)||Initial deposit value for calculating the lot for "Fixed proportional" system.|
|Min Depo (MM 3)||In case the "drawdown" drops below Start Depo, the parameter sets the minimum deposit value, down to which the lot size is not changed. "Fixed fractional" system is enabled below that level. When moving in positive direction, the lot is calculated from the lowest reached level. It is used for quick exit from the "drawdown".|
|fl_Martin (MM 4)||OFF - "Martingale" system disabled.
ON FOR EAGH SYMBOL - the system is enabled, calculation is performed for each symbol separately.
ON FOR ALL ACCOUNT - the system is enabled, calculation is performed for the entire account.
|fl_Maxlot||Limitation of the maximum lot. If the value is negative, there are no limitations.
||Parameters of trading systems, trailing modes and closing deals for a single group. There are 5 such groups (SYMBOL 1 - SYMBOL5). Group parameters do not depend on each other.|
|SYMBOL 1(... SYMBOL5)||List of currency pairs working according to the group's parameters. Up to 10 symbols in each group. The names are comma separated. If the symbol's name is incorrect, it is not traded. If nothing is specified, the group is not traded.|
|Open Hour||Hour of the open price used for calculation of the fixed levels. The levels are valid from this hour to the same hour of the next day.|
|Start time||Operation start time.|
|Close time||Operation end time.|
|Days for trade||Trading days (1 - Monday ... 5 - Friday). Numbers of days allowed for trading can be entered randomly.|
|Retry deals||OFF - only one deal per trading session at the symbol-system pair.
ON - position can be re-opened after the previous one is closed.
REOPEN - position re-opens if a signal from another system is received. SYSTEM 1 in MODE 2 also re-opens its own positions.
|SYSTEM 1||OFF - disabled.
ON MODE 1 - mode 1 enabled - levels are calculated based on Open price in Open Hour.
ON MODE 2 (EVERY HOUR) - levels are calculated based on the Open price of the current hour.
|Level 1||In ON MODE 1 - upper level = (Open price in Open Hour) + (Level points), lower level = (Open price in Open Hour) - (Level points).
In ON MODE 2 (EVERY HOUR) - upper level = (current hour's Open price) + (Level points), lower level = (current hour's open price) - (Level points).
|StopLoss 1||Loss limitation level for system 1.|
|TakeProfit 1||Profit fixing level for system 1.|
||OFF - mode disabled,
ON - when the lower level of Level 1 is crossed, the market entry direction is selected randomly.
|SYSTEM 2||OFF - disabled.
ON - enabled using the "false" breakthrough.
ON NOT FALSE BREAKTHROUGH - opening position after the first crossing of the channel level.
|Bars 2||Number of bars for calculating UPDATINGPRICE CHANNEL (see KLEO INDICATOR SET).|
|Shift from High||Shift of the upper level in points.|
|Shift from Low||Shift of the lower level in points.|
|Max Delta||Maximal range of the price change ((High - Low) value for the Bars period) to consider the channel being absent. If the range is higher than Max delta, trading is not performed.|
|Min Delta||Minimal range of the price change ((High - Low) value for the Bars period) to consider the price not moving. If the range is lower than Min delta, trading is not performed.|
|Lifetime of breakthrough||"False" breakthrough lifetime. The number of hours, at the end of which the level breakthrough is considered obsolete and the trading robot waits for a new one.
|Rollback On/Off||OFF - a position is opened only following the level "breakthrough".
ON - positions can be opened following either "breakthrough" or "rollback".
|Switch level on High||Upper level = (Open price at Open Hour) + (Switch level on High points). If UPDATINGPRICE CHANNEL upper level is below this level, a position is opened following the "breakthrough". Otherwise, it follows the "rollback".|
|Switch level on Low||Lower level = (Open price at Open Hour) - (Switch level on Low points). If UPDATINGPRICE CHANNEL lower level is above this level, a position is opened following the "breakthrough". Otherwise, it follows the "rollback".|
|StopLoss 2||Loss limitation level for system 2.|
|LossOnLev 2||ON - if a position follows the breakthrough, StopLoss is set to the channel's opposite level and is moved at the beginning of each hour when the level is changed.
OFF - StopLoss 2 is used.
|TakeProfit 2||Profit fixing level for system 2.|
|CLOSE MODE 1||Closing mode 1.|
|fl_ModLevelTP||The level, to which TakeProfit is modified, if position is not closed. If the value is below 0, the mode is not used.|
|MinLevelClose||A position is closed if the profit (in points) exceeds the value specified by this parameter within the hour set by Close time parameter.|
|CLOSE MODE 2||Closing mode 2.|
|fl_Time from open position||An hour after opening a position (0 - Open hour, 1 - next hour, etc.). If the value is below 0, the mode is not used.
|Min Profit fo close position||A position is closed if the profit (in points) exceeds the value specified by this parameter within the hour set by fl_Time from open position parameter.
|TRAILING||OFF - trailing mode disabled.
ON TYPY 1 - mode 1 enabled.
ON TYPY 2 (BREAKEVEN) - mode 2 enabled.
|fl_TtrailLevel||Trailing initial level (in points).|
|TrailStep||Trailing step (in points).|
|TRADE FILTER||Filtering loss-making deals.|
|Points for restraint in trade||Total profit (in points) in the series of profitable deals, at which trading is "blocked". It is calculated for each currency pair.|
|Deviation||Maximum deviation from the requested price (in points).|
|Sleeptime||Delay after sending a trade request to the server (in milliseconds).|
|Create Sets Files||Generating parameter files. ON/OFF - enabled/disabled.|
3. Cases of Practical Applications, Examples
When you place the Expert Advisor on the chart or the strategy tester for the first time, KleoEx folder containing set files for several operation cases is created. It is located in the client terminal's directory in MQL5\Files (or [testing_agent_directory]\MQL5\Files in case of testing). The full path to set files is specified in the terminal's journal.
All displayed tests have been performed on the period from 01.01.2010 to 25.06.2013 in "1 minute OHLC" mode on MetaQuotes server with an initial deposit of 10 000. In "Every tick" mode, the results are more accurate but testing is slower.
1-2. Default parameters or KleoEx_1_Def_MM3.set file. The following symbols and systems are used.
- GBPUSD, NZDUSD - SYSTEM 2 using "false breakthrough", positions can follow either "breakthrough" or "rollback" (Rollback=ON), StopLoss is at the opposite side of the channel (LossOnLev=ON).
- EURUSD, USDCHF - SYSTEM 2, Rollback=ON, LossOnLev=OFF plus SYSTEM 1 MODE 2. For EURUSD, retrying deals is enabled (Retry deals=ON). For USDCHF, re-opening is enabled (Retry deals=REOPEN).
- EURJPY, AUDUSD - SYSTEM 2, opened positions can follow only breakthrough.
- Money management system ММ3 ("Fixed proportional").
3-4. KleoEx_2_Def_MM2.set parameters are the same as in the first example, though MM2 ("Fixed fractional" system) is used. fl_Margin=2.9, meaning 2.9% of risk per 100 points. Compare the test results with the previous example. The resulting profit is approximately the same, but in the first case, the lot has reached 9.7 for the entire period, while in this example it is 26.
5-6. KleoEx_3_Def_MM1.set parameters are similar to the ones from the first example. Trading is performed with a fixed lot - 0.1.
7-8. KleoEx_4_Syst1_Mode2.set - GBPUSD, EURUSD, SYSTEM 1 MODE 2.
9-12. KleoEx_5_Syst1_Mode1.set - EURJPY, SYSTEM 1 MODE 1. This example shows how the loss-making deals filter affects trading results. Screenshots 9, 10 - without the filter, 11 and 12 - trade "blocking" is used - Points for restraint in trade=70.
VIDEO. KleoEx_6_Random.set - SYSTEM 1 MODE 2 using Random trade mode. Each test pass provides different results but all of them are profitable. This is achieved by selecting the optimal trading time and market exit parameters.
Find other examples in Expert Advisor's test version description.
You can assemble your sets of symbols, systems and parameters that correspond to your working style and type.
I have tried to describe Expert Advisor's operation principles and parameter functions in more details, as I consider that necessary for real work. If you decide to use my product, check out the parameters carefully. If you know how the system works and how its settings affect the Expert Advisor's behavior, you can quickly make the appropriate changes when the market starts behaving in a different way. You also can perform the Expert Advisor's initial preparation according to your conditions.
I am waiting for your comments. Please leave your feedback.
I wish you successful trading!