TradingView
Decam9
14 May 2021 02:58

Moving Average Crossover with Shading Signals  

Ethereum / DollarBitfinex

Açıklama

This script uses 3 moving averages (2 simple moving averages and 1 exponential moving average ) to signal long and short opportunities based on moving average crossovers.



A long SMA (Signal SMA2) is used to determine longer term trend. When the EMA crosses above the Slow SMA1 and price is above the Signal SMA2. The space between the moving averages will shade green and the Signal SMA should also be green.

A sell signal occurs when the EMA crosses below the Slow SMA1 and price is below the Signal SMA2. The space between the moving averages will turn red and the Signal SMA should also be red.

A retracement, consolidation, or reversal may be occurring if the shaded color is yellow.

Use the identifying shapes to learn when to open or close positions.

Sürüm Notları

Revising to fit the TradingView House Rules.

Sürüm Notları

In this version, I have added the option for what I call Dynamic Moving Averages (not sure if they are already a thing). When "Dynamic Moving Average" is turned on, the source for the moving average will be changed to high or low based on the current trend. The idea is that in an uptrend, closing below the moving average that is tracking average lows will signal a possible reversal to the downside. Vice Versa, in a downtrend, closing above a moving average that tracks the highs will also show a reversal to the upside.




How to Use:
EMA Strength - This will show how strong a trending market is. A strong market will use this MA as support.
SMA1 Pullback - This will be support in the event that the asset closes below the ema.
SMA2 Trend - This determines whether the asset is in an uptrend or downtrend.

1. Only take buy positions when the shading is green and sell positions when the shading is red. Be careful taking positions after trend reversals as this is when most false signals are produced.
2. Consider closing the position if the moving averages crossover OR if you have dynamic moving averages turned on and we close on the other side of the Dynamic Moving Average. (No signal will be printed for the dynamic)

FYI
- Using the dynamic moving averages will produce more signals during consolidation periods and choppy reversals. I recommend using them with the default settings on the 4h or higher.
- I recommend using either the shading signal OR the emoji signal to keep your charts clean.

Sürüm Notları

Upgraded to Version 5 of pinescript
Made icons smaller so they don't crowd the screen when zoomed out
Corrected issue where simultaneous exit and entry signals would not plot
Corrected issue where close icon would print with wrong color
Yorumlar
tcroudace
Thanks for a great piece of scripting - allows each user to try their own favorite MA lengths. Visually it looks like it will work. Have you managed to back test the strategy.
Decam9
@tcroudace, I just built a crossover strategy for back-testing (unpublished). So far, im finding that it works really well for long trades and its a waste of time for shorting. Ive seen up to 70% profitability when you use buy when the fast crosses above the trend and close when the fast crossed below the slow. More specifically, go long when the 5 crosses the 50 and close it when the 5 crosses below the 20.
tcroudace
@Decam9, Congratulations - I like the simplicity of the strategy and it intuitively makes sense. I use your indicators on all my charts now - so thanks. Do you plan to publish the back- testing script.
Decam9
@tcroudace, Im glad its working out for you! Im working on a few more lines for the back test. Im also working on some additions for this current script. Ill let you know when its complete. Thanks for the support here.
SvennyD
Great strat! Thanks for sharing! One question though - what's the diff between the red "X" and green "X" signals? As far as I can interpret, a green "label up" = open position, a red "label down" = trim position, a red "X" = close position. Am I understanding this correctly? If so, what's with the green "X"?
Decam9
@SvennyD, Thanks! And Yes, thats basically it. The color of the X corresponds to the direction of the trade. Green colors refer to long positions and red colors refer to short positions. So a green X would mean to close the long position.
SvennyD
@Decam9, much appreciated, friend!
Decam9
@SvennyD, You're welcome. Let me know if you have any feedback as well. Looking to make this a little better.
SvennyD
@Decam9, One last Q - do you have a suggested timeframe in which you feel this may work best with?
Decam9
@SvennyD, Great Q. I dont have that answer just yet, but when I was designing this I had medium ranges in mind (30min 1hr 4hr Daily) for the default settings. The moving average lengths can be altered to fit the time frame though. Im currently using 5 ema, 20 sma and 50 sma for swing trading and its working well so far.
Daha Fazla