I have a trading system that I want to use to go long and short. The intent is to have only one position in a stock (long or short or out) at a time. The problem is that longs open and close as intended but shorts frequently fail to cover(close) when the rules are met. More than half of the shorts do not cover.
The system's code shown below was created from rules by WLP.
CODE:
Please log in to see this code.
All parameters have unique names. Can you see why many shorts are failing to close?
Thanks,
Sherm
Size:
Color:
Here the code closes all shorts gracefully. Specifying a particular scenario (symbols, bar scale etc.) might clear things up.
Size:
Color:
Size:
Color:
I don't have the .DJI but on ^DJI, no single trade since 1990 was left without covering using the default strategy parameters (not sure what do you mean by "Last parameter not included").
Size:
Color:
I have .DJI, but I can't duplicate it either with the default parameters.
After looking at your results, I'm confident that you have not provided us with the strategy that you're testing. The strategy in your initial post only allows for a single open Position, so it's impossible to have open short positions while trading other active positions.
At some point you must have clicked on "Multiple open positions Allowed" in the Strategy Builder, and that may have the effect that you describe due to your programmed logic.
Size:
Color:
Size:
Color:
No, I can't see why. It's impossible with the code that you posted. Try repeating the procedure with that.
Separately, please create a support ticket and attach the xml Strategy file so I can take a look from that angle.
Size:
Color:
1) The problem of unclosed shorts appears in optimized runs of the both the rules and code versions of the strategy. In making your declarations of "impossibility", have you been basing you review of results of optimization runs? If not, please do so.
2) Please clarify, repeat what procedure?
3) Did you look at the 5 images I sent you?
4) You mentioned "It's impossible with the code that you posted." I can assure you that the code posted on 10/24/2011 at 9:56 PM and the rules I posted 10/26/2011 at 9:37 PM do produce unclosed short trades in optimization runs.
5) What is a xml Strategy file and how is it created?
Size:
Color:
An "
else" separating the long entry from the short one solves the problem. Furthermore, I think that the previous version of the code wasn't up to your expectations.
CODE:
Please log in to see this code.
Size:
Color:
Admittedly I was wrong about the impossible - the way the wizard code produces entry signals allows multiple positions to be created on the same bar. When you mix LastPosition logic with multiple positions, it just doesn't work.
The positions on the same-bar issue is actually a wizard deficiency that we've highlighted in the past, but I've got too short a memory - sorry about that.
---
I just want to add that I would have been able to duplicate the problem when I ran the code if all the details were provided, in this case, especially the Data Loading configuration and parameter values.
Size:
Color:
Robert, to duplicate the problem see the
optimized parameter screenshot -- the line on top (22,82,1,0,102,82,2,31,60,82).
Size:
Color:
Not required now.
Size:
Color:
Cone,
Seems like my 10/25, 9:35 PM post should have provided enough information to address your "I just want to add that I would have been able to duplicate the problem when I ran the code if all the details were provided, in this case, especially the Data Loading configuration and parameter values." comment. Maybe paying more attention to the information provided would have tempered your "After looking at your results, I'm confident that you have not provided us with the strategy that you're testing. The strategy in your initial post only allows for a single open Position, so it's impossible to have open short positions while trading other active positions." feedback.
An improvement in the tone of your responses would be appropriate and appreciated.
Size:
Color:
I've been wrong before, and I'll be wrong again. However, the images in that post don't show the parameters used, and the problem doesn't occur with 1 year of data using the default parameters.
Anyway, I'm sorry for my misplaced confidence.
Size:
Color:
Any plans to fix the wizard deficiency?
Thank you for the corrected code.
Size:
Color:
There are plenty of deficiencies to choose from, but this one didn't get picked up for 6.3. It's actually pretty rare that someone runs into it, and it's pretty easy to fix by a light edit. The Strategy Builder will always have it's limitations, but I'd agree that something that can be done with it should work correctly.
Size:
Color: