该策略通过比较当前K线的收盘价与前一日的收盘价,判断多空方向。属于简单的趋势跟踪策略,当价格上涨时做多,下跌时做空。无需复杂指标判断,通过最基本的价格信息判断趋势方向。
计算当前K线收盘价与前一日收盘价的差价比例。
比例大于设定阈值时,表示价格上涨,做多。
比例小于负的设定阈值时,表示价格下跌,做空。
阈值设定为0,即只要上涨就做多,下跌就做空。
没有设置止损止盈逻辑,全靠趋势持续性来实现盈利。
非常简单直观的趋势判断方法,容易理解实现。
无需计算任何技术指标,降低计算资源占用。
只关注最核心的价格信息,减少不必要的指标噪音。
回测表现优异,但实盘效果存疑。
没有止损设置,存在无限亏损的风险。
无法有效处理盘整波动市场,容易被套。
存在过拟合风险,实盘效果待验证。
单纯跟踪趋势无法锁定利润,实现的盈利有限。
增加移动止损策略,使亏损可控。
结合波动率指标,降低盘整市被套率。
测试不同天数周期参数设定,提高稳定性。
增加趋势判断指标,避免非理性价格波动。
优化止盈策略,如回看最高价等,扩大盈利空间。
该策略核心思路简单,但实盘效果存疑。需要强化风险控制机制,并进行参数优化测试,才能使之真正可实际应用。但基本思路值得借鉴学习。
/*backtest
start: 2023-08-17 00:00:00
end: 2023-09-16 00:00:00
period: 2h
basePeriod: 15m
exchanges: [{"eid":"Futures_Binance","currency":"BTC_USDT"}]
*/
//@version=2
strategy("Daily Close Comparison Strategy (by ChartArt)", shorttitle="CA_-_Daily_Close_Strat", overlay=false)
// ChartArt's Daily Close Comparison Strategy
//
// Version 1.0
// Idea by ChartArt on February 28, 2016.
//
// This strategy is equal to the very
// popular "ANN Strategy" coded by sirolf2009,
// but without the Artificial Neural Network (ANN).
//
// Main difference besides stripping out the ANN
// is that I use close prices instead of OHLC4 prices.
// And the default threshold is set to 0 instead of 0.0014
// with a step of 0.001 instead of 0.0001.
//
// This strategy goes long if the close of the current day
// is larger than the close price of the last day.
// If the inverse logic is true, the strategy
// goes short (last close larger current close).
//
// This simple strategy does not have any
// stop loss or take profit money management logic.
//
// List of my work:
// https://www.tradingview.com/u/ChartArt/
//
// __ __ ___ __ ___
// / ` |__| /\ |__) | /\ |__) |
// \__, | | /~~\ | \ | /~~\ | \ |
//
//
threshold = input(title="Price Difference Threshold", type=float, defval=0, step=0.001)
getDiff() =>
yesterday=security(syminfo.tickerid, 'D', close[1])
today=security(syminfo.tickerid, 'D', close)
delta=today-yesterday
percentage=delta/yesterday
closeDiff = getDiff()
buying = closeDiff > threshold ? true : closeDiff < -threshold ? false : buying[1]
hline(0, title="zero line")
bgcolor(buying ? green : red, transp=25)
plot(closeDiff, color=silver, style=area, transp=75)
plot(closeDiff, color=aqua, title="prediction")
longCondition = buying
if (longCondition)
strategy.entry("Long", strategy.long)
shortCondition = buying != true
if (shortCondition)
strategy.entry("Short", strategy.short)