pine script - strategy.entry with stop has gap on next day - Stack Overflow

I have situation wereOn, session.islastbar_regular,I have added,strategy.entry(id = 'Long'

I have situation were

On, session.islastbar_regular,

I have added,

strategy.entry(id = 'Long', direction = strategy.long, stop = today_low)

Assuming the stop value is 320, The trade is not executing if the next day opens at 321.

I tried to change to

strategy.entry(id = 'Long', direction = strategy.long, stop = today_low, limit= 400)

Still it is not executing.

If the next day opens at 319 and it crosses over 320 it works.

Looks like the pine script backtester engine has an issue if there is a gap in the next day open. Do you know any workaround?

strate execution when next day open at 321

I have situation were

On, session.islastbar_regular,

I have added,

strategy.entry(id = 'Long', direction = strategy.long, stop = today_low)

Assuming the stop value is 320, The trade is not executing if the next day opens at 321.

I tried to change to

strategy.entry(id = 'Long', direction = strategy.long, stop = today_low, limit= 400)

Still it is not executing.

If the next day opens at 319 and it crosses over 320 it works.

Looks like the pine script backtester engine has an issue if there is a gap in the next day open. Do you know any workaround?

strate execution when next day open at 321

Share Improve this question asked Jan 17 at 17:51 jerin jacobjerin jacob 1
Add a comment  | 

2 Answers 2

Reset to default 0

Try strategy.exit

if strategy.position_size > 0
    strategy.exit(
      id                 = 'Long Exit',
      from_entry         = 'Long',
      stop               = today_low,
      limit              = 400)

One it is executed then only exit make sense. Right? This is the case where the entry is not happening due to gap

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745350833a4623820.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信