The opinions expressed in these forums do not represent those of C2, and any discussion of profit/loss
is not indicative of future performance or success.
There is a substantial risk of loss in trading. You should therefore carefully consider
whether such trading is suitable for you in light of your financial condition. You should read,
understand, and consider the Risk Disclosure Statement that is provided by your broker
before you consider trading. Most people who trade lose money.
Finally making progress with Seetu. However, hitting an issue with excess short signals. Let’s say I enter a short position, have some exit signals, but want to cover the position no matter what in 20 minutes (trading intraday on 1 minute bars).
No problem. I simply add to my cover:
OR BarsSince(Short) == 20
That should do it, yes? Well, yes, except let’s say there is a second Short signal at the 10 minute mark. In Amibroker, using the standard backtester, those extra entry signals are removed. However, in Seetu that doesn’t seem to be happening, and I’m getting trades that last way more than 20 bars, as the BarsSince(Short) keeps resetting to 0 due to a new Short signal while I’m still in the original trade.
My next thought was to use ExRemSpan(Short,20), but that’s both obsolete in Amibroker and not implemented in Seetu.
How can I backtest (and then send signals to an actual trading system) that cap at a certain duration (e.g. 20 bars) no matter what? Any help is appreciated.
I should add that the same problem is blowing up my profit target and stop loss in backtesting, as they are based on the ValueWhen(Short,Open)… but then additional Short signals happen prior to a Cover signal and the profit target and stop loss get based on the new Short signal bar.
How is it done in Amibroker? Yes, extra EXIT signals are removed. But ENTRY signals? I think it can happen only - say - you do not have cash or something like that. Or is there some setting for that there?
I think you need to clear unwanted entry signals in your code somehow.
So I guess the question is how to implement ApplyStop in the code. Your ExRem example doesn’t work if the Cover signal has a dependency on the Short signal. Let’s use a Stop Loss as an example.
Stop Loss = Short price (the Open of the short signal bar)
Coding a 3-point Stop Loss looks something like this.
myBarsSinceShort = BarsSince(Short);
myStopLoss = ref(Open-3,-myBarsSinceShort);
Cover = High >= myStopLoss;
CoverPrice = myStopLoss;
But now imagine each bar goes up 1 point, and every other bar generates a new Short signal. Every second bar ends up recalculating the myStopLoss based on the reset myBarsSinceShort and you never hit the Stop Loss… it gets higher and higher.
If you use ExRem, it does no good, because the values of the myStopLoss array are already calculated… even if you remove signals, the values remain unchanged. And you can’t remove those signals until you calculate the Cover signals… which never hit.
Make sense? Not sure what to do. I’ve betting the actual trade signals will work, as they will make the Stop Loss and Profit Target static. But that won’t let me do an N-bar stop, and I can’t test any of it. I’ve tested it in Amibroker, but I need to test it here to make sure it is behaving as expected.
Yes. I’ve been testing that approach since I posted. The main issue I’m trying to overcome is that I end up losing a lot of good entry signals. I have a very tight profit target, so most trades are pretty quick. When I use the longer barssince, everything works but I have far fewer total trades. Still working on it.