Customizable OCC Non Repainting Scalper Bot v7.0bThis strategy is intended to be used on an automated trading platform and should be run on a one minute chart for fastest confirmations and signal relay to crypto automation platform. The strategy has been modded to only go long at this time to focus on profitability for one direction. The open long and close long text fields allow you to use your own webhook message for this purpose.
I have spent quite a bit of time and I figured I would put it out to the community to share the work and also get some feedback.
Ok, so let me say that I have done absolutely everything I can to make the strategy not repaint while still maintaining it's profitability. It has been a challenge so I am publishing this to the community to help test this.
What I have observed: the strategy will not repaint in real time. That is, if you have the chart open and keep it open, the signals are the same as the ones that are sent out by the strategy. In certain cases, when I reload the chart- the signals might be off from what was sent. In some ways, that is repainting, but it is repainting based on losing the real time data and recalculating from a different set of bars- since I am running it on a one minute chart then the start becomes different when you refresh.
To address repainting while keeping the strategy calculating as quickly as possibly I have altered the logic in the following ways:
I have made an assumption which might not work for everyone- at the first tick of the next bar, you can almost safefly assume in crypto that if you are looking at the previous bar for information, the open of the current bar was the close of the previous bar. This for the most part holds true in crypto with good liquidity. If you are trading a pair that jumps around due to low volume- this might not be the strategy to use. I might publish a different version with a different logic.
I have altered the security repaint to use isbarconfirmed, so at the very end of the bar (as soon as the bar is confirmed), we recalculate to the higher time frames. So as soon as the data is available, it is at that point that we can then safely calculate higher time frames. This is unique and experimental, but seems to do well at creating good signals for entry.
I have employed my own intervals by utilizing the resolution as an integer (used by the previous authors)- but in this case, I use the interval to take a snapshot of the higher time frame. With open close cross, the different moving averages can cause the repainting as they change to show the exact point of the cross. The interval feature I created minimizes this by utilizing the previous bar info until the interval is closed and then we recalculate the variants. You can use the interval offset feature to denote which minute is the one that starts and ends the interval. So for instance, Trading View uses minue 1 and minute 31 for 30 minute intervals. If you offset your 30 minute interval would start on minute 16 and do its calculations based on the last 30 minutes,
As with most of my scripts, I have started using filters and a "show data" feature that will give you the ability to see the values of indicators that you cannot plot in the overlay. This allows you to figure out how to filter losing trades or market conditions.
I have also added a trailing stop and created a fixed stop loss as seems to perform better than the original occ strategy. The original one seemed to repaint enough that it would close too quickly and not give the posiition enough time to become profitable. In certain cases where there was a large move, it would perform well, but for the most part the trades would not close profitably even though the backtest said that it did - probably due to the delay in execution and pinescript not having a confirmation on what the actual position price was.
This is still in beta mode, so please forward test first and use at your own risk.
If you spot repaint issues, please send me a message and try to explain the situation.
Wundertrading
Customizable Non-Repainting HTF MACD MFI Scalper Bot Strategy v2Customizable Non-Repainting HTF MACD MFI Scalper Bot Strategy v2
This script was originally shared by Wunderbit as a free open source script for the community to work with. This is my second published iteration of this idea.
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.
This is a new and improved version geared for lower timeframes (15-5 minutes), but can be run on larger ones as well. I am testing it live as my high frequency trader.
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 now trailing profits, and the stop loss is now fixed. Why? I found that the trailing stop loss with ATR in the previous version yields very good results for back tests but becomes very difficult to deploy live due to transaction fees. As you can see the average trade is a higher profit percentage than the previous version.
HOW IS MY VERSION ORIGINAL:
Now instead of using ATR stop loss, we have a fixed stop loss - counter intuitively to what some may believe this performs better in live trading scenarios since it gives the strategy room to move. I noticed that the ATR trailing stop was stopping out too fast and was eating away balance due to transaction fees.
The take profit on the other hand is now a trailing profit with a customizable deviation. This ensures that you can have a minimum profit you want to take in order to exit.
I have depracated the old ATR trailing stop as it became too confusing to have those as different options. I kept the old version for others that want to experiment with it. The source code still requires some cleanup, but its fully functional.
I added in a way to show RSI values and ATR values with a checkbox so that you can use the new an improved ATR Filter (and grab the right RSI values for the RSI filter). This will help to filter out times of very low volatility where we are unlikely to find a profitable trade. Use the "Show Data" checkbox to see what the values are on the indicator pane, then use those values to gauge what you want to filter out.
Both versions
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 (resolution). 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 : customize your settings for MACD and MFI that are profitable with your chart and selected time frame calculation. Try different Take Profits (try about 2-5%) and stop loss (try about 5-8%). See if your back test is profitable and continue to optimize.
Use the Trend, RSI, ATR Filter to further refine your signals for entry. You will get less entries but you can increase your win ratio.
You can use the open and close messages for a platform integration, but I choose to set mine up on the destination platform and let the platform close it. With certain platforms you cannot be sure what your entry point actually was compared to Trading View due to slippage and timing, so I let the platform decide when it is actually profitable.
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.