Quantopian's community platform is shutting down. Please read this post for more information and download your code.
Back to Community
Why

Why bet correctly at the beginning when price>ma100 but close the position too late when price<ma100 instead of price<ma10 as the script call?
Where I'm wrong?
Thanks and please forgive my poor english

3 responses

I believe this is due to the order of your if statements. The ma10 condition is only checked when the "if" condition is not met. This is because of how "elif" (else-if) works. Just change the order if you want to give the ma10 signal higher priority.

Thanks very much
..I apologize... I feel very newby

Of course, and it's no problem, I did not know this until a few days ago either.