首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >笔迹策略未策划

笔迹策略未策划
EN

Stack Overflow用户
提问于 2021-01-25 08:45:24
回答 1查看 280关注 0票数 0

我试图根据以下条件为图表创建一个图:

  1. ,这是连续第二个开在9天MA线
  2. 之上的绿色酒吧,它在RSI

上超卖

然而,它似乎没有密谋,我有一个感觉绿be变量返回错误的原因-有什么想法吗?

代码语言:javascript
复制
strategy(title="Swing Strat", pyramiding=1, overlay=true, default_qty_value=2, default_qty_type=strategy.fixed, initial_capital=100, currency=currency.GBP)

//Plotting SMA lines
MAPeriod9 = input(9, title="9 MA Period")
MA9 = sma(close, MAPeriod9)
MAPeriod180 = input(180, title="180 MA Period")
MA180 = sma(close, MAPeriod180)

plot(MA9, color=color.blue, linewidth=1)
plot(MA180, color=color.red, linewidth=1)

// Creating the RSI
rsiSource = input(title="RSI Source", type=input.source, defval=close)
rsiLength = input(title="RSI Length", type=input.integer, defval=14)

rsiOverbought = input(title="RSI Overbought Level", type=input.integer, defval=70)
rsiOversold = input(title="RSI Oversold Level", type=input.integer, defval=30)

//get rsi value
rsiValue = rsi(rsiSource, rsiLength)
isOverbought = rsiValue >= rsiOverbought
isOversold = rsiValue <= rsiOversold

//identifying green confirmation bar
MAcrossover = crossover(close, MA9)
entrypoint = barssince(MAcrossover)
greenbc = entrypoint==1 and MA9<open and open<close and open[1]<close[1]

//combining the green bar confirmation and oversold variable
tradingsignal = ((isOversold or isOversold[1]) and greenbc)

//plotting the entry point to the chart
plotshape(tradingsignal and greenbc, title="Entry Trigger", location=location.abovebar, color=color.red, transp=0, style=label.style_xcross, text="Entry Point")
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-01-25 09:14:37

Plotchar您的个人条件,以获得一种感觉,他们是否是触发一致。

代码语言:javascript
复制
plotchar(entrypoint, 'Entry Point','')
plotchar(greenbc,'Greenbc','')

等。

图形函数需要一种形状样式。style=shape.cross

plotshape中的greenbc是多余的,因为它已经被用来创建交易信号。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/65881456

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档