Strategy buying and selling in the middle of a bar?


New member
Hi all,

I'm trying to backtest a strategy that buys and sells under certain conditions in the moment. I mean, I don't want to wait for a condition and then buy or sell on the next bar. When the condition is met, I want the buy or sell order to take place immediately.

Can anyone tell me if that's possible to program into ToS? It's driving me nuts trying to figure it out.

For example, I want to test for a certain condition, then when that condition is hit, calculate 95% of the current price and set an order to buy at that price. I then want to test for a condition to be met on an indicator and when that condition is met, sell immediately, not on the next bar.

Is this possible?


Well-known member
@Fuzzball The best you can do is to use hl2 instead of close... Anything else would give far too many false signals - not that hl2 doesn't produce a few... Unfortunately, we can't use Last...

Similar threads