
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Don't forget to normalize prices and compare normalized prices always.
A lot of times i seen problems comparing not normalized prices even if they "looks the same", actually there were not.
In addition to this, you also need to check Stop Levels of the symbol on which the position belong and also compare the new SL/TP with bid/ask price (depending on the position type if buy or sell).
Not doing a correct error handling for this thing means to risk to have EA sending a lot of bad requests to broker that will put your account into hyperactive and then disable autotrading on that. Pay attention.
I did that for 4 prices
TPbuy changes ---> modify TPBuy
TPSell Changes ---> modify TPSell
SLBuy Changes ---> modify SLBuy
SLSell Changes ---> modify SLSell
Don't forget to normalize prices and compare normalized prices always.
A lot of times i seen problems comparing not normalized prices even if they "looks the same", actually there were not.
I think you're right, comparing between non-normalized with real price will give different values but will be the same after modification.
In addition to this, you also need to check Stop Levels of the symbol on which the position belong and also compare the new SL/TP with bid/ask price (depending on the position type if buy or sell).
yes, I put Ask & Bid as bandwidth for TP's and SL's.
Not doing a correct error handling for this thing means to risk to have EA sending a lot of bad requests to broker that will put your account into hyperactive and then disable autotrading on that. Pay attention.
I already run this EA and a testing duration on a demo account with five symbols
any way, I will try your devices about normalizing my values and I appreciate that.
Thank you
Don't forget to normalize prices and compare normalized prices always.
A lot of times i seen problems comparing not normalized prices even if they "looks the same", actually there were not.
In addition to this, you also need to check Stop Levels of the symbol on which the position belong and also compare the new SL/TP with bid/ask price (depending on the position type if buy or sell).
Not doing a correct error handling for this thing means to risk to have EA sending a lot of bad requests to broker that will put your account into hyperactive and then disable autotrading on that. Pay attention.
I tried this code:
I put the same method for TPSell, SLBuy and SLSell (sometimes I change TP only or SL only)
and:
while SLBuy, SLSell, TPBuy, SLSell, Ask and Bid are normalized double after calculation values
Wihle:
and the same with ModifySell
but the result is:
2022.01.25 04:30:32.395 Core 1 2021.01.05 00:00:00 failed modify #6 sell 0.01 EURUSD sl: 1.23615, tp: 1.22465 -> sl: 1.23485, tp: 1.22468 [Market closed]
2022.01.25 04:30:32.395 Core 1 2021.01.05 00:00:00 CTrade::OrderSend: modify position #6 EURUSD (sl: 1.23485, tp: 1.22468) [market closed]
2022.01.25 04:30:32.395 Core 1 2021.01.05 00:00:20 failed modify #6 sell 0.01 EURUSD sl: 1.23615, tp: 1.22465 -> sl: 1.23485, tp: 1.22468 [Market closed]
2022.01.25 04:30:32.395 Core 1 2021.01.05 00:00:20 CTrade::OrderSend: modify position #6 EURUSD (sl: 1.23485, tp: 1.22468) [market closed]
2022.01.25 04:30:32.395 Core 1 2021.01.05 00:00:40 failed modify #6 sell 0.01 EURUSD sl: 1.23615, tp: 1.22465 -> sl: 1.23435, tp: 1.22468 [Invalid stops]
2022.01.25 04:30:32.395 Core 1 2021.01.05 00:00:40 CTrade::OrderSend: modify position #6 EURUSD (sl: 1.23435, tp: 1.22468) [invalid stops]
2022.01.25 04:30:32.395 Core 1 2021.01.05 00:00:59 failed modify #6 sell 0.01 EURUSD sl: 1.23615, tp: 1.22465 -> sl: 1.23451, tp: 1.22468 [Invalid stops]
EDIT:
Ohh, I am sorry, I mistakenly read the tp value wrong...
Therefore, I cannot help you with the issue. I will pass on this....
EDIT:
Ohh, I am sorry, I mistakenly read the tp value wrong...
Therefore, I cannot help you with the issue. I will pass on this....
Thank you.