这可能是有史以来最愚蠢的问题,但是无论何时renko图表更改颜色/方向,我都会立即收到警报。在第一个红色或绿色框之后,我收到警报。基本上,这意味着您始终在市场中。那不是我想要的。
我想要什么: 1.在第二个新的红色或绿色框之后打开警报。 2.在第一个新的红色或绿色框之后关闭。
我不了解松木脚本,因此想问问是否有人可以给我指导。 Please check for the image here of how it is right now.
我想用长和短箭头打开1个框。因此,第二个盒子进入长边之后=打开长边。在第二个框进入短边之后=打开短线。
现在的代码是:
//@version=2
study("Renko Reversal alert", overlay=true)
//Buy entry if a bearish renko brick is followed by a bullish brick
//Sell entry if a bullish brick is followed by a bearish brick
long = close > open[1] and close[1] < open[2]
short = close < open[1] and close[1] > open[2]
//Use these alerts to create server-side alerts (right-click on one of the buy or sell arrows on the chart and choose "add alert")
alertcondition(long, title='Long opportunity', message='Renko reversal')
alertcondition(short, title='Short opportunity', message='Renko reversal')
//Use this to customize the look of the arrows to suit your needs.
plotshape(long, location=location.belowbar, color=lime, style=shape.arrowup, text="Buy")
plotshape(short, location=location.abovebar, color=red, style=shape.arrowdown, text="Sell")
我想我需要在这里进行一些更改,但是我不知道该将其更改为什么: long =关闭>打开1,然后关闭1 <打开[2] short =关闭<打开1并关闭1>打开[2]
很想听听是否有人可以帮忙。
亲切的问候,
M。
答案 0 :(得分:1)
您可能应该阅读有关History Referencing Operator的信息。
long = close > open[1] and close[1] < open[2]
表示,如果当前收盘价(close
)大于一个酒吧前的收盘价(open[1]
和(and
),则当前收盘价(close[1]
)一小节前(open[2]
)低于两小节前(long = close[1] > open[2] and close[2] < open[3] and close > open
short = close[1] < open[2] and close[2] > open[3] and close < open
)的开盘价。
因此,您要做的是通过增加历史索引将所有这些值移动一个小节,然后为当前小节添加条件。
{{1}}