OPEN-SOURCE SCRIPT

Trend is your friend

已更新
This indicator evaluates the trend based on crosses of two McGinley moving averages. It paints candles accordingly (it does not repaint), so you can see what the indicator is saying more clearly and stay in your trade until you see a period of consolidation or a reversal. You can control how far away those moving averages need to be for you to consider it a trend. If this distance is not met candles color is not changed and it shows you that the market is in a period of consolidation. I also added visualization of RSI, so you can have an easier time finding appropriate profit targets. For stop loss I would recommend placing it a couple points above or below the previous high / low that is located above / below you final target for entry. You can also use a certain percentage that works for you. I tried adding a stop loss based on ATR, but I did not like the results. Using market structure is a better choice in my opinion.

Here is a basic trading strategy for the default settings:

Wait for the indicator to start printing a series of green or red candles. After that you can enter a long or a short around moving averages. Another valid place to entry is the specific RSI zone. If we are in an uptrend buying when RSI is oversold can be beneficial as you expect market to recover. I do not recommend changing RSI from 14. Vice versa for the downtrend. It gives you an edge as you know at what price RSI will be oversold and allows you to place trades in advance. Pretty neat! You need to realize that no indicator or strategy can give you an exact entry. There will always be some margin of error. What I wanted to say is that if there is a strong trend up and you buy around your key moving averages and when RSI is oversold you entered in good places and there is a pretty good chance you will make money.

Time frame settings:

If you want to use tighter stop losses I would recommend sticking to 15m. Do not go lower. It is not worth the stress. 1h and 4h seems to be very good as well, but expect your stop losses to be wider. What I personally tend to do is display 15m, 30m and 1h and compare it. Think of it as a short, mid and long term. That way you can see things little bit better.

Examples:

1H chart BTC

快照

4h chart EUR / USD

快照

1D chart NASDAQ

快照

15m chart BTC (Daytrading)

快照

That last chart shows that even if you were longing while the trend was about to change you still had a good chance to close it with a little profit and switch to short easily. The default settings is what has worked the best for me. Feel free to change them as you see fit and do not forget to let me know if you find something that works better :)

Notes:

Either disable wick display or change it to a neutral color like gray for both green and red candles. Unfortunately pine script does not allow wick painting, so if you have red / green wicks it will look terrible. If RSI visualization makes your candles look too small you can go to settings and disable the display of individual RSI levels. You will still be able to see the zones, but the scale won't be affected.
版本注释
- Added 5 different moving average types
- Added Bollinger Bands
- Added Exhaustion Bars
- Improved the code

With the default settings you should be buying psychological levels (nice round numbers) below the middle band of Bollinger Bands while the price is above MAs. Place 2 or 3 trades in advance at most as the market may blast through your limit orders. Opposite for short trades. Do not forget a stop loss!

You can also recolor candles according to the trend direction or heikin ashi candles.

Default time frame is 30m. Default moving averages are 50, 100 from 1h --> 100, 200 on 30m.

Bollinger Bands use 7 simple moving average as that shows you current "relatively" cheap and expensive price levels.
版本注释
Bug Fix
bitmexBTCMcGinley DynamicMoving AveragesRelative Strength Index (RSI)trendTrend Analysisvisualization

开源脚本

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

想在图表上使用此脚本?

免责声明