Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we add a support and resistance indicator? #37

Open
lorrp1 opened this issue Jul 20, 2018 · 1 comment
Open

Can we add a support and resistance indicator? #37

lorrp1 opened this issue Jul 20, 2018 · 1 comment

Comments

@lorrp1
Copy link

lorrp1 commented Jul 20, 2018

No description provided.

@methenol
Copy link
Collaborator

methenol commented Aug 12, 2018

With a support/resistance indicator, I'm assuming the context comes from the value of the current price in relation to the support/resistance line, similar to a bbands strategy. It might be best to calculate a percentage of where the current price is between the two, or work off true/false if it crosses the line. I don't have a good grasp on what's going on with the price scaling in the environment but anticipate that if they are scaled independently that the relationship between the price and the support/resistance lines would get skewed.

There's a school of thought that you really don't want to feed the network stuff that it can calculate on it's own mathematically (not sure how true this is). For example, if RSI is a mathematical function of price, then feeding it in is just adding more data for it to determine the relevance of and clutters the signal. However, if the value is based on data outside of the window that the LSTM layer is looking at, then there may be value added.

This is on my list of things to try, currently trying to get the environment isolated from hypers to better test things like this.

A really rough implementation of an ema crossover/under that I used in a different environment looks like this, if it helps anyone:

        self.series['emaCrossover'] = np.where(self.series['MA_5'] < self.series['MA_10'], 1, 0)
        self.series['emaCrossunder'] = np.where(self.series['MA_5'] > self.series['MA_10'], 1, 0)

Also, I don't see anything for support/resistance in the talib or jhtalib libraries. However, there's this (I didn't write it) that would be easy to implement:

#Pivot Points, Supports and Resistances
def PPSR(df):
    PP = pd.Series((df['high'] + df['low'] + df['close']) / 3)
    R1 = pd.Series(2 * PP - df['low'])
    S1 = pd.Series(2 * PP - df['high'])
    R2 = pd.Series(PP + df['high'] - df['low'])
    S2 = pd.Series(PP - df['high'] + df['low'])
    R3 = pd.Series(df['high'] + 2 * (PP - df['low']))
    S3 = pd.Series(df['low'] - 2 * (df['high'] - PP))
    psr = {'PP':PP, 'R1':R1, 'S1':S1, 'R2':R2, 'S2':S2, 'R3':R3, 'S3':S3}
    PSR = pd.DataFrame(psr)
    df = df.join(PSR)
    return df

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants