TradingView
DashTrader
Jul 23, 2019 5:26 PM

Real Turtle 

Bitcoin / United States DollarCoinbase

描述

There are a few different attempts at the turtle strategy on here, but none that I have seen thus far correctly follow the strategy as I know it. This version uses a stop order to trail out of the position by moving the stop order to match the exit channel or stoploss as the N*2( ema of True Range * 2). This version of turtle strategy also uses stop orders for entry on either side in order to enter at optimal time. The ability to specify a backtest period was borrowed from another script, I grabbed it so long ago I no longer remember from whom i borrowed it, if it was yours I will credit you if you PM me.

This version unlike others also allows you to specify a risk % so you only risk that percentage of your equity in a trade, as calculated from your stoploss.

Disclaimer: I have published several scripts in the past when i was first learning pinescript and they are all horrible please ignore those. I would delete them, but TV doesn't allow you to delete.
评论
cc8730
I'm getting an error saying that "Pine cannot determine the referencing length of a series" and that max_bars_back should be used in the strategy function. I changed the script in a copy that I've made and added the max_bars_back parameter with the value of 1000 and now it works again. Of course this was a hack as I'm not familiar with Pine, so I'm sure you have a better solution :).
SaintDroston
Hi there, thank you for this. I used to trade commodities using trend following systems and developed my own trading system utilising Trading Blox. I am trading this turtle strategy on Crypto now because it still works on crypto due to the long trending cycles of crypto currencies. Do you have a version with the option of adding a MA filter? I.e. using a MA such as 50dma or 200dma to filter trades to go only long above and only short below the MA. in my trading blox days, this greatly improved the return and lowered the max DD. Thank you.
factura123
There's error, how to fix it?
ApacheRaine
How to make viable for crypto charts? Always error.
montyjus
Thank you sir, does this re-paint?
DashTrader
@montyjus, no repaint. You'd only see repaint if for instance security was used. The only other qwerk i have seen with TV api as far as strategy backtest goes is if your trail stop is really tight it will produce unbelievable results.
DTCash
@DashTrader, thanks for the work mate! I'm keen to give it a test later on. With regards to the stop loss bug you mentioned on TV, is there anywhere to get more info on this? I'm trying to get realistic strategy testing results and it seems I'm missing something, I've got the slippage, commission etc setup but my results still seem a bit off and my SL is tight, so think this may be a cause
DashTrader
@DTCash, I assume you are referring to a strategy you made and not this strategy. can google it, but basically the way TV does trail stops is it is NOT using a lower timeframe only the current timeframe to determine the trailstop. Because of this is has to guess what the trailstop did so it assumes on every candle that the candle moved with your trail stop first. Thus if your trail stop is really tight you'll have unrealistic results because every tiny move is a win for you even when in reality it wasn't.
bluceyi
how could I set the alram? thx.
EigenGray
Error :S
更多