cyberfunk

[Prod] SuperTrend with Stoploss+TrendZones - 1H

Here, i'm using a SuperTrend (difference of moving averages) crossover strategy hybrid with stop-loss and trend-following to look at backtesting for the BCHUSD pair on the coinbase (GDAX) exchange.

Included in this script I've got some optimized parameters that seem to make a decent profit over ~35+ trades. The one thing that's bothering me here is that I get OCCASIONAL repaint issues with back-testing, but I can't figure out why for the life of me, because i'm using V3 in the start of the script. If someone could point out the mistake I may be making here , I feel like this could be a serious strategy to use against the BCHUSD pair on coinbase or other exchanges (with tuning of course).

I based this script off of with lots of modifications.
Remove from Favorite Scripts Add to Favorite Scripts
Without using the security function, it doesnt seem possible to calculate my strategy on the proper DEMA timescale.. which sort of undermines the whole point. PineScript 3 was supposed to have fixed this problem.. but it seems like it has not somehow..
Reply
Also, let me know once you have fixed this and you still see the profits you are seeing - I have improvements to share - if you would so like.
Reply
Do NOT use `security` function. Period. No repaints.
Reply
NikhilGuptab4 NikhilGuptab4
@NikhilGuptab4, if you need to access higher timeframes - create the calculations yourself.
Reply
Note: Here's a link that demonstrates that a repainting problem is occurring in the DEMA lines.. even though it shouldn't be. This is the problem i'm trying to solve: https://imgur.com/a/KxBSI
Reply
P.S. I've commented the code reasonably heavily. I believe that the problem may lie in the Securities/EMA function based on some careful watching i've done... as it's the only one that could have an issue like this.

I would also appreciate any comments from traders who might know how to optimize gains during uptrends, which this long-only strategy seems to have trouble with, even with detection of up/down trends. It's possible that a completely different strategy should be applied during uptrends vs downtrends and that the DEMA+stoploss strategy that works for general downtrends and sideways markets is poor for uptrends.

Ideas for improvement ?
Reply
If anyone knows how to troubleshoot potential backtesting / repainting issues with V3 of pine script here, I'd love a hand. I can't seem to figure it out.
Reply
Home Stock Screener Forex Screener Crypto Screener Economic Calendar How It Works Chart Features Pricing House Rules Moderators Website & Broker Solutions Widgets Charting Solutions Get Help Feature Request Blog & News FAQ Wiki Twitter
Profile Profile Settings Account and Billing TradingView Coins My Support Tickets Get Help Ideas Published Followers Following Private Messages Chat Sign Out