GrandPriZZ is an Expert Advisor using ZigZag extremums breakout strategy. The EA trades on breakouts of previous ZigZag extremums using pending stop orders. Activation of one order cancels the other. Only one market order is allowed. New pending orders do not placed until the market order is closed by trailing stop loss. Initial stop loss distance is calculated automatically from actual zigzag range.
Price action can always be treated as a sequence of bars, not necessarily usual bars that are equally spaced in time, but bars of a special kind, for example formed on zigzag edges. As a result, the algorithm of the EA covers three well-known strategies related to bar patterns: inside bar, engulfing, and pin bar.
The EA utilizes HZZM indicator.
- H - zigzag range (passed to the indicator), subject for optimization; by default - 0, auto-adjustement (find details on the page about HZZM);
- Original - original or modified algorithm of ZigZag (passed to the indicator); by default - true (find details on the page about HZZM);
- TightStops - enable/disable more aggressive trailing of stops;
- ExtraGap - additional step out of ZigZag extremums to price levels where pending orders should be placed; by default - 0; if it is > 0, this is a number of points; if it is < 0, this is a percent for latest figure range; for example, -10 means that distance between the latest ZigZag extremums is multiplied by 0.1 (10%), and the resulting number of points is used to move pending orders outward from extremums' prices;
- MinRange - minimal range of ZigZag figure, in points, when trading signals are generated; by default - 0;
- BreakEvenGuard - enable/disable a mode, that a profit of MinRange points (if MinRange > 0) moves a stop loss to break even position (later it will be trailed as usual); by default - true;
- MagicBase - magic number for every EA instance, by default - 0, meaning automatic generation of unique number based on current symbol and timeframe (result is printed into the log);
- Lots - size of fixed lot to trade; by default - 0.01;
- Slippage - maximal deviation of price during order execution, in points, by default - 10;
- TrailStops - enable/disable trailing of stop loss, by default - true;
- TrailingStep - step of stop loss trailing, in points, by default - 10;
- BarByBar - enable/disable trading on bar opening only (true) or on every tick (false); by default - true;
- RiskManagement - enable/disable variable lot sizing, as a percent of free margin (according to leverage), by default - false;
- Risk - a fraction of available free margin to calculate lot size, by default - 0.01 (1%);
- MaximumLot - maximal lot size allowed for the EA, by default - 0.5;
- PrintLog - enable/disable debug logs, by default - false.
You can optimize the expert in two phases. First, optimize it in bar opening mode (parameter BarByBar should be true). This allows you to find potentially good parameters fast. Then for selected parameter sets, use every tick mode to refine and confirm your findings (parameter BarByBar should be false).