I am trying to limit the number of positions to 10 longs and 10 shorts, but when I run the code below, the results show 10 total positions instead. I have the slider under strategy parameters set to 20. I have tried using 5% equity for position size, and a $5,000 fixed dollar amount with $100,000 starting capital and get the same results for both. Thanks to anyone that can offer help.
CODE:
Please log in to see this code.
Size:
Color:
i think you are leaving out brackets around an if statement and so are not getting the result that you think you are getting.
your code:
CODE:
Please log in to see this code.
here's what i think you want:
CODE:
Please log in to see this code.
assuming this is right, since i only eyeballed it. you need to also apply the same fix to the short side
Size:
Color:
CODE:
Please log in to see this code.
This could be wrong, but shouldn't the activelongs/activeshorts rule be checked after already having checked for the right symbol?
CODE:
Please log in to see this code.
Size:
Color:
i think the code should probably be restructured a bit, but i think this works:
CODE:
Please log in to see this code.
Size:
Color:
I tried using both suggestions and it seems that Steve's solution does the trick. Thanks to Steve and Eugene for your help. Much appreciated.
Size:
Color: