Example of Stoploss Black Line on Chart
我今天的问题与绘制一条简单的黑线有关,这将为何时手动采取止损提供视觉帮助。我的策略利用止损,它也通过使用图形形状来绘制红色或绿色箭头信号条目来实现。当绘制箭头时,止损开始起作用...然后,它绘制其上的蜡烛,并绘制一条水平线,该蜡烛线连接到蜡烛线低位(卖出时)和蜡烛线高位(卖出时)。一旦策略绘制了相反的箭头,它将绘制一条斜线直到指定的蜡烛低/高。
如果需要额外的信息,可以说
时,信号箭头绘制在图表上bullPoints = 2 // bullPoints receives 2 when conditions are met ideally signaling long
bullPlot = if bullPoints == 2
true
else
false
plotshape(series=bullPlot, shape=style.triangleup, location=location.belowbar, color=color.green)
如何绘制止损的基本概念?
答案 0 :(得分:0)
您需要注意触发停止级别发生变化的事件,并在事件发生时对其进行更改。 var
关键字用于初始化stop变量,以便其值自动在bar之间传播。
还显示了在绘制止挡点时避免过渡的示例:
//@version=4
study("Stop", "", true)
// Need to have your conditions here.
bullPoints = bar_index % 22 == 0
bearPlot = bar_index % 33 == 0
bullPlot = bullPoints and not bearPlot
// This code should not require changing.
var stopLevel = 0.
if bullPlot and not bullPlot[1]
// bullPlot just became true; save low.
stopLevel := low
else
if bearPlot and not bearPlot[1]
// bearPlot just became true; save high.
stopLevel := high
plotshape(series=bullPlot, style=shape.triangleup, location=location.belowbar, color=color.green)
plotshape(series=bearPlot, style=shape.triangledown, location=location.abovebar, color=color.maroon)
plot(stopLevel, "Stop")
// This plot doesn't show transitions.
plot(stopLevel, "Stop No transitions", change(stopLevel) ? na : color.blue, 15, transp = 80)