[英]Strategy entry not getting execute despite condition being fulfilled
strategy("Custom_ema_strategy", overlay=true , shorttitle="Custom EMA Strategy" ,initial_capital=10000, default_qty_type = strategy.percent_of_equity, default_qty_value = 100.00, commission_type="percent", commission_value=0.00)
//Inputs
fastMALength = input(title = "Fast MA Length" , type = input.integer , defval = 10)
slowMALength = input(title = "Slow MA Length" , type = input.integer , defval = 20)
selectSource = input(title = "Source" , type = input.source , defval = close)
fastMA = ema(selectSource , fastMALength)
slowMA = ema(selectSource , slowMALength)
filter = input(title = 'Filter' , type = input.integer , defval = 50)
plot(fastMA , color = color.yellow , linewidth = 2 , title = 'FAST MA')
plot(slowMA , color = color.blue , linewidth = 2 , title = 'SLOW MA')
plot(low , title='Title', color=#00ffaa, linewidth=2, style=plot.style_circles)
longCondition = low > fastMA and low > slowMA
shortCondition = crossunder(fastMA , slowMA)
plotchar(longCondition , 'longCondition' , '')
plotchar(low , 'low' , '')
plotchar(fastMA , 'fastMA' , '')
if longCondition
strategy.entry("Long Entry", long = strategy.long)
一个。 上面的策略没有被执行,因为我的 longCondition 是直截了当的,我只需要低于 fastMA 和 slowMA 的低点。 如您所见,突出显示的蜡烛满足条件但未执行。 不太清楚为什么它不执行。
湾。 这个蓝色突出显示的蜡烛应该失败,因为低点是 6551.00,而 slowMA 是 6551.49,这应该是假的,因为条件是 low > slowMA 但 longCondition 是 1.00,它返回 true。
c。 突出显示的部分显示条件何时满足,在满足条件后如何在下一个蜡烛(箭头指示)处输入策略。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.