Lavoro terminato
![](https://c.mql5.com/i/avatar/avatar_na2.png)
![](https://c.mql5.com/i/avatar/avatar_na2.png)
Specifiche
Hello, i have an ea which scans all pairs in watchlists and alert with e-mail when selected conditions occurs. Now i need some modification for it and want to add trading option.
1)Finding 2 types of divergence at KDJ
https://www.mql5.com/en/code/9173
This indicator needs modification of at one line so it will calculate proper J like in the example i gave below from tradingview so you need to modify this line to make this indicator work properly.
By changing to:
percentJ[i] = 3 * percentK[i] - 2 * percentD[i];
making J faster then %K & %D, got better usage.
Here is what i need at kdj below. I need two types of divergence at this indicator.
1- It will check 2 times when purple is equal to green and orange. And it will compare if there is a divergence at its peak points of purple and price. Then it will alert at the 2nd time when purple is equal to green and orange. (I drawed arrow to show when to alert below)
2- It will check only 1 time when purple is equal to green and orange and it will compare the peak points of purple and will alert if there is any divergence between peak points of purple and price.(I drawed arrow to Show when to alert below at 2nd divergence example).
***Also it must find hidden divergence too.
From my experiences 1st rule is more stable but we can t deny the power of 2nd rule too so in our system if when can do 2nd rule with true/false from indicator settings or at scanner/trading part you can add it kdj 1st rule true/false and kdj2nd rule tru/false within this way, it will be better for me. I mean that you can add two different rules as kdj 1st rule and kdj 2nd rule wtih true/false below smd/rsi/cci/candlestick pattern.
2) Trading Option for our ea
a)our system needs to trade at current timeframe. I will set our system mostly 1h,4h,Daily with different settings.
b)I want filtering system for trading and scanning system as old developer did in pz harmonic before. For example in settings i will set that it will check 4 divergences from 9 signal types and if i filter smd&kdj so these 4 divergences has to include smd,kdj and 2 more random signals.
c) I need in trading system: lots, take profit level in pips and stop loss level in points option.
d) autolotper1000 true/false if this is true. I will write a lot size per 1000 dollars and it will calculate due to my Account balance so if my Account rises, it will calculate automatically new lot size. If it is false, it will use default lot size at c which i mention above.
e)Most important part for Money management in our trading system which i will use mostly. It needs Smartlot&Stoploss = true/false and how many candle to check = “n” , Risk per trade % = “m”
For example when signal comes from settings that i selected and If smartlot&stoploss is true, n=4 and m=20 : In buy trade, it will check last 4 candle of current time frame and it will automatically determine lowest point of last 4 candle and set stoploss to lowest point of these candles for buy trade then it will check %20 of my Account balance, stoploss and will calculate automatically my lot size. So if price hits lowest point of last 4 candle, i will lose %20 of my Account so i will fix drawdown to %20.
Here is a open source code example that i use in my manual trading so you can check its code to make for our system automatically.
https://www.mql5.com/en/code/13804.
f) 2nd most important part of our system that i will use for closing trades:
In this case we will use default boilinger band and gann hi lo activator.
Gann hi lo : https://www.mql5.com/en/code/8032
Here is what i need for this system in settings:
Smartclose = True/false (If it is false, it will use take proift level which i mentioned at c above.
Whichindicatortoclose =I need a selectable system for these options (bollinger lowest band,mid band, upper band and gann hi lo line)
Autosafeclose = true/false (If it is true, it will select most nearest point to price from whichindicatortoclose options and it will select this nearest point to price automatically for take profit. If autosafeclose is false, it will use selected criteria from whichindicatortoclose)
Usetrailingatsmartclose= true/false
Whentostarttrailing= “y” points (if use trailingatsmartclose is true and if my trade is in profit with “y” points it will start to use trailing stop loss option)
Trailingpoints= “x” points (if usetrailingatsmartclose=true and if trade is in profit with “y” points, it will use “x” point for trailing points till my trade reaches to takeprofit which is defined from whichindicatortoclose or which is defined from autosafeclose option.)
g) I will use the system for 1h,4h and Daily charts and sometimes for same pair it will alert 1h and 4h at the same time or different variations(for example 4h and Daily) so i don’t want any 2 trades at the same time. So if there is a open or closed trade during the day. It will not open 2nd trade and it will ignore the 2nd alert and has to notify me with email or notification “2 trades cant be at the sametime.” Because it will kill our ea’s Money management system so we have to eleminate the mess. So it will use only 1 signal per day.
Also between 12:00-14:00 due to bank close, volatility became less thats why i need same system for this period too.
If you can make these 2 time period editable from indicator settings, it will be better.