I extended  a strategy  named "RSI_BULL_BEAR_ADX_PINGPONG" with _PEEKTREND

You can find the code originally written by Tommie Hansen and Rafel Martin (CC-BY-SA 4.0)
And adjusted by me here :

About    _PeeKtrend
Most stoploss functions I've seen just get out of the market if the price is below a percentage or a fixed amount, of the original bought price.
Well, I'm no great fan of that, there is nothing wrong about going short, (as it can allow for a new long from a lower start).
However I don't want to go down the whole ride again, or just less of it.

So PeekTrend keeps track of the highest price since you went long. 
The highest price named MaxPeekClose is calculated as :     ( candle.close * closeRatio + candle.high *highRatio) / (closeRatio+HighRatio)
Then short depends upon  candle.close < MaxPeekClose * peekPercentage + peekShift
This is logged to the gekko console as well as escaped failing trend with some additional data.
I log that to console since if it happens to frequent the other code wont kickin there should be some balance between this and that to get it good working.

If no short happens then the original code continuous trading
   (the greens are on top of the TOML file )

The above math still can loose you money as its not a HODL, but one might escape earlier.
If sudden price spikes happen (but you missed them) and shortly after the price falls deep.
Then the peeks raised the upper bar and so you can have some part of the peak (instead of the deep fall).
Where the original code didn't.

at the bottom of the post, there is a screenshot of the code in a market that went slightly down the TOML provided was unaltered
So under the same conditions, you get the same.

Oh well but essentially this is where you come in !!!!
Please  test it, find better settings or alter it, and let others now here  
For those who want to alter the code
I placed a small note in the check function maybe you can help me with that.

I could improve PeekTrend function even more if somehow I could retrieve the price at which a long was really buying coins, ea not the last close.
So if you know how to let me know, please.

side note, I noticed the code can be configured to work well with various time ranges.


(oh and wow after a lot of hacking managed to run GEKKO normally on windows without BASH ! ... see other threads here for that ).

Messages In This Thread
New strategy : RSI_BULL_BEAR_ADX_PINGPONG_PEEKTREND - by PGTART - 09-02-2019, 02:19 PM

Forum Jump:

Users browsing this thread: