Logo hamster-bot
RU EN PT

Loading…

← All strategies

ZigZag, ZZ

The core idea of the strategy is to catch a strong trend move as early as possible and hold the position for the duration of the trend. A trade opens the moment price breaks pre-built levels based on past price highs/lows.

It's based on logic similar to the ZigZag indicator:
● When the market starts turning up, a local low is recorded
● When it turns down — a local high
These points become reference levels. They form the levels the market has to break to confirm the move.

Reversal-based (flip long ↔ short)
A position is always open and flips from short to long. (Unless various strategy modifiers are used)

⚠️ The strategy generates losing trades when the market is ranging and during V-shaped reversals.

Working order type: Market Stop order (on some exchanges this may also be called Conditional or Trigger order)

Example of setting conditional orders

● Green marks where a conditional buy order is placed. Break of the last significant high.
● Red marks a sell. Price breaks the last low.

After the strategy starts, if there is no position and the price is between the levels, 1 order to open a long position and 1 for short will be placed. If the price is not between the levels, or there's an open position, only 1 order will be placed.

If a position is open, the strategy should have only 1 order. By default, the size of this order equals the position size * 2. To reverse the position (close and open a new one of the same size)

Backtest
Test in the built-in backtester

A Pine Script for testing the strategy on historical data in the TradingView strategy tester:

Recommendations: (not strict, and can be broken for research purposes)
Working timeframe from 4h and up.

Recommended timeframe

For the curious

The algorithm for building the levels of the ZZ2 strategy. It uses a non-standard ZigZag indicator. You can see from the code how simple it is, and repainting is excluded. But the levels are built with a delay of a few candles (this doesn't get in the strategy's way at all)

Fragment of the ZZ2 algorithm code

Three sequentially smoothed EMAs are used. This creates strong smoothing, reducing noise.
The variable z records the reversal points. If the EMA turns up → the local low (l) is taken. If it turns down → the local high (h). These points (l and h) become the basis for building the levels.


Backtest the strategy on historical data in the tester and run it in hamster-bot.