- Comments (1)
If you are having insurmountable problems with the validation of an EA, then you definitely need this function.
I authorize its use in commercial EA. I give the source code to those who pay for unlimited use. You will be able to insert the function into your code, which will allow you to avoid importing library files (it prohibited by the Market conditions).
The function performs all the order checks required by the Market (minimum and maximum deal-volume, volume step, sufficient free margin, maximum allowable number of orders, etc.)
In addition: - if there is not enough funds to execute the requested volume, then the function will calculate the deal-volume possible by the amount of the account free margin.
In this case, the function calculates the trade volume as 90% of the maximum possible (checked, it's better). The trade volume is calculated with an accuracy of 1%.
This is especially important. Instead of cancellation deal when there is a shortage of 1 cent, you will receive a reduced trade volume.
But the deal will take place, the lock-deal will be opened and your account will not go into the red zone of negative margin.
#import "CheckOrder.ex4" double CheckOrder(int type=0, double lt=0); #import
Please see the screenshots, they are clear without comment.