Sell and Short (or Cover and Buy) on same bar
Author: kbellare
Creation Date: 3/29/2015 1:12 PM
profile picture

kbellare

#1
Hi,

I have some SellAtLimit[bar+1] and SellAtMarket[bar+1] closing orders.
How do i Short at the same bar I Sell? Using the "IsLastPositionActive" condition to submit new Short opening orders causes me to enter a bar too late and makes the trade unprofitable, because my opening orders are ShortAtLimit[bar+1] or ShortAtMarket[bar+1], as recommended.

Pl advise sample code for detecting Sell and using this to Short in the same bar.

CODE:
Please log in to see this code.
profile picture

Eugene

#2
Same bar AtLimit and/or AtStop orders are not realistic. Please look at this FAQ > I want to test a strategy that buys and sells with stop/limit orders on the same bar.

P.S. The order of exits, i.e. SellAtLimit preceding SellAtMarket, is too optimistic. You might want to fix it in accordance with the WealthScript Programming Guide > Programming Trading Strategies > Peeking > Order of Trading Signals.
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).