Ai+交易量+超级趋势指标组成的策略

Ai+交易量+超级趋势指标组成的策略非常稳定可靠胜率高

一个是引入了AI和交易量维度的VSA指标,指标可以通过交易量的高低去分析和识别趋势的延续性/

另一个是RD指标 ,RD指标可以很好的识别和标记市场的盘整区间,判定是震荡区间后会标记成橘黄色🤔

TradingView 指标
名称:volume supertrend ai
输入:factor设置为2.5
风格:默认

名称:Range Detector Indicator
输入:深度的参数改成10
风格:默认

完整版🔗https://youtu.be/ycYyFGweI6c

进入多头的规则
第一:绿色看涨趋势线上的K线,被标记了圆形或者三角形的入场信号。绿圆表示趋势刚由空变多,是趋势的起点,绿色三角形则表示趋势还会延续。
第二:这根K线要呈现绿色的实体,两个条件全部满足,这根K线就是我们要找的关键K线。
我们在关键K线的收盘价入场,止损可以设置在近期的波段低点或是绿色看涨趋势线下方。
止盈选择分批止盈的方式,也就是在风险回报比1:1出一部分,剩余部分拿住博取更高的利润。

同一个时间级别能也会出现出入场,比如1小时级别的SHIBUSDT,2023-09-23 22:00 小时内就完成了进场出场闭环交易 22:09进场,22:28出场 20X 21.18%收益】

扩展:@MicheleHelen777
https://oklover-8581.xlog.app/Ai-jiao-yi-liang–chao-ji-qu-shi-zhi-biao-zu-cheng-de-ce-le-jiao-ben

AI 生成的摘要
这是一个名为”AI交易”的策略,由投机实验室(LabSpeculation)编写。该策略使用TV的Pine语言进行回测。它基于KNN算法和超级趋势指标来生成交易信号。策略使用了多个参数和指标,包括DEMA长度、EMA长度、K线长度等。根据回测结果,该策略的胜率达到了98%。作者声明对脚本实际运行后带来的交易后果不负责。
策略作者:投机实验室@LabSpeculation
相关帖子:https://x.com/LabSpeculation/status/1702504457689333884?s=20
我就是用 TV 的 Pine 语言实现出来回测而已
效果展示:30m K线上效果惊人……
胜率 98% ………………

//@version=5
strategy(“AI交易”, overlay=true, shorttitle=”AI交易策略”)

k = input.int(3, title = “Neighbors”, minval=1, maxval=100,inline=”AI”, group=”AI Settings”)
n_ = input.int(10, title =”Data”, minval=1, maxval=100,inline=”AI”, group=”AI Settings”)
n = math.max(k,n_)

DEMA_len1 = input.int(144, “DEMA Length 1”)
DEMA_len2 = input.int(169, “DEMA Length 2”)
EMA_144 = ta.ema(close, DEMA_len1)
EMAofEMA_144 = ta.ema(EMA_144, DEMA_len1)
DEMA_144 = 2 * EMA_144 – EMAofEMA_144
EMA_169 = ta.ema(close, DEMA_len2)
EMAofEMA_169 = ta.ema(EMA_169, DEMA_len2)
DEMA_169 = 2 * EMA_169 – EMAofEMA_169

KNN_PriceLen = input.int(20, title=”Price Trend”, minval=2, maxval=500, step=10,inline=”AITrend”, group=”AI Trend”)
KNN_STLen = input.int(100, title=”Prediction Trend”, minval=2, maxval=500, step=10, inline=”AITrend”, group=”AI Trend”)
aisignals = input.bool(true,title=”AI Trend Signals”,inline=”signal”, group=”AI Trend”)

len = input.int(10, “Length”, minval=1,inline=”SuperTrend”, group=”Super Trend Settings”)
factor = input.float(2.5,step=.1,inline=”SuperTrend”, group=”Super Trend Settings”)
maSrc = input.string(“WMA”,”Moving Average Source”,[“SMA”,”EMA”,”WMA”,”RMA”,”VWMA”],inline=””, group=”Super Trend Settings”)
upCol = input.color(color.lime,”Bullish Color”,inline=”col”, group=”Super Trend Coloring”)
dnCol = input.color(color.red,”Bearish Color”,inline=”col”, group=”Super Trend Coloring”)
neCol = input.color(color.blue,”Neutral Color”,inline=”col”, group=”Super Trend Coloring”)

vwma = switch maSrc
“SMA” => ta.sma(closevolume, len) / ta.sma(volume, len) “EMA” => ta.ema(closevolume, len) / ta.ema(volume, len)
“WMA” => ta.wma(closevolume, len) / ta.wma(volume, len) “RMA” => ta.rma(closevolume, len) / ta.rma(volume, len)
“VWMA” => ta.vwma(close*volume, len) / ta.vwma(volume, len)

