MauricioZuniga

Customizable Non-Repainting HTF MACD MFI Scalper Bot Strategy

This script was originally shared by Wunderbit as a free open source script for the community to work with.

WHAT THIS SCRIPT DOES:
It is intended for use on an algorithmic bot trading platform but can be used for scalping and manual trading.
This strategy is based on the trend-following momentum indicator . It includes the Money Flow index as an additional point for entry.

HOW IT DOES IT:
It uses a combination of MACD and MFI indicators to create entry signals. Parameters for each indicator have been surfaced for user configurability.
Take profits are fixed, but stop loss uses ATR configuration to minimize losses and close profitably.

HOW IS MY VERSION ORIGINAL:
I started trying to deploy this script myself in my algorithmic trading but ran into some issues which I have tried to address in this version.
  • Delayed Signals : The script has been refactored to use a time frame drop down. The higher time frame can be run on a faster chart (recommended on one minute chart for fastest signal confirmation and relay to algotrading platform.)
  • Repainting Issues : All indicators have been recoded to use the security function that checks to see if the current calculation is in realtime, if it is, then it uses the previous bar for calculation. If you are still experiencing repainting issues based on intended (or non intended use), please provide a report with screenshot and explanation so I can try to address.
  • Filtering : I have added to additional filters an ABOVE EMA Filter and a BELOW RSI Filter (both can be turned on and off)
  • Customizable Long and Close Messages : This allows someone to use the script for algorithmic trading without having to alter code. It also means you can use one indicator for all of your different alterts required for your bots.

HOW TO USE IT:
It is intended to be used in the 5-30 minute time frames, but you might be able to get a good configuration for higher time frames. I welcome feedback from other users on what they have found.

Find a pair with high volatility (example KUCOIN:ETH3LUSDT ) - I have found it works particularly well with 3L and 3S tokens for crypto. although it the limitation is that confrigurations I have found to work typically have low R/R ratio, but very high win rate and profit factor.

Ideally set one minute chart for bots, but you can use other charts for manual trading. The signal will be delayed by one bar but I have found configurations that still test well.
Select a time frame in configuration for your indicator calculations.

Select the strategy config for time frame. I like to use 5 and 15 minutes for scalping scenarios, but I am interested in hearing back from other community memebers.

Optimize your indicator without filters (trendFilter and RSI Filter)

Use the TrendFilter and RSI Filter to further refine your signals for entry. You will get less entries but you can increase your win ratio.

I will add screenshots and possibly a video provided that it passes community standards.

Limitations: this works rather well for short term, and does some good forward testing but back testing large data sets is a problem when switching from very small time frame to large time frame. For instance, finding a configuration that works on a one minute chart but then changing to a 1 hour chart means you lose some of your intra bar calclulations. There are some new features in pine script which might be able to address, this, but I have not had a chance to work on that issue.
版本注释: Updated code comments
版本注释: Added a comment filed for closing trailing stop so that strategy can be automated on both opens and closes. Previously the strategy was dependent on having subsystem closing order based on parameters set there. This can yield much better returns on backtest.
版本注释: Add option to add or remove Take Profit 1 as the trailing stop can perform better without it.

Reformatted the config interface for easier input and changed the default parameters to ones that are working for certain pairs to see if they work on others.

I found that using an RSI filter for below 60 period @ 38 through 40 length worked well on 5 minute chart to filter out some losing trades and increase profitability.

Wunder Trading (crypto trading automation): https://bit.ly/3mCtULB
Kucoin : https://bit.ly/3xIgPXn
Coinbase (FIAT): https://bit.ly/3MJJXSv
Discord: https://bit.ly/3OeH25r
开源脚本

本着真正的TradingView精神,该脚本的作者将其开源发布,以便交易者可以理解和验证它。为作者喝彩!您可以免费使用它,但在出版物中重复使用此代码受网站规则的约束。 您可以收藏它以在图表上使用。

免责声明

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

想在图表上使用此脚本?