RafaelZioni

zigzag%

1496 lượt xem
206
1496 10
This is zigzag % , no repaint and no lag as it based on % changes
the main issue is the addition of take profit and stop loss together with trailing (thanks to Yatrader to his code)
set the zigzag% according to best fit of your graph for best results
Gỡ bỏ khỏi Script Ưa thích Thêm vào Script Ưa thích
Hi Like this Strategy alot. However it will not trigger alerts. any thing i missed, should be strait forward to setup alerts.. Setting up alerts but nothing happens..

Cheers
Phản hồi
A newbie question - How can this be transformed into a strategy?
+1 Phản hồi
nilux cryptophilia
@cryptophilia, yeah I have tried to change study to strategy and set isStrategy = true, isStudy = false but without success. The BT isn't giving me any data. @RafaelZioni
any suggestion?
Phản hồi
@nilux, down is the code for it
Phản hồi
RafaelZioni RafaelZioni
@RafaelZioni, also the close in the end of the strategy when you covert it need to take to account the take profit ,trailing and stop loss, this section need to work out in order to see the true of this strategy . there is enormous different in results when you fix this issue. I need to work on it to find some solution to it .
Phản hồi
RafaelZioni cryptophilia
// BEGIN UNCOMMENT FOR BACKTESTING
strategy(title="strategy", shorttitle="strategy", overlay=true,
pyramiding=0, default_qty_value=100, commission_value=0.1, commission_type=strategy.commission.percent, initial_capital=1000)
strategyEntry(name, direction, myCondition) =>
if direction==1 and name=="Long"
strategy.entry("Long", 1, when= myCondition)
if direction==0 and name=="Short"
strategy.entry("Short", 0, when= myCondition)
strategyClose(name, myCondition) =>
if name=="Long"
strategy.close("Long", when= myCondition)
if name=="Short"
strategy.close("Short", when= myCondition)
isStrategy = true, isStudy = false
// END UNCOMMENT FOR BACKTESTING
+1 Phản hồi
nilux RafaelZioni
@RafaelZioni, thank you for your quick response :) Something is wrong and I tried to fix it but without success.

This snippet gives me an error:

mismatched input 'if' expecting 'end of line without line continuation'
on line:
if direction==1 and name=="Long"

I tried to fix it but no success. Does it work for you? Do you get this error as well?

Phản hồi
@nilux, it work but results does not look so good , i think i need to change few things and later i post strategy that better fit the data.
+1 Phản hồi
nilux RafaelZioni
@RafaelZioni, You are right, the snippet is working but Tradingview removed the formatting/indent and thats why it wasn't working.
I posted the snippet here again with the correct line formatting/indenting: https://pastebin.com/vqT8VKk1
+1 Phản hồi
Fantastic work! Impressed that you trying to combine Strategy and Study :)
+1 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ế Cách thức hoạt động Tính năng Biểu đồ Giá Quy tắc Áp dụng Người điều hành Giải pháp cho Website & Nhà môi giới Widget Giải pháp biểu đồ Nhận trợ giúp Yêu cầu tính năng Blog & Tin tức Câu hỏi thường gặp Wiki Twitter
Hồ sơ Tùy chỉnh Hồ sơ Tài khoản và Thanh toán Nhận trợ giúp Các ý tưởng đã đăng Người theo dõi Đang theo dõi Tin nhắn riêng Trò chuyện Đăng xuất