TradingView
REV0LUTI0N
18 ינו׳ 2022 20:07

CCI Strategy 

Futu Holdings LimitedNASDAQ

תיאור

This CCI strategy will allow you to enter a long or short off a CCI zero line cross or control entries and exits from custom upper and lower band lengths. You can set a custom upper band which it will buy when it crosses up and then a custom upper band exit which it will sell when it crosses down. For a short you can set a custom lower band which it will short when it crosses down and the custom lower band exit which it will exit the short when it crosses up. Be sure to enter slippage and commission into the properties to give you realistic results.

I've also built in backtesting date ranges and the ability to trade only within certain times of day and have it close all trades at the end of that time frame. This is especially useful for day trading stocks. If you check off "Enter First Trade ASAP" then when using the time frame option it will enter the current trade. If however you uncheck that box and instead check off "Wait To Enter First Trade" it will wait for the trend to change and then enter.

You can also specify a % based take profit and stop loss. Also keep in mind that if you have "Enter First Trade ASAP" checked off and use the stop loss and/or take profit then it will re-enter the current trend again.

Finally there's custom alert fields so you can send custom alert messages for strategy entry and exit for use with automated trading services. Simply enter your messages in the fields within the strategy properties and then put {{strategy.order.alert_message}} in your alert message body and it will dynamically pull in the appropriate message.
תגובות
victorcpwong
Excellent script. I prefer the entries and exits from the +100/-100 upper and lower band strategy.
easetup
How can I change the entry with just long crossing #100 and TP/SL working after the buy trigger?
ilkersuer
Thanks mate for the strategy, keep up the good work!
Just two recommendations:
1) If there are successive Long / Short entry points, your code close the first position without any need & with loss. This can be fixed.
2) Adding Leverage function will be very much appreciated.
REV0LUTI0N
@ilkersuer, Thanks! For point #1 are you referring to the fact that it will swap the order when a new entry point is generated? If so I do understand this can be avoided with certain code that checks if it's already in a position but my script was designed to swap. I may look at making it an option with a check box to toggle between swap and no swap. As for point #2 I will need to look into that at a later time as I've never added leverage function to any of my scripts. Thanks for the suggestions though, I appreciate the feedback!
עוד