MauricioZuniga

MZ HTF HFT ROCit Bot - Non Repainting Scalper v1.2 ADX RSI MOM

MauricioZuniga 已更新   
This is a new iteration based on my Momentum trading bot.
This is an original script meant to be a high frequency trader that works on higher time frame calculations.
I came up with the idea that using calculus I can figure out the actual rate of change and momentum with different calculations than the momentum indicator that is provided by trading view. Once momentum is shifted on a small time frame, it will provide an entry signal. The script is meant to be used on an algorithmic trading system for scalping purposes. It should be run on a one minute time frame. Unfortunately due to various plotting constraints in Pinescript, you cannot plot the rate of change and momentum and price in the same pane. To counter this, I have a showdata toggle to give you values of the indicators at each entry.

This version has two main entry settings toggled with a checkbox. There is the ROC (rate of change) version and the MOM (momentum) entry signals.
The rate of change version is meant to take a look at your moving average and try to trigger when it hits a certain rate of change point. This can be helpful if you rather play it safer. I have noticed that you can get slightly better entry points but also does not give you as many entries. The momentum algorithm will give you faster entry points and might work best with a slight offset (use your back test to help you figure it out).

I have started to add tooltips to help you along. If you have suggestions please let me know.
How does it work?
Let's just assume that you are looking at a one minute chart. I recommend using the one minute for bots because it will give you the fastest execution for entries. Pinescript has an issue where the signal is not usually sent until the end of the bar/beginning of next bar. If the signal was triggered at the beginning of a 15 minute bar, it might not actually send the signal until the following 15 minute bar. If you are trading on small time frames, this can make all the difference. If you are using an algo platform that trailing stops, stop losse, take profits, etc. I would recommend you use that platform to close your trade. The close trade message will work, but pinescript does not know the exact entry price you received, so if you are trying to collect small profits, it is best that intermediary platform does that calculation for you. If you are dealing with larger moves, instead of small 1-3% scalps, you are probably fine to use the close message setting from pinescript.

Ok, so to take an example. I like to use the 3L and 3S tokens on Kucoin. This gives you a lot of volatility to work with compared to other tokens and coins. However, it can also meas that you are likely taking a higher risk. However, there are some things that can help with that (more on that later).

So we have a token we want to run, and have it on the 1m chart.
  • First, be sure that all of your filters are OFF when you start playing with the back test. This allows you to see how to best optimize the bot.
  • Use the show data to show you additional data when you are backtesting. This can allow you to try to filter out results or market conditions that do not work. I typically work with the RSI and use the 30 minute and 15 minute RSIs. I make sure that it is trading within a certain band - about 40-75. You can try the inverse and only buy during really low RSI's as well.
  • https://www.dropbox.com/s/t35ijo6xtay3bkr/Y0h0tpKkO4.png?dl=0
    Find the source of your data with the variant drop down. You can use any time frame, open, close. high, low, olc4. Open is pretty much guaranteed to not have any repainting issues - although all the other calcs use a custom isbarconfirmed security repaint calculation. I have been finding that Open and SMA work well, but feel free to explore. If you use a source like open, close, high, low, etc - the interval will not change anything further. If you use a variant such as an sma, you should try to find an interval that works well for that token. For instance, try an sma of 8-11 minutes and see which gives you the best backtest result without changing anything else. Offset ALMA/LSMA parameters are only used for those specific variants. These specific parameters will also affect the ALMA and LSMA if you use that variant in the trend filter. In other words, you can skip these if you are not using those types of moving averages.
  • https://www.dropbox.com/s/ix3k66p62jon415/gLVTrud8zl.png?dl=0
    Configure the ROC and MOM intervals. If you are using a source such as open, close, etc- this is where you set the interval for your change. So consider using OHLC4 or a interval of 5 thru 15 and see what works best. The Momentum inverval usually works best in the 2-5 bars. There is a custom calculation I added in to try to filter out false entries as momentum is waning. This calculation works best in 2-5 bar interval.
  • Configure the trigger point and offset. If you are using rate of change, the best settings will likely be between -1 to 0.5. If you are using momentum, you will likely want -20 to 10. This is where you will notice the entries will shift a bit. Try to find a balance between your backtest settings and actually finding what you thin will be the best entries based on a slight delay from trading view, to algo, to your trading platform. This can likely be a minute (maybe even) or so- so be sure to not get too caught up between the backtest results and be sure to finesse the entries to actually fit nicely - maybe a bar earlier than you would likely think. If your entries are coming in too early, you can use the offset to delay your entry by a few bars. This is both science and an art form- don't get too caught up on the back test results as that is based on having all the data tha already transpired, it's not based on how it will actually perform during deployment.
  • Take profit and stop loss. This should be self explanatory. This script can toggle between static take profit and a trailing profit. For scalping, you will likely want to limit it below 2% to get a good win ratio. Stop loss should be at least 5-6% for these types of 3L/3S tokens to give the strategy some room to move (if the token goes down 2% before it shoots back up, the price will go down 6%). This does not yield the best R/R ratio from a traditional trader perspective, but the statistical probabilities are in your favor for these events will happen. If you have better ideas for how to set this all up, feel free to contribute your ideas in the comments as we can all learn from each other. You can definitely set a much tighter stop loss with a larger take profit to get a lower win rate but in turn might get much better returns. It's all up to you.
  • FILTERS https://www.dropbox.com/s/gixwmg3l85ea9x8/SuIK36m80q.png?dl=0
    These filters require you to know a bit about each indicator and how you want to use them. I will only go over the general idea.
  • Variant Filter - this is especially useful if you want to trade above a moving average. Say for instance you only want to take trades when we are over the 100 Day moving average. Or above a 30 minute, 30 bar EMA, etc. Although originally ported over from my other scripts, this is not a filter that I use often in conjunction with this script.
  • RSI - perhaps you want to buy when we are below the 30 line on the 30 minute RSI, or we want only want to have the strategy work when we are above the 50 RSI, this can all be configured here. I typically like to try a few different rationales here.
  • Now with brand NEW ADX filter - this is a brand new idea that seems to work rather well. Based on your ADX settings you can also turn on the "only uptrend" which will try to calculate if you are in an uptrend based on your ADX config. Please keep in mind that uptrend is based relatively on the ADX settings.
    - There is a sprinkle of RSI magic in the entry signal to make sure that rsi is not declining in the calculation, so this can affect how many entries you get.
  • Some other tips:
    Forward test.
    Set up your algo bot on a one minute interval.
    Set up take profit and stop loss on your algo trading platform.
    Don't use the exact settings as your backtest, maybe try a slightly more conservative approach from the algo trading platform to make sure you are within range of triggering your events with a slight delay from signal to execution. If you have a 1.6% take profit, perhaps try 1.5% on your platform first.
  • By using these scripts you agree that you are trading at your own risk. I make no guarantees of returns or results. I just provide tools to help you trade better. However, I hope this ROCit will take you to the moon. And if it does, be sure to give me a shout as well as some tips of your own.

