Back to Community
How to code on a 1 day timeframe
API

Hello all,

New to this and I know the strategy I want to build I am just asking for assistance with coding it correctly. I want to buy stock A if the 10 period SMA moves above the 30 period EMA. Sell short stock A if the 30 period EMA is higher than the 10 period SMA. I have this set up in a sample algorithm but it seems to me like it is transacting too frequently to let this work. For example when I analyze stock charts I am always looking at a 1 year | 1 day chart timeframe. How do I code correctly with Quantopian for it to pick up in the beginning of the next trading day whether or not the SMA is above or below the EMA so it does not transact out of something that would otherwise be a good trendful trade? I guess what I am asking is how do I set it up so the algorithm looks for this trade one time per day on a daily timeframe and not on a minute by minute basis?

Thanks,

1 response

figured it out with schedule function.