Hi!
I'm running eSignal 8.0
I'm successfullt adding to positions in backtesting (with Strategy.doLong/Strategy.doShort, I'm successfully exiting partial positions on a profit target (Strategy.doSell/Strategy.doCover, but when my stop is eventually hit, I hit a snag. Even though the Strategy.isLong is reset, and parts of my remaining position is closed out at the correct date/price, my entire remaining position is not closed out for some reason.
I've tried both:
var nLot = Strategy.getPositionSize();
Strategy.doSell("Long Stop2", Strategy.STOP, Strategy.THISBAR, nLot, nStop);
(where nStop is the stop price)
and
Strategy.doSell("Long Stop2", Strategy.STOP, Strategy.THISBAR, 8300, nStop);
(where I know 8300 is the number of shares that should be in the position at this time (also according to the trades tab on running the backtest))
But it just refuses to stop me out of my entire position, carrying the long position over to the next signal, and even signals after that before eventually stopping out at a later stop. This happens even if a short signal is correctly processed inbetween.
On top of this:
If, for some reason, I've added to a position enough so that I exit more shares than the initial entry-position on a profit target, the subsequent stop is not recorded at all in Trades, but Strategy.isLong is still reset.
(that is in all of the above:
if(Strategy.isLong()) {
setBarBgColor(nReturnBgColor); }
shows the "right" trade, but it is not correctly recorded under Trades in backtesting)
So, obviously my adding to a position messes "something" up, as partialing out of a position works correctly without adding to the position, but I don't understand how and why this would affect anything at all....
Help appreciated...
Regards,
Bugg
I'm running eSignal 8.0
I'm successfullt adding to positions in backtesting (with Strategy.doLong/Strategy.doShort, I'm successfully exiting partial positions on a profit target (Strategy.doSell/Strategy.doCover, but when my stop is eventually hit, I hit a snag. Even though the Strategy.isLong is reset, and parts of my remaining position is closed out at the correct date/price, my entire remaining position is not closed out for some reason.
I've tried both:
var nLot = Strategy.getPositionSize();
Strategy.doSell("Long Stop2", Strategy.STOP, Strategy.THISBAR, nLot, nStop);
(where nStop is the stop price)
and
Strategy.doSell("Long Stop2", Strategy.STOP, Strategy.THISBAR, 8300, nStop);
(where I know 8300 is the number of shares that should be in the position at this time (also according to the trades tab on running the backtest))
But it just refuses to stop me out of my entire position, carrying the long position over to the next signal, and even signals after that before eventually stopping out at a later stop. This happens even if a short signal is correctly processed inbetween.
On top of this:
If, for some reason, I've added to a position enough so that I exit more shares than the initial entry-position on a profit target, the subsequent stop is not recorded at all in Trades, but Strategy.isLong is still reset.
(that is in all of the above:
if(Strategy.isLong()) {
setBarBgColor(nReturnBgColor); }
shows the "right" trade, but it is not correctly recorded under Trades in backtesting)
So, obviously my adding to a position messes "something" up, as partialing out of a position works correctly without adding to the position, but I don't understand how and why this would affect anything at all....
Help appreciated...
Regards,
Bugg
Comment