Hello
In order to hedge Forex trading, I'm running two independent
trading
systems. One performs well in certain situations, the other
under "opposite" conditions.
However, the two systems will often
provide "opposite" tradesignals
(long/short), even in the same bar. I
still want to take the two
trades, as they have different exit criteria.
In order to control multiple trades on the same bar independently,
I've been trying to use "backtestRegularRawmulti" with custom
backtester. Entering multiple trades on a bar works fine this way
(using positionScore to indicate to the custom backtester if two
positions in the same direction should be taken).
However, I have
a hard time figuring out a way to control the exits.
bo.ExitTrade()
seem to exit the first (last?) entered open position
and have no parameter
to indicate what position to close - so unless
the trades come in a
certain order (they don't), the wrong trades are
being closed out. So I've
been trying to use sigScaleIn/Out in
various ways, but with no
luck.
Also, I've been trying to use the applyStop(stopModeBars) as
a
trigger mechanism (but pos.barsInTrade is a readOnly property - so
I've not been able to force an exit this way on an individual open
position).
Is there a way to control exits independently? Like if
the trade
object had a pos.ExitTrade() method, or by some other
means?
Regards
Jens Tiedemann