TradingView
cyberfunk
2018년 2월 3일 오후 5시 3분

[Prod] SuperTrend with Stoploss+TrendZones - 1H 

Bitcoin Cash / United States DollarCoinbase

설명

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 tradingview.com/script/xsofIOja-Best-SuperTrend-BTCUSD/ with lots of modifications.
코멘트
cyberfunk
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: imgur.com/a/KxBSI
Karthi056
Thanks for your efforts. 👍 👍
cyberfunk
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..
NikhilGuptab4
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.
NikhilGuptab4
Do NOT use `security` function. Period. No repaints.
NikhilGuptab4
@NikhilGuptab4, if you need to access higher timeframes - create the calculations yourself.
cyberfunk
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 ?
cyberfunk
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.
더보기