繁体   English   中英

买入和卖出信号在情节方面因蜡烛而异

[英]Buy and Sell signals are differing by a candle with respect to plot

我试图根据以下策略生成的信号绘制图表。 但我从脚本中观察到信号生成点与 Candle 不同 如果有人知道这件事,请帮助我。 作为参考,我附上了下面的快照

1. 买入信号快照2. 卖出信号快照


//@version=4
strategy("My Strategy", overlay=true)
orderType = 0
longCondition = crossover(sma(close, 14), sma(close, 28))
if (longCondition)
    strategy.entry("My Long Entry Id", strategy.long)
    orderType := 1

shortCondition = crossunder(sma(close, 14), sma(close, 28))
if (shortCondition)
    strategy.entry("My Short Entry Id", strategy.short)
    orderType := -1
plot(orderType,"OrderType",color.black)
//@version=4
strategy("My Strategy", overlay=true, process_orders_on_close=true)
orderType = 0
longCondition = crossover(sma(close, 14), sma(close, 28))
if (longCondition)
    strategy.entry("My Long Entry Id", strategy.long)
    orderType := 1

shortCondition = crossunder(sma(close, 14), sma(close, 28))
if (shortCondition)
    strategy.entry("My Short Entry Id", strategy.short)
    orderType := -1
plot(orderType,"OrderType",color.black)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM