Real Turtle

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.
Mã nguồn mở

Với tinh thần của TradingView, tác giả đã xuất bản tập lệnh theo mã nguồn mở, vì thế trader có thể dễ dàng hiểu và tùy chỉnh được. Bạn có thể sử dụng miễn phí, hoặc tùy chỉnh lại mã đã được cấp phép bởi Quy tắc Chung. Bạn có thể sử dụng nó trên biểu đồ.

Bạn muốn sử dụng tập lệnh này trên biểu đồ?

Bình luận

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 :).
+5 Phản hồi
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.
+2 Phản hồi
How to make viable for crypto charts? Always error.
+1 Phản hồi
Thank you sir, does this re-paint?
+1 Phản hồi
DashTrader montyjus
@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.
Phản hồi
DTCash DashTrader
@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
Phản hồi
@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.
Phản hồi
Any suggestion for further improvment?
Phản hồi
There's error, how to fix it?
Phản hồi
300 trades and <20% drawdown is nice. Upvoted for your modest disclaimer.
Phản hồi
Trang chủ Bộ lọc cổ phiếu Bộ lọc Forex Bộ lọc Tiền điện tử Lịch kinh tế Giới thiệu Tính năng Biểu đồ Trả phí Giới thiệu bạn Quy tắc Áp dụng Trung tâm Trợ giúp Giải pháp cho Website & Nhà môi giới Widget Giải pháp biểu đồ Thư viện Biểu đồ Lightweight Blog & Tin tức Twitter
Hồ sơ Tùy chỉnh Hồ sơ Tài khoản và Thanh toán Giới thiệu bạn Xu Ticket Hỗ trợ của tôi Trung tâm Trợ giúp Tin nhắn riêng Trò chuyện Đăng xuất