Description
🎯 Strategy Overview
Stop Order TP + SL is an automated strategy that places stop orders based on short-term price direction, using predefined Take Profit (TP) and Stop Loss (SL) levels for each trade.
The system includes an adjustable position sizing model that increases trade volume following a series of losses (commonly known as a step-up recovery approach), with volume reset to the initial size after a winning trade.
🔧 How It Works
Price Action Signal
- Compares the closing price of the current bar with the previous bar.
- If the current close is higher → a Buy Stop order is placed.
- If the current close is lower → a Sell Stop order is placed.
Stop Limit Order Execution
- Orders are set at a distance from market price, defined by
StopOffsetPips. - Each trade includes its own TP and SL in pip values.
- The system opens one position at a time and waits for it to close before placing another.
Position Size Adjustment
- If a trade closes in loss, the system tracks consecutive losses.
- After a set threshold (
StartMartingaleAfterLosses), lot size is increased by a multiplier (MartingaleMultiplier). - A maximum lot size (
MaxLot) is enforced for safety. - When a trade closes in profit, lot size returns to its initial value.
Spread Filter
- New trades are not opened if the current market spread exceeds the
MaxSpreadvalue.
ParameterDescription
Lot Size: Initial lot size for the first trade
Max Lot Size: Maximum allowed volume for safety
Martingale Multiplier: Lot size multiplier after losses
Start Martingale After Losses: Begin Martingale after this many losses
Take Profit / Stop Loss: Fixed TP and SL per trade (in pips)
Max Spread: Maximum spread allowed before skipping a trade
Stop Order (Pips): Distance from market price to place stop order
✅ Key Features
- Uses Stop Limit Orders (not Market Orders) to minimize slippage.
- Applies TP and SL on every trade — fully protected entries.
- Controlled Martingale logic with limit on max lot size.
- Suitable for volatile instruments like XAUUSD, NAS100, BTCUSD, etc.
Summary
The bot features an adjustable position sizing model with controlled Martingale logic: after a configurable number of consecutive losses (StartMartingaleAfterLosses), the lot size increases by a multiplier (MartingaleMultiplier), up to a maximum lot size (MaxLot) for risk control. Upon a winning trade, the lot size resets to the initial value. A spread filter prevents new trades if the market spread exceeds a set maximum (MaxSpread).
This strategy uses stop limit orders to minimize slippage and applies TP and SL on every trade for risk management. It is suitable for volatile instruments such as XAUUSD (gold), NAS100, and BTCUSD. Key configurable parameters include initial lot size, max lot size, Martingale settings, TP/SL values, max spread, and stop order distance.