- Tüm siparişler
- Kurallar
ATR Trailing Stop EA and some
- Açıklama
Spesifikasyon
What i need is a very simple extension of already existing code. This shall be seperated into 2 projects:
1. Chandelier Exit EA
Take the existing code which can found online for a Chandelier Exit indicator. Paste it into an EA and give me the option to set the following external: Magic number, ATR peroid, K[number of multiples]. Please take into account that in short cases the EA needs to account for the spread and add it. The most important is that the EA can set the stop automatically by getting the ticket number from the open trades with a for loop or whatever. The Magic number which is an external should reflect the fact that only trades with that Magic are edited.
If you understand Python, the Formula for the Chandelier Exit :
def CHANDELIER[
cls,
ohlc: DataFrame,
short_period: int = 22,
long_period: int = 22,
k: int = 3,
] -> DataFrame:
"""
Chandelier Exit sets a trailing stop-loss based on the Average True Range [ATR].
The indicator is designed to keep traders in a trend and prevent an early exit as long as the trend extends.
Typically, the Chandelier Exit will be above prices during a downtrend and below prices during an uptrend.
"""
l = pd.Series[
ohlc["high"].rolling[window=long_period].max[] - cls.ATR[ohlc, 22] * k,
name="Long.",
]
s = pd.Series[
ohlc["low"].rolling[window=short_period].min[] + cls.ATR[ohlc, 22] * k,
name="Short.",
]
2. Multi peroid Chandelier Exit EA
The second part will be to build an other version of this EA which follows these rules:
In short add another Peroid which is also an extern and save it as another Version.
Under the Link:
//www.mql5.com/en/code/7108
you will find the code for part 2 called: 6. Trailing by ATR.
All rules from above also apply to this EA with the Extension.
In my opinon the only real thing you need to do is add a for loop which selctes for the Ticket number and then implement the code i referenced here. If thats not the case please explain me why in your application. And ofc i will need the sourcecode to later make some changes.