Back to Community
EMA? Change Data Frequency to 4H

Hi!

I have been trying to learn how to use quantopian but it is being quite difficult for me as I have a finance background and I know just a little bit of code.

My goal now is to build an algorithm by which I open a long position when the low price is above the 50 EMA and a short position when the high price is below the **50 EMA.

The very big problem that I am finding out is that I don't know how to use a Frequency of 4H while writing the code to get the data.history. I have seen that I could use Pandas Resample but I do not understand well how can I do it.

Also I want to add a Take Profit when the price is 150 above (for the long positions) or 150 below (for the short positions) the price at which I opened my position. And a Stop Loss when the price is 50 below (long positions) or 50 above (short positions) the price at which I opened my position.

Currently to calculate the EMA I am using TALIB, as I have seen that most of you do. The reason for that is that I want to do the backtest just with some specific securities and I do not know if I can do so using Pipeline. Also another option is to do the backtest with the TechSector (what I know that I can do using Pipeline).

I would be so grateful if anyone could help me. Thanks a lot in advance for your time!