SellAtStop Same Bar
Author: Stoik011
Creation Date: 2/7/2013 11:45 AM
profile picture

Stoik011

#1
Is it possible to buy and sell position on the same bar?
For example, I have a signal price to open position and I want to exit position on the same bar if my stop price is reached.

BuyAtStop(bar, Low[bar - 1]);
Stop = Low[bar - 1] - Atr[bar];
SellAtStop(bar, ActivePositions[p], Stop, "StopExit")?

When I use this script WL only exits next bar or two bars later. Using SellAtStop(bar+1, ActivePositions[p], Stop, "StopExit") not helps.

Thanks,
profile picture

Eugene

#2
Since your same bar scenario is known to be pretty specific, please look no further:

FAQ > FAQ | Strategies and WealthScript > I want to test a strategy that buys and sells with stop/limit orders on the same bar

Armed with this knowledge, search the forum for "same bar": the search-as-you-type feature is making it effortless, and I'm sure you'll find a number of code snippets to serve as example.
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).