Created
March 13, 2017 02:57
-
-
Save ypochien/49c4056c726094aa35068f09fd3c0b41 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
def calc(*_ohlcv): | |
data = dict(list(zip(['open','high','low','close','volume'],_ohlcv))) | |
ohlc = pd.DataFrame(data) | |
stratData = pd.DataFrame(index=ohlc.index) | |
stratData['cc'] = 100*ohlc['close'].pct_change() | |
stratData['co'] = 100*(ohlc['open']/ohlc['close'].shift(1)-1) | |
idx = (stratData['cc']<-0.25).shift(1) & (stratData['co'] < -0.1) | |
idx[0] = False | |
stratData['goLong'] = idx | |
return [int(elem) for elem in stratData['goLong']] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment