1-3-1 红绿K线反转策略是一种根据K线形态进行买卖信号判断的策略。该策略通过观察1根红色K线是否被3根绿色K线反转来寻找买入机会。
该策略的核心逻辑是:
通过这个策略,我们可以在红色K线被反转的情况下买入,因为之后的趋势很可能是上涨的。同时设置止损和止盈来控制风险和锁定盈利。
1-3-1 红绿K线反转策略具有以下优势:
该策略也存在一些风险需要注意:
对策:
该策略可以从以下几个方面进行优化:
基于大盘指数的过滤。可以根据大盘的短期和中期趋势来过滤交易信号,在大盘上涨时买入,大盘下跌时停止交易。
考虑成交量的确认。增加对绿色K线成交量的判断,仅在成交量有所放大时才买入。
优化止损止盈比例。可以测试不同的止损止盈比例,找到最优参数组合。也可以设置动态止损或移动止损。
仓位管理优化。可以分批建仓,后续在条件满足时加仓,降低单次交易的风险。
加入更多过滤条件。比如考虑均线、波动率等指标,确保在趋势更加明确时买入。
大数据训练寻找最优参数。收集大量历史数据,使用机器学习等技术训练最优的参数阈值。
1-3-1 红绿K线反转策略整体来说是一个简单实用的短线交易策略。它有明确的入场退出规则,回测效果良好。我们可以通过一些优化措施来提高它的实盘效果,使之成为一个可靠的量化交易策略。同时也需要注意风险控制,妥善管理资金。
/*backtest
start: 2023-09-26 00:00:00
end: 2023-10-26 00:00:00
period: 1h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=5
//by Genma01
strategy("Stratégie tradosaure 1 Bougie Rouge suivi de 3 Bougies Vertes", overlay=true, default_qty_type = strategy.percent_of_equity, default_qty_value = 100)
// Définir les paramètres
var float stopLossPrice = na
var float takeProfitPrice = na
var float stopLossPriceD = na
var float takeProfitPriceD = na
// Vérifier les conditions
redCandle = close[3] < open[3] and low[3] < low[2] and low[3] < low[1] and low[3] < low[0]
greenCandles = close > open and close[1] > open[1] and close[2] > open[2]
higherClose = close > close[1] and close[1] > close[2]
// Calcul du stop-loss
if (redCandle and greenCandles and higherClose) and strategy.position_size == 0
stopLossPrice := low[3]
// Calcul du take-profit
if (not na(stopLossPrice)) and strategy.position_size == 0
takeProfitPrice := close + (close - stopLossPrice)
// Entrée en position long
if (redCandle and greenCandles and higherClose) and strategy.position_size == 0
strategy.entry("Long", strategy.long)
// Sortie de la position
if (not na(stopLossPrice)) and strategy.position_size > 0
strategy.exit("Take Profit/Stop Loss", stop=stopLossPrice, limit=takeProfitPrice)
if strategy.position_size == 0
stopLossPriceD := na
takeProfitPriceD := na
else
stopLossPriceD := stopLossPrice
takeProfitPriceD := takeProfitPrice
// Tracer le stop-loss et le take-profit sur le graphique
plotshape(series=redCandle and greenCandles and higherClose and strategy.position_size == 0, title="Conditions Remplies", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
plotshape(series=redCandle and greenCandles and higherClose and strategy.position_size == 0, title="Conditions Remplies", location=location.belowbar, color=color.green, style=shape.triangleup, size=size.small)
// Afficher les prix du stop-loss et du take-profit
plot(stopLossPriceD, color=color.red, title="Stop Loss Price", linewidth=2, style = plot.style_linebr)
plot(takeProfitPriceD, color=color.green, title="Take Profit Price", linewidth=2, style = plot.style_linebr)