Multiple systems in same loop to soak up cash
Author: tedclimo
Creation Date: 2/23/2011 4:33 PM
profile picture

tedclimo

#1
The system below is just a simple sample so you can help me solve what I am doing wrong.
My goal is the ability to have different "entry" systems in same loop(at least 2, perhaps 3-4) so that system #1 soaks all possible cash available, then if there is still cash left, system #2 kicks in.
As it stands right now(Compiles fine), only system #1 works, and system #2 is ignored.
Critical that LastPosition.Priority be included in each Entry system.
Can you help me resolve problem?
Thanks in advance.


CODE:
Please log in to see this code.
profile picture

Cone

#2
There are options, but generally, logic on the Portfolio cash level should be performed in a PosSizer, where you can, for example, enable different trading systems or signals on some basis - like Position.Priority, signalName, etc.

QUOTE:
system #1 soaks all possible cash available, then if there is still cash left, system #2 kicks in.
I know there's logic in there somewhere, but I don't see it. If all the cash is "soaked up", then by definition none is left for system #2... or no?
profile picture

Eugene

#3
QUOTE:
As it stands right now(Compiles fine), only system #1 works, and system #2 is ignored.

Sure, as first you're checking for a condition (system A, RSI < 5) that eliminates the chance of taking a trade by system B (RSI < 20) in this single-position system design pattern.
profile picture

tedclimo

#4
Eugene, change System A to RSI<1 (a near impossible event)and System B still never works. Code above has < 5% exposure when run on SP-500 for last 10 yrs.

Cone, my goal is to come up with a solution where multiple systems are applied to keep me fully invested. And systems are given priority based on their profitability when backtested independently. Not necessarily the two systems above. Once I have a working solution, then we could plug any two systems in place of System A & System B above

My solution above is broken. You mentioned it is possible to enable different trading systems via Pos-Sizer using Position.Priority or signalName. Can you point me to Pos-Sizer that does this or Wiki that explains how.

Would be easier if I could get code above to work(i.e. System B to kick in, when System A does not produce enough trades to keep me fully invested.

When System A above has
CODE:
Please log in to see this code.
removed, then System B works. But System A loses important Priority.

Eugene, our two postings crossed. Will try your solution below now.
profile picture

Eugene

#5
Give this a try:
CODE:
Please log in to see this code.
profile picture

tedclimo

#6
PERFECT!!!!
Both systems performing with priority going to System A
Thank you.
This website uses cookies to improve your experience. We'll assume you're ok with that, but you can opt-out if you wish (Read more).