Skip to main content
Version: 3.0

Example G8: Buy stop and price dependent activation (hysteresis min)

caution

This is not a ready-to-use trading strategy. A trading strategy requires adjustment to the timeframe and symbol, along with thorough backtesting. The example is intended as a foundation for your own custom strategy and to help you get familiar with the Expert Advisor Builder web application. To import and use an example, please follow the instructions provided here.

Description

This example introduces hysteresis for locally managed pending orders. The -50 % minimum hysteresis requires price to move beyond the pending level before triggering, preventing activation from brief touches. This filters out false breakouts that immediately reverse.

Local management keeps pending orders invisible to brokers, preventing stop hunting or front-running. The hysteresis feature adds another protection layer, ensuring meaningful price movement before activation. This double protection significantly reduces false entries.

The ATR-based pending price combines with hysteresis to create adaptive entry conditions. As volatility changes, both the pending level and hysteresis requirement adjust proportionally, maintaining consistent strategy behavior.

Recreate the Example

You can either import this example directly or set it up manually. To manually replicate the trading module, make sure a newly added module includes the following key settings and that the professional mode is activated:

Trade Basics

  • Operation type = Long

Pending Order Settings

  • Mode = Stop
  • Price calculation method = Indicator value
  • Used indicator = ATR
  • Expiration = 75
  • Locally managed limit and stop orders = On
  • Hysteresis minimum value = -50

Signal Generation - Indicators - STD

  • Signal in use = On
  • Signal used for = Forward
  • Selected indicator = STD
  • Draw in chart = Off
  • Forward adjustment = 3.50

Signal Generation - Indicators (MACD Main line)

  • Signal in use = On
  • Signal used for = Entry
  • Selected indicator = MACD
  • Line index = Main line
  • Draw in chart = On
  • Drawing slot = 1

Signal Generation - Indicators (MACD Signal line)

  • Signal in use = On
  • Signal used for = Entry
  • Selected indicator = MACD
  • Line index = Signal line
  • Draw in chart = On
  • Drawing slot = 2

Signal Generation - Indicators (ATR)

  • Signal in use = On
  • Signal used for = Forward
  • Selected indicator = ATR
  • Draw in chart = Off
  • Forward adjustment = 3.50

Signal Generation - Indicator Combinations (MACD Main line & MACD Signal line)

  • Signal in use = On
  • Signal used for = Entry
  • Input indicator 1 = MACD (Main line)
  • Input indicator 2 = MACD (Signal line)
  • Value relation = Value 2 cross value 1

Initial Stop Loss

  • Selection = Indicator
  • Used indicator = STD

Initial Take Profit

  • Selection = Risk ratio
  • Risk ratio = 1.40

Screenshots

Example G8: Buy stop and price dependent activation (hysteresis min).webp