Low Volatility Directional Buy with Profit Taking and Stop Loss
The strategy is named "Low Volatility Directional Buy with Profit Taking and Stop Loss". It utilizes moving average crossover as buy signals and combines profit taking and stop loss to lock in profit. It is suitable…

Overview
The strategy is named "Low Volatility Directional Buy with Profit Taking and Stop Loss". It utilizes moving average crossover as buy signals and combines profit taking and stop loss to lock in profit. It is suitable for low volatility coins.
Strategy Logic
The strategy uses 3 moving averages with different periods: 50-period, 100-period and 200-period. The buy logic is: when 50-period MA crosses over 100-period MA and 100-period MA crosses over 200-period MA, go long.
This signals a breakout from low volatility range and the start of a trend. 50-period MA's fast rise represents strengthening of short term momentum; 100-period MA also turning up indicates mid term force joining in to stabilize the up trend.
After entry, the strategy uses profit taking and stop loss to lock in gains. Take profit is set at 8% of entry price. Stop loss is set at 4% of entry price. With higher take profit over stop loss, it ensures the strategy stays profitable overall.
Advantage Analysis
The advantages of this strategy:
- Accurately capture trend opportunity from low volatility breakouts.
- Simple and clear logic with moving averages that are easy to calculate and backtest.
- Reasonable profit taking and stop loss settings ensure stable gains.
- Flexible configurable parameters make optimizations easy.
Risk Analysis
There are also some risks:
- Wrong breakout signals may cause losses.
- Hard to stop loss when markets reverse.
- Improper profit taking and stop loss parameter settings affect profitability.
Solutions:
- Add other indicators to filter signals and ensure breakout validity.
- Shorten stop loss period to reduce losses from reversals.
- Test different profit taking and stop loss ratios to find optimum.
Optimization Directions
Optimizations can be made in below areas:
- Test different moving average periods to find best combination.
- Add volume etc. to confirm trend breakouts.
- Dynamically adjust profit taking and stop loss percentage.
- Incorporate machine learning etc. to predict breakout success rate.
- Adjust parameters based on different market conditions and coins.
In summary, the strategy has clear logic overall, obtains low risk profit through configuring moving average periods and profit taking/stop loss percentage. It can be flexibly applied in quantitative trading. Further optimizations can be made in areas like entry signals and stop loss methods, combined with parameter tuning to achieve best results.
Parameters
| Name | Default | What it controls |
|---|---|---|
| v_input_1 | true | From Month |
| v_input_2 | 10 | From Day |
| v_input_3 | 2019 | From Year |
| v_input_4 | true | Thru Month |
| v_input_5 | true | Thru Day |
| v_input_6 | 2112 | Thru Year |
| v_input_7 | true | Show Date Range |
| v_input_8 | 50 | v_input_8 |
| v_input_9 | 200 | v_input_9 |
| v_input_10 | 100 | v_input_10 |
Source Pine Script
/*backtest
start: 2023-12-10 00:00:00
end: 2023-12-17 00:00:00
period: 1m
basePeriod: 1m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=4
strategy(shorttitle='Low volatility Buy w/ TP & SL (by Coinrule)',title='Low volatility Buy w/ TP & SL', overlay=true, initial_capital = 1000, process_orders_on_close=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)
//Backtest dates
fromMonth = input(defval = 1, title = "From Month", type = input.integer, minval = 1, maxval = 12)
fromDay = input(defval = 10, title = "From Day", type = input.integer, minval = 1, maxval = 31)
fromYear = input(defval = 2019, title = "From Year", type = input.integer, minval = 1970)
thruMonth = input(defval = 1, title = "Thru Month", type = input.integer, minval = 1, maxval = 12)
thruDay = input(defval = 1, title = "Thru Day", type = input.integer, minval = 1, maxval = 31)
thruYear = input(defval = 2112, title = "Thru Year", type = input.integer, minval = 1970)
showDate = input(defval = true, title = "Show Date Range", type = input.bool)
start = timestamp(fromYear, fromMonth, fromDay, 00, 00) // backtest start window
finish = timestamp(thruYear, thruMonth, thruDay, 23, 59) // backtest finish window
window() => time >= start and time <= finish ? true : false // create function "within window of time"
//MA inputs and calculations
movingaverage_fast = sma(close, input(50))
movingaverage_slow = sma(close, input(200))
movingaverage_normal= sma(close, input(100))
//Entry
strategy.entry(id="long", long = true, when = movingaverage_slow > movingaverage_normal and movingaverage_fast > movingaverage_normal)
//Exit
longStopPrice = strategy.position_avg_price * (1 - 0.04)
longTakeProfit = strategy.position_avg_price * (1 + 0.08)
strategy.close("long", when = close < longStopPrice or close > longTakeProfit and window())
//PLOT
plot(movingaverage_fast, color=color.orange, linewidth=2)
plot(movingaverage_slow, color=color.purple, linewidth=3)
plot(movingaverage_normal, color=color.blue, linewidth=2)
Published by ChaoZhang on the FMZ strategy square · last modified 2023-12-18. 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/Low-Volatility-Directional-Buy-with-Profit-Taking-and-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
- Dual Bollinger Band Volatility Tracking StrategyPine Script · Volatility · 1d
- Dual Moving Average Volatility Tracking StrategyPine Script · Volatility · 1h
- Multi Indicator Dynamic Volatility Alert Trading SystemPine Script · Volatility · 1m
- Multi Indicator Volatility Trading RSI EMA ATR StrategyPine Script · Volatility · 3m
- Quantitative Trading Strategy Based on Double EMA and Price Volatility IndexPine Script · Volatility · 1h
- Bullish Engulfing Quantitative Trading System with Bollinger Bands Risk ManagementPine Script · Volatility · 1d