TradingView
Gentleman-Goat
2020年9月19日午後3時58分

Function Polynomial Regression Strategy 

Bitcoin / U. S. DollarKraken

詳細

To be clear I'm using the code from Richard Santos for the functional polynomial regression. I really loved his script idea (given that I'm into linear regression myself). I took his code and made a strategy which applies to bitcoin on the 5 minute chart (but you could adjust this for any asset), and you could make this work on anytime frame by adjusting the 'length' property of the regression until you get good results.

This strategy is very simple.

I drew lines to represent the bottom most part of the regression (green line), and top most part (red line). If the close crosses under the red line then you short. The reverse if it crosses above the green line then you go long.

Very simple but effective. To understand this script be sure to add Richard santos function polynomial regression so you can see what is going on and what I'm trying to do.

For example, on BTC with a length of 61 if you bought and held you would have only had 5% gain, instead with this strategy you are looking at very close to 60% gains! Now this could be a weird fluke of over-optimizing but I'm not sure this is the case because you can adjust the length from there +/- about 10 and still have good results. It's just certain lengths are the correct trading rhythms for different assets.

I'm excited to see how you guys use this and if you have any success. Be sure to thank Richard Santos for his great work!

リリースノート

I added trailing stop loss as requested by some users just enable it in the settings with the gear icon. By default I have it turned off, but with ETHUSD you can see that it can create improvements with the right settings. Just tweak it until you find the right settings.

リリースノート

I added backtest date range and the ability to:

- Do only LONGS
- Do only SHORTS
- Close instead of Short
- Close instead of Long

In the example uploaded, you can see that by turning off allowLongs, and enabling close instead of long you can see how effective this strategy is with just shorting alone. Using this you can optimize your parameters for just shorting or longing and then combine them later for the best settings.

Thanks to investCHK for the suggestion!
コメント
khanzed897
Brilliant indicator! I'm currently using it on NASDAQ and US30 to scalp. Is it possible to include a midline of the red and green lines please. This can help us determine if price is overall bearish or bullish depending if its above or below the midline
mshivasharan
Hi, firstly great work and thanks for sharing here. Could you please let me know, In order to get Long, short and stop loss triggers, for other indices like nifty, bank nifty, what modifications have to be done?
Gentleman-Goat
@mshivasharan, I will be adding some fancy stop loss triggers soon once I have some time, I've been having to work a day job which has been taking up so much time!
JanLosev
It's fine. Was looking for decent work with polynomial regression.
Thank you!
Gentleman-Goat
@Crypto_Elk, Thanks for your kind words!
Gentleman-Goat
Just wanted to share some numbers that seem really promising, on XBTUSD (on the 1 minute chart), try using 49 length, with stop losses, set short stop loss to 0.1 and 0.4 for long stop loss. Notice it creates a steady trend upward in a linear line which is a good sign for a good strategy. I went back in time using the rewind tool and this held up time and time again with barely any failures and in fact even a few 25% gains on some of the intervals. Feel free to test this yourself to see if you agree and any feedback.
Gentleman-Goat
@x11joe, Using this same strategy if you trade futures, do 3 contracts at $1 USD per contract (which is usually the going rate). Amazing gains :), you'll want $5000 margin, but you will see consistent 30 to 100% gains, there is some losing periods where the drawdown goes to 30% but it rarely ever does this and your gains totally eclipse the losses, and usually it remains under 10% on average which is what I targeted it at. Overall pretty safe return for margin investment required.
Littlefish2020
@x11joe, Hi, Could you please setup the alert version? Thanks a lot!
Gentleman-Goat
@Littlefish2020, It should work with alerts already? What errors are you getting?
shayulajiao
Really nice work! I try to rewrite it to python so I can backtest it, but I can't figure out how pivotHigh and pivotlow function work, any idea?thanks
詳細