atr = ta.atr(len)
upperBand = vwma + factor * atr
lowerBand = vwma – factor * atr
prevLowerBand = nz(lowerBand[1])
prevUpperBand = nz(upperBand[1])

lowerBand := lowerBand > prevLowerBand or close[1] < prevLowerBand ? lowerBand : prevLowerBand upperBand := upperBand < prevUpperBand or close[1] > prevUpperBand ? upperBand : prevUpperBand
int direction = na
float superTrend = na
prevSuperTrend = superTrend[1]
if na(atr[1])
direction := 1
else if prevSuperTrend == prevUpperBand
direction := close > upperBand ? -1 : 1
else
direction := close < lowerBand ? 1 : -1
superTrend := direction == -1 ? lowerBand : upperBand

price = ta.wma(close,KNN_PriceLen)
sT = ta.wma(superTrend,KNN_STLen)
data = array.new_float(n)
labels = array.new_int(n)
for i = 0 to n – 1
data.set(i, superTrend[i])
label_i = price[i] > sT[i] ? 1 : 0
labels.set(i, label_i)

distance(x1, x2) =>
math.abs(x1 – x2)

knn_weighted(data, labels, k, x) =>
n1 = data.size()
distances = array.new_float(n1)
indices = array.new_int(n1)
for i = 0 to n1 – 1
x_i = data.get(i)
dist = distance(x, x_i)
distances.set(i, dist)
indices.set(i, i)
for i = 0 to n1 – 2
for j = 0 to n1 – i – 2
if distances.get(j) > distances.get(j + 1)
tempDist = distances.get(j)
distances.set(j, distances.get(j + 1))
distances.set(j + 1, tempDist)
tempIndex = indices.get(j)
indices.set(j, indices.get(j + 1))
indices.set(j + 1, tempIndex)
weighted_sum = 0.
total_weight = 0.
for i = 0 to k – 1
index = indices.get(i)
label_i = labels.get(index)
weight_i = 1 / (distances.get(i) + 1e-6)
weighted_sum += weight_i * label_i
total_weight += weight_i
weighted_sum / total_weight

current_superTrend = superTrend
label_ = knn_weighted(data, labels, k, current_superTrend)

col = label_ == 1?upCol:label_ == 0?dnCol:neCol
plot(current_superTrend, color=col, title=”Volume Super Trend AI”)

upTrend = plot(superTrend==lowerBand?current_superTrend:na, title=”Up Volume Super Trend AI”, color=col, style=plot.style_linebr)
Middle = plot((open + close) / 2, display=display.none, editable=false)
downTrend = plot(superTrend==upperBand?current_superTrend:na, title=”Down Volume Super Trend AI”, color=col, style=plot.style_linebr)
fill_col = color.new(col,90)
fill(Middle, upTrend, fill_col, fillgaps=false,title=”Up Volume Super Trend AI”)
fill(Middle, downTrend, fill_col, fillgaps=false, title=”Down Volume Super Trend AI”)

Start_TrendUp = col==upCol and (col[1]!=upCol or col[1]==neCol) and aisignals
Start_TrendDn = col==dnCol and (col[1]!=dnCol or col[1]==neCol) and aisignals
TrendUp = direction == -1 and direction[1] == 1 and label_ == 1 and aisignals
TrendDn = direction == 1 and direction[1] ==-1 and label_ == 0 and aisignals

longCondition = (Start_TrendUp or TrendUp) and close > DEMA_144 and DEMA_144 > DEMA_169 and strategy.position_size == 0
shortCondition = (Start_TrendDn or TrendDn) and close < DEMA_144 and DEMA_144 < DEMA_169 and strategy.position_size == 0

longStopLoss = current_superTrend
longTakeProfit = close + (close – longStopLoss)
shortStopLoss = current_superTrend
shortTakeProfit = close – (shortStopLoss – close)

if (longCondition)
strategy.entry(“Long”, strategy.long)
strategy.exit(“Take Profit Long”, “Long”, limit=longTakeProfit)
strategy.exit(“Stop Loss Long”, “Long”, stop=longStopLoss)

if (shortCondition)
strategy.entry(“Short”, strategy.short)
strategy.exit(“Take Profit Short”, “Short”, limit=shortTakeProfit)
strategy.exit(“Stop Loss Short”, “Short”, stop=shortStopLoss)

饼占: 48
2023-09-26 18:15:02
多空: 1.34
2023-09-26 18:15:02


免费合约信号

Since 2021-05-16 取之如粪土,弃之如珠玉 吐槽