Hi Henry
It’s me again (unfortunately). I’ve been testing the code all week. Works really well however one question and one observation:
1) Can PRT update the orders mid bar? The strategy looks at 15min bars (I know, a lot can happen in 15min). For example,
Triggers and sells 3 @ 160.94
1st cover: buys 1 @ 160.90 (as it should) (-4 ticks away)
2nd cover: 1 buys @ 160.86 (as it should) (-8 ticks away).
net position: -1…all happening in the first 15 min. At the moment I think the code switches to:
elsif countofshortshares=1 then
set stop ptrailing 4
at the beginning of the second bar instead of partway through the first bar as ideally it should. I think the answer is “no” as I understand that PRT only recalculates at the end of each bar? Just checking.
2) I’ve spotted an “nuance” which repeats itself every now and again. Happens where we get triggered and only 1 cover in first 15min as follows:
15min #1
Triggers and sells 3 @ 161.20
1st cover: buys 1 @ 160.16 (as it should) (-4 ticks away)
net position: -2
15min #2
Market continues to fall so stop does not get triggered (stop now at inprice of 161.20 which is as it should and is great).
Bar open at 161.14
System puts in 2 covers:
Buys 1 @ 161.10 (-4 from bar open)
Buys 1 @ 161.06 (-8 from bar open)
net position = 0
a) It is almost as if it doesn’t recognise that the countofshortshares is 2 at the start of this bar and places the two covers which flattens the position when they are hit. Unfortunately this means that I am not able to run the last 1 lot with a trailing stop which is the intention.
b) these covers are placed based on the opening price of the second 15min bar (in this example 161.14, and -4 and -8 ticks below this) instead of the inprice of 161.20 which was the intention. This is actually in my favour when the market is falling however just pointing it out….
I’ve tried playing with the code for days however same results. Any help you can give will be very appreciated.
Thanks for all your help thus far.