MoonFlag

(Stoch/RSI/RVSI/MACD/TimeframeConfluence)

MoonFlag Updated   
This version is much needed improvement to the (Stoch-RSI 4h/1h/15min) as the previous version had a repainting/lookforwards error. So this version does not have a lookforwards option on higher timeframe security calls, which means that its strategy tester is much more related to real-time use. This strategy also works on anytimeframe. I have obtained credible results for various securities on the 1min/5min/15min timeframes.

The default values are for FTX:DOGEPERP on the 5min. The timeframe is very important. These preset values will probably change over the next few weeks however, the chart shown as part of this strategy can show how useful this strategy is if tuned to present market conditions.

The top of the setting box has a place to copy/paste in the strategy comments for buy/sell/long/shorts so its' directly possibly to link the positions to bots through TradingViews web-hooks alert facility.

The next options permit longs and/or shorts to be selected. This example with DOGE uses boths longs and shorts however, most other pairs will only give a reasonable result with Longs and sometimes (less frequently) shorts. There are only a few coins in which both longs and shorts can be selected. Mostly only longs give a credible result. I start by trying to get the best result for both longs and shorts and then deselect the option which reduces the overall result. Then optimize other variables for that trade.

Then its an option to use 'MACD/RVSI" which refers to a previous script of mine called MACD/RVSI confluence. This is useful to determine if buy or sell conditions are suited to current price action. Note the background is colored green for buy conditions and red for sell conditions according to the MACD/RVSI confluence. Its useful to have this selected. And then select a timeframe for this option. Generally, the timeframe here is at least a few times longer than the present timeframe. In this example the MACD/RVSI timeframe is 15mins whereas the DOGE security timeframe is 5mins. (Special mention/thanks to 'fract' for RVSI)

After this its the 'RSI clause' option. This generally only permits longs after the RSI has been below and crossed above 31%. Similarly, shorts are only permitted after the RSI has crossed below 69%. This clause generally has a timeframe comparable to the security timeframe, as this greatly restricts the number of trades. Sometimes the MACD/RVSI is on a fast timeframe and the RSI on a long timeframe for best results so switch between timeframes and selected options. Generally on longer timeframes such a 1hour, the RSI clause restricts the number of trades to much however, its very useful on the faster timeframes (1min/5min) where there are lots of trades.

Then select the slow Stoch timeframe - again this should be approximately 4times the present security timeframe. Although try a range of timeframes here until a result starts to form. One really has to get a feel for changing the variables as there are typically several settings which can give a good strategy backtest for a single security. Although on some securities its not possible to get any credible backtest results.

One can then select the Stoch parameters however, if you change one setting by one unit and the backtest result swings greatly - with a low number of trades - this signifies a low reliability that the strategy will play out as backtest results indicate. Generally I don't have to change the stoch parameters much, its mostly the timeframes that provide a credible result.

There is a buy/sell threshold for the stoch long/shorts. Generally click these up/down a few notches (5% per notch) to optimise results.

The ramp stop loss is possible the most useful feature of this script. There is a %increase per bar and also a start % (which is above or below the position depending on if its long or short). If the price action crosses the ramp stop loss the trade exits. So there is a time limit on trades unless the price moves up/down with the ramp. The ramp can be seen on the screen - without this feature most strategies fail to provide a credible result. With stoch's its good to have the ramp quite a bit below the trade start position and then ramp up steeply as stochs swing quite fast.

There is also a trailing stop and take profit - which do help optimise the strategy a few %.

Also, keep an eye on the comments.
Release Notes:
Bug fix in lookback to remove repainting
Release Notes:
To show background screen in accordance with tradingview script specs
Open-source script

In true TradingView spirit, the author of this script has published it open-source, so traders can understand and verify it. Cheers to the author! You may use it for free, but reuse of this code in a publication is governed by House Rules. You can favorite it to use it on a chart.

Disclaimer

The information and publications are not meant to be, and do not constitute, financial, investment, trading, or other types of advice or recommendations supplied or endorsed by TradingView. Read more in the Terms of Use.

Want to use this script on a chart?