The Expert Advisor works with ticks on both netting and hedging account types. The internal algorithm uses a tick (not a bar) as a unit for analysis. The product works with 5-digit quotes. Requotes are critical. A broker with the minimum execution delay is required.
The Expert Advisor does not use history stored in the database. It downloads history data online creating its own database stored in the internal memory. After the restart, the database is deleted and should be downloaded again. The size of the internal database is managed by CountTick parameter specifying how many ticks should be written to the database to start working. The mentioned database is used for the long-term analysis. Information from the long-term database designed for the stack is used for the short-term analysis and market entry. In other words, the EA uses the most current selection of ticks from the stack managed by the information received from the long-term database. Optimization is recommended for good results in the tester's real tick mode.
After downloading the specified volume of data, the EA starts its operation consisting of two stages. During the first stage, downloaded ticks are analyzed by the specified volume (CountTick) with the periodicity set by ReOptimization parameter. The Expert Advisor selects the best parameters it would have worked with if it had operated at that period. In other words, the best result is selected using the exhaustive search method. Since there are no much parameters to select from, this method is reasonable. Three internal parameters are selected for the search:
- Adjusting the stack size from 1 to CountSteck.
- Checking for enter (direct or inverted).
- Adjusting sensitivity of a single tick, where 1.0 is a barrier reaction for the barrier's internal optimization: minimum (MinPips), change step (StepPips) and maximum (MaxPips).
The internal optimizer follows the mentioned principle and selects the settings that yielded the best results entering the market and working there till the instruction on the new internal reoptimization (ReOptimization) is received. During the first configuration of the tick history, the EA does not enter the market till the database is filled. During the next reoptimization cycle, there are no delays, since the database is updated online and is always relevant.
During the second stage, the EA enters the market using the internal optimizer's settings and the stack data. TP and SL are used to secure the position, though they may be especially important with some settings.
- OnComment - display comment (slows down the tester operation).
- OnWithdrawal - simulate a profit withdrawal when reaching 100% of profit (work during testing).
- TypeFilling - set order filling type.
- Lot - lot size for a market entry.
- Risk - calculate a lot considering a deposit.
- Drawdown - maximum drawdown, at which closing is performed.
- MaxSpread - maximum acceptable spread for a market entry.
- CountSteck - tick stack size (max = 9).
- ReOptimization - iterative optimization period.
- CountTick - number of ticks for analysis in the database.
- MinPick - price tick impulse (single tick sensitivity).
- StepPips - impulse series step (stack depth).
- MaxPips - enter in the impulse direction/against it.
- TP - desirable take profit (corrected by the EA).
- SL - desirable stop loss (corrected by the EA).
The EA should be preliminarily optimized by the following parameters:
- CountTick (150,50,10000).
- ReOptimization (arbitrarily).
- TP and SL are also possible.
If optimization is very resource-consuming in your case, use the ready-made settings provided in the Comments or contact me via a private message.
Added stop loss and take profit auto correction.
TrailingStart - start of trailing stop.
TrailingStop - trailing stop.
LevelBreakeven - breakeven level.
AddClose, MinClose - setting the minimal closure in the specified profit of the deposit.
LimitVolume - Limitation of the maximum volume.
Poly, OneDir, ImpulsSeria, NewOrder - The ability to work with a series of orders.
Inertion - Combination of ticks into packages.
CountTickM - Automatic detection of the auto-optimization depth depending on the re-optimization period.
Added the fields:
- OnReOptimization - disable auto optimization (true - enabled).
- d_klitka - price grid.
- d_step - set discrete value of a price impulse.
- d_invers - select entry direction relative to a signal.