Sell at trigger price intra-bar (before bar close)?
Author: Razzler
Creation Date: 9/29/2020 1:28 PM
profile picture

Razzler

#1
Hi All, Sorry if this has been covered, but I haven't seen a direct answer.

Is there a way to code my script so that I exit a position when price falls below a moving average, and (usually) before bar close?

From what I have read so far, the closest way to do this is to sell AtMarket (bar +1) when price hits trigger. However, I would like to sell as soon as price falls below SMA and not wait for close bar. On longer time scales, price can vary significantly between trigger price and bar close price, so I'd like to find a way to avoid that discrepancy.

Can I do a workaround such as something like taking:
SellAtClose(bar + 0, p, "Group3")
...and replacing it with:
SellAtClose(bar + 0, SMA , "Group3")?

Any ideas would be greatly appreciated!
Thanks, Ben.
profile picture

Eugene

#2
Hi Ben,

The process works as explained by this Wiki FAQ:

Is it necessary to have access to intra-bar tick data to daytrade with Wealth-Lab?

One cannot sell intrabar unless it's an AtStop/AtLimit order.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).