First Post for new member!
Trying to make simple strategy based on fast/slow SMA crossover on crossunder
On crossunder, I want to sell my long and begin a short
On crossunder, I want to cover my short and begin a long
My code(below) will not trade past beginning the short, even though running them separately will get all of the crosses.
Any help would be appreciated (or a ref if this has already been solved)
CODE:
Please log in to see this code.
Size:
Color:
Welcome to the forums.
Here is your stop and reverse system:
CODE:
Please log in to see this code.
Can you elaborate on those on-tomorrow's-close orders?
Size:
Color:
Thanks for the example Eugene!
Obviously you already had thought about this.
The particular entry and exit criteria that I had in my post were just made up to be simple, so I wouldn't get confused when someone like yourself offered some help. The main thing I was looking for was the code logic of the reversal from "bear" to a "bull" conditions involving a long and short posistion.
When I detect "bear" conditions, then I would sell my long and then go short.
When I detect "bull" conditions, then I would cover my short and then go long.
"Bull" and "bear" being mutually exclusive.
My criteria to detect "bull" or "bear" conditions are more complex than shown.
I haven't go a chance yet to incorporate your code suggestions, but I will report on their success.
Tnx Again!!
Size:
Color:
QUOTE:
My criteria to detect "bull" or "bear" conditions are more complex than shown.
Anticipating this, the dummy conditions were moved into a pair of boolean variables (maXo, maXu) to easily swap with different ideas.
Size:
Color:
Eugene or Cone.
Would you mind adding a cooledoff thing to the above code.
I am having a hell of a time doing it.
Thanks.
Size:
Color:
Well, let's see how you're doing it and we'll explain what's wrong in there. Show us what you've come up with.
Size:
Color:
For example.
In the code below there are trade on 9/11 and 9/12 so there does no appear to be a delay.
I am trading this fred download: BAMLHYH0A0HYM2TRIV
Thanks again.
CODE:
Please log in to see this code.
Size:
Color:
The way you applied CooledOff is that it affected exits. Here's the corrected revision fixing another error and making something more streamlined:
CODE:
Please log in to see this code.
Size:
Color: