Strategy vault / Mean reversion
Price Action Pyramiding 5 Profit Target 3 Stop Loss
This strategy uses price action and pyramiding methods to open a position when the price drops by 5%, and then continues to add positions through pyramiding until the price rises by 5% to close the position. The main…

Overview
This strategy uses price action and pyramiding methods to open a position when the price drops by 5%, and then continues to add positions through pyramiding until the price rises by 5% to close the position. The main advantage of this strategy is that it enters the market early in the trend formation and increases profit opportunities through pyramiding. At the same time, the strategy also sets a 3% stop loss to control risk.
Strategy Principle
- When the price drops by 5%, open a long position.
- Within the next 5 candles, if the price continues to fall, continue to add positions, up to 4 times.
- When the price rises by 5%, close all positions to realize profits.
- If the price hits the 3% stop loss during the pyramiding process, close all positions and stop loss exit.
Strategy Advantages
- Enters the market early in the trend formation, capturing the opportunity of price reversal.
- Increases profit opportunities through pyramiding.
- Sets a stop loss to control risk.
- Runs 24 hours without manual intervention.
Strategy Risks
- If the price drops rapidly during the pyramiding process, it may trigger a stop loss, resulting in losses.
- If the price fluctuates significantly before reaching the take profit level, it may reduce profits.
- If the market experiences severe volatility or black swan events, the strategy may incur significant losses.
Strategy Optimization Directions
- Optimize the proportion of position adding and closing, such as considering adding positions when the price drops by 3% and closing positions when the price rises by 7%. This can increase profit opportunities while controlling risk.
- Introduce more technical indicators, such as RSI and MACD, to assist in judging the trend and timing of opening and closing positions.
- Set different parameters for different market environments and varieties to adapt to different market characteristics.
Summary
This strategy uses price action and pyramiding methods to enter the market early in the trend formation and increases profit opportunities through multiple position adding. At the same time, the strategy also sets a stop loss to control risk. Although the strategy may face some risks, through further optimization, such as adjusting the proportion of position adding and closing, introducing more technical indicators, etc., the stability and profitability of the strategy can be improved.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | 1000 | Investicijų suma |
| v_input_2 | 3 | Nuostolio procentas (%) |
Source Pine Script
/*backtest
start: 2023-04-24 00:00:00
end: 2024-04-29 00:00:00
period: 1d
basePeriod: 1h
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
strategy("G Strategija su piramidavimu", overlay=true)
// Vartotojo įvestis investicijų sumai
investment_amount = input(1000.0, title="Investicijų suma")
// Nustatyti nuostolių ir pelno pasiekimo procentus
lossPercentage = input(3, title="Nuostolio procentas (%)") / 100
// Kintamasis saugoti atidarytoms pozicijoms
var int[] entryIndexes = array.new_int(0)
var float[] entryPrices = array.new_float(0)
// Kintamasis, nustatantis, ar turėtume atidaryti naują poziciją
var bool should_buy = false
var int open_candle_count = 0
var int positionCounter = 1 // Pozicijos skaitiklis
// Įėjimo logika (pirkti, kai kaina krenta)
if (hour >= 0 and hour <= 23) // Tikrina, ar yra 24 valandų
should_buy := false
for i = 1 to 5
should_buy := should_buy or (close < close[i] * (1 - lossPercentage))
if (should_buy and open_candle_count >= 5)
strategy.entry("Pirkti_" + str.tostring(positionCounter), strategy.long, qty=investment_amount / close)
array.push(entryIndexes, bar_index) // Įrašyti atidarymo laiko indeksą
array.push(entryPrices, close) // Įrašyti atidarymo kainą
open_candle_count := 0
positionCounter := positionCounter + 1 // Atnaujinti pozicijos skaitiklį
else
open_candle_count := open_candle_count + 1
// Išėjimo logika (uždaryti, kai pasiekiamas pelno lygis)
for i = 0 to array.size(entryIndexes) - 1
var float takeProfitPrice = na // Nustatyti pradinę reikšmę "na"
if array.size(entryPrices) > i and array.size(entryPrices) > 0
takeProfitPrice := array.get(entryPrices, i) * 1.05 // Skaičiuojamas pelno pasiekimo lygis: 5% aukščiau atidarymo kainos
strategy.exit("TakeProfit_" + str.tostring(i+1), "Pirkti_" + str.tostring(i+1), limit=takeProfitPrice) // Pridėti pelno pasiekimo lygį kaip išėjimo lygįPublished by ChaoZhang on the FMZ strategy square · last modified 2024-04-30. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Price-Action-Pyramiding-5-Profit-Target-3-Stop-Loss.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- ATR and EMA based Dynamic Take Profit and Stop Loss Adaptive StrategyPine Script · Mean reversion · 1h
- Advanced 15 Minute Chart Trading Signal StrategyPine Script · Mean reversion · 3h
- BONK Multi Factor Trading StrategyPine Script · Mean reversion · 1d
- Bitcoin Futures Position Trading StrategyPine Script · Mean reversion · 1h
- Chaikin Oscillator StrategyPine Script · Mean reversion · 3h
- Customizable Non Repainting HTF MACD MFI Scalable Bot StrategyPine Script · Mean reversion · 1d