Freqtrade: Entering trade if resistance line is crossed

Created on 2 Mar 2020  路  3Comments  路  Source: freqtrade/freqtrade

Hello,

I am just wondering what kind of code would I use to create an algo that tells my bot only to sell when the resistance line has been crossed. Struggling to write code on that.

My idea is to say only sell once it has crossed at least two highs over a certain period. Now to decide what that period is a challenge. also to create a decent resistance line.

Any help would be great :)

Question

All 3 comments

i guess detecting the high should work with something around dataframe['high'].rolling(period).max() ...

this will give you a rolling high ... so you should be able to compare using that.

now the problem is that detecting resistance does often not work like this - as the resistance may be a few ticks below the absolute high ... and it "jumps up" and immediately back down when watching it happen in realtime - but that's something the data won't tell you...

you could use close for sure ... - in the end i guess it's up to you to find the best parameters ...

I used something like (dataframe['close'] > dataframe['high'].rolling(60).max()) but I am not getting any sell signals when I back test.

i suspect you'll need to ensure to exclude the current value from the maximum...
high is by definition ALWAYS higher or equal than close - so current close can never be > current or last 60 highs ...
try something like the below:
(dataframe['close'] > dataframe['high'].rolling(60).max().shift())

you may need to experiment with the location of shift() - i suspect using it right before .rolling() should also work - with the difference if you get the last 60 or 59 rolling max candles.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

konstantin-doncov picture konstantin-doncov  路  4Comments

cgw-9527 picture cgw-9527  路  3Comments

issamBD picture issamBD  路  4Comments

Axel-CH picture Axel-CH  路  3Comments

yperfanov picture yperfanov  路  4Comments