Welcome to my 4th script.
Someone asked me some questions about the strategy I previously published. When I went back to my published script I couldn't help myself but simply try and make it better. Which I did.
Since I've published that script, I've gained much more knowledge about how Pinescript functions. As well as gaining more and more knowledge about how the markets are structered etc.
In this reversal script we use 4 indicators to determine good entry signals, we determine whether the market is ranging or trending and we still only want to take trades in the direction of the "trend".
are used for our entry signal. When price hits either side of the band, we wait for a reverse before we enter a position.
is used to determine if we're in a trending market or in a ranging market. You can adjust the values in the inputs. You can determine the minimum value and the maximum value.
is used the same way as , you can adjust the value in the inputs. You can determine the minimum value.
Last but not least we use two EMA's, a 200 and 100 . Both are adjustable through the inputs. I used two EMA's because I noticed when using this strategy that we'd enter a new position often after having a bad trade. Using two EMA's might clean up some signals, in my case with EUR/USD on a 15m timeframe, it didn't clean up enough signals.
All the default values are pretty decent but might require some finetuning on a certain instrument. Don't overfit the strategy though, that'll only give you bad signals in the future.
Then we are off to our exit signals.
Initially I wanted to incorporate my previous exit signals as well, but it was too much of a hassle to make the script work as intended so I left it out. If you want to use those exit signals, just find my other script.
When we're in a position and price crosses the opposite band, we wait for a reverse before we exit the position.
Additionally we want our losses to be as small as possible, so we use to signal us when the market is, or starts to, trend against us. This is where you use the minimum and maximum exit values. So when crosses over or under that value, it'll exit the position.
Furthermore, we use the ATR indicator to set our stop loss, which is pretty basic stuff. You can adjust the ATR multiplier in the inputs. Disabling "Use Trailing Stop?" is really inadvisable unless you know this script inside out as your only exit signals will be opposite Cross and overbought / oversold areas.
Made a mistake in my earlier script, the stop loss was being calculated AFTER my exit signals, this would cause our entry signals to get instantly stopped out. So I fixed that as well.
Cleaned up a lot of my code, especially the entry and exit signals. Made variables for all our seperate entry and exit conditions. This makes the code incredibly more easier to read.
I also added a trailing ATR stop loss.
Với tinh thần của TradingView, tác giả đã xuất bản tập lệnh theo mã nguồn mở, vì thế trader có thể dễ dàng hiểu và tùy chỉnh được. Bạn có thể sử dụng miễn phí, hoặc tùy chỉnh lại mã đã được cấp phép bởi Quy tắc Chung. Bạn có thể sử dụng nó trên biểu đồ.