Send me a message with any questions or suggestions.
版本注释:
I have updated the options slightly for clarity as well as made some slight bug fixes. I have been trying it out on the 1s, 5s, and 10s charts. There have been some refinements to entry signal qualifications.
版本注释:
This is version 1.7 which includes a series of refinements
  • Default comission (0.08%) so you can tell more accurately if your strategy can be profitabe.
  • Further work on smoothing of DI direction (diEMA)
  • Addition of Percentage for pyramid percentage step (if you choose to use pyramiding. You can set the next percentage drop before you decide to add more to your position. I am still working on
  • Addition of Data that is added for debugging as well as for refining your strategy. For instance, now you can see what your currentbar , previous bar , and penultimate bar values are for the different Indicator calculations. This helps you undersrtand how the strategy is behaving and to confirm values are as expected for entries.
  • Pyramid percentage step (if you choose to use pyramiding > 1) - otherwise it is not used in strategy. You can set the next percentage drop before you decide to add more to your position. This can help you DCA in to a profitable trade. I am still working on refining how the strategy behaves in terms of the quantity that is added per step.
  • Take profit and stop loss now take into account pyramiding and average position price.
  • Fixed a series of small bugs that I noticed.
  • A second ADX filter has been added throughout the script. This can be useful if you want to filter out on your current time frame but also on a higher time frame. For instance, only trade when the 30 minute time frame ADX is above 20, also only trade when 1 minute is in an upward trend, etc.
  • Various other small improvements...
版本注释:
I am reverting my published version from 1.7 to 1.4 as the 1.4 version has been proving to be more effective and keeps forward testing better. I will revisit the 1.7 version and publish that one separately once I can figure out how to optimize the pyramiding algorithm. I will likely start that process over from this version and make comparison checks as I go forward. This version still has all the same filters, just not the pyramiding logic I was trying to override. I think this one deserves to be published as "complete" version as it was the best of this series.

仅限邀请脚本

仅限作者授权的用户访问此脚本,并且通常需要付费。您可以将其添加到收藏中,但是只有在向作者请求并获得许可之后,才能使用它。 请与MauricioZuniga联系以获取更多信息,或按照以下作者的说明进行操作。

在您100%信任脚本作者并了解脚本的工作原理之前,TradingView不建议您购买脚本并使用它。在很多情况下,您可以在我们的公共指标库中免费找到一个不错的开源替代品。

免责声明

这些信息和出版物并不意味着也不构成TradingView提供或认可的金融、投资、交易或其它类型的建议或背书。请在使用条款阅读更多信息。

作者的说明

此脚本的作者无法再授予对其的访问权限。请不要请求访问权限。

想在图表上使用此脚本?

警告:请阅读,然后再请求访问权限。