- ago
In the PowerPack extension, there is a Condition for "X Losing Trades Within Y Trading Days", which is described as follows:
QUOTE:
"X Winning/Losing Trades Within Y Trading Days" that allows e.g. to pause trading after a number of losing trades.


However, when setting it to a value like 1 and opening the coded version of the strategy, I can see that it's doing this:
CODE:
cntPos = GetPositions(false).Where(p => !p.IsOpen & p.ExitDate >= cutoff & p.Profit < 0).ToList().Count; if(cntPos >= 1) { condition0 = true; }


Based on the description, I believe this is a bug, and it should be using a less-than sign rather than a greater-than sign when checking the count.
0
323
Solved
7 Replies

Reply

Bookmark

Sort
- ago
#1
That code checks for one or more closed losing trades. Sounds good to me. Otherwise it'd trigger true even on 0 losing trades.
0
- ago
#2
My intuition when first seeing this Condition in PowerPack was that I could use it to avoid entering into a position if the symbol recently had a losing trade. That seems to be what the description of the Condition is implying on the PowerPack changelog. But it's actually impossible to accomplish that with the way it's currently implemented. For example, if I do this:



...the result is that it will enter into a new position no matter how many losing trades there were.

With the way it's currently implemented, the only use case seems to be waiting to enter into a new position until there's been a sufficiently high number of losing trades. Is there really a use for that? If the number was set to anything higher than 0, it wouldn't ever enter into an initial position at all...
0
- ago
#3
I might be misunderstanding how this Condition is supposed to be used. Could you please show a brief example of how to "pause trading after a number of losing trades"?
0
Glitch8
 ( 12.10% )
- ago
#4
Here's an example of pausing if there are 4 losing trades in the last 120 bars. I used the Logical Inverter to cause the Condition to evaluate to true if there are NOT 4 losing trades in the last 120 bars.

2
- ago
#5
Perfect, thank you.
0
- ago
#6
Actually, this doesn't seem to work. Glitch, when I set up an example exactly like your screenshot, and then open the Coded version of the strategy, the Logical Inverter is never applied. If I remove the Logical Inverter, the resulting coded version of the strategy is exactly the same as it was with the Logical Inverter.
0
Glitch8
 ( 12.10% )
- ago
#7
Yes, I see that. There's an issue with how to Power Pack Block is coded that is confusing the Logical Inverter. Will get it fixed for the next release cycle.
1
Best Answer

Reply

Bookmark

Sort