@Matchsolo
Always use the ‘Insert PRT Code’ button when putting code in your posts to make it easier for others to read.
Thanks 🙂
Yes, i’m getting the same error message today although backtests worked fine at the weekend. For now I’m running tests without tick by tick and getting the same results that I got at the weekend with tick by tick checked.
I am reassured to note that I am not the only one…
paul, could you send the complete version of yours? 🙂
new version with Paul’s TS and modification to the MaxPositionsAllowed code – thanks to @fifi743
PaulParticipant
Master
Looks very nice and found more performance! I start doubting too btw how the tick by tick & spread is handled with cumulative positions.
ullle73, there are too many changes i’am making (layout) and still experimenting.
About the strategy, i’am taking another approach. The equitycurve is very nice, however it’s depended on multiple positions, which could be a warning? I’am not sure.
So i’am testing a different way to see if it can work with 1 position, but taking every signal into account. And that works too it seems.
Nonetheless, try set maxallowedpositions to 1. Something seems off if that’s used in v5
Here’s an early pic with 1 position.
this is v5 with max positions =1
looks ok to me, except that it’s with tick by tick unchecked. the result is consistent with what i was seeing at the weekend though, so seems to me that either this result is correct or none of our results is correct.
are you getting backtests with t-b-t ?
Hi
Thank you very much for sharing this strategy, it’s a great approach to run a strategy with just a few entry criteria. I have been learning to keep entry signals to a minimum, and that the exit and position sizing are as important as the entry signals (highly recommend ‘Quantitative Trading’ by E. Chan, and ‘Building Winning Algorithmic Trading Systems’ by K. Davey). I ran the results of the latest strategy through a Monte Carlo Simulatro (provided by the author of the second book) which uses a random sampling and replacement approach. The parameters I’ve used are below, but it’s another way of looking at a strategy to test it’s future robustness.
Capital: 3,000
Risk per trade: 5
As you can see, even at these levels, the risk of ruin is only 4%, provided you can live with a 33.3% drawdown. Keeping the Risk per trade constant, it would be wiser to run a starting equity of closer to 5,000.
Regardless, it’s another way of seeing how it may perform in the future, and the results are very strong. Thank you once again.
Results from the PRT platform with the same test parameters, for comparison.
PaulParticipant
Master
The test I did was with tbt. Didn’t check the difference with on/off. But I’ve lost my settings (own fault) for that equitycurve. That was without optimised sl/pt & ts.
In demo strategy, one trade exits on stoploss and positionsize went from 8 to 7. I thought in the live version it only can go from 8 to 0, maybe with exception of exits on stoploss?
new version with Paul’s TS and modification to the MaxPositionsAllowed code – thanks to @fifi743
Thanks for the great work. I ve spotted an error concerning the enter conditions : when you use CountOfPosition when you are short on market, the result is negative so you need to use ABS function. Otherwise the condition is always true and you can sellshort an unlimited number of contracts.
IF Ctime and c1 and c1a AND C3 and c3a AND C5 and c5a and abs(CountOfPosition) <= MaxPositionsAllowed THEN
IF Ctime and c2 and c2a AND C4 and c4a AND C6 and c6a and abs(CountOfPosition) <= MaxPositionsAllowed THEN
Sorry the correct code is :
// Conditions to enter long positions
IF Ctime and c1 and c1a AND C3 and c3a AND C5 and c5a and abs(round(CountOfPosition/positionsize)) < MaxPositionsAllowed THEN
BUY positionsize CONTRACT AT MARKET
SET STOP %LOSS 1.3
SET TARGET %PROFIT 2
ENDIF
// Conditions to enter short positions
IF Ctime and c2 and c2a AND C4 and c4a AND C6 and c6a and abs(round(CountOfPosition/positionsize)) < MaxPositionsAllowed THEN
SELLSHORT positionsize CONTRACT AT MARKET
SET STOP %LOSS 1.1
SET TARGET %PROFIT 1.4
ENDIF
I ve spotted an error concerning the enter conditions
Thanks Roger, you’re absolutely right, it won’t work the way it was. I went for a slightly different solution:
Once MaxPositionsAllowed = 5*positionsize
// Conditions to enter long positions
IF Ctime and c1 and c1a AND C3 and c3a AND C5 and c5a and COUNTOFLONGSHARES <= MaxPositionsAllowed THEN
BUY positionsize CONTRACT AT MARKET
SET STOP %LOSS 1.3
SET TARGET %PROFIT 2.1
ENDIF
// Conditions to enter short positions
IF Ctime and c2 and c2a AND C4 and c4a AND C6 and c6a and COUNTOFSHORTSHARES <= MaxPositionsAllowed THEN
SELLSHORT positionsize CONTRACT AT MARKET
SET STOP %LOSS 1
SET TARGET %PROFIT 1.4
ENDIF
This uses a different definition of “Maxpositionsallowed” – not the total number of contracts, but the number of entries regardless of size. This way it will work with MM as the positionsize changes.
Here’s another variation using 1m, 5m, 15m with the alternative entry conditions (beginning the run when the 5m changes direction, then adding positions on each 1m dip). Goes without saying that it is curve fit to these few months, but could be worth forward testing on demo to see how it plays out.
Hi nonetheless
You add this line at the end of the algo and make a test?
Mrsi=RSI[14](close)
if longonmarket and CurrentDayOfWeek=5 and close>positionprice and Mrsi crosses under 70 then
sell at market
endif
if shortonmarket and CurrentDayOfWeek=5 and close<positionprice and Mrsi crosses over 30 then
exitshort at market
endif