![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
Please tell me why there are pluses in return(StrToTime(ye+"."+mo+".01").
ProfitIFStopInCurrency() function
I needed a function for my info panel the other day that would return the estimated profit/loss in the currency of the deposit when a group of positions triggered their stops. Well, it's not the first time I've written such a function. I have tested it long and hard in different brokerage companies and on different instruments with different ways of profit calculation. If you do not know, there are three of them: Forex, CFD and Futures. But I cannot find the difference between Forex and Futures, but I still have included the possibility of different calculation into the code. The maximum loss that can be returned by the function is artificially limited by the current account balance. Traditionally, you can pass parameters to the function and thus filter out positions you need for the analysis:
HH. Attachment here is the script for testing the ProfitIFStopInCurrency() function.
ProfitIFTakeInCurrency() function
This function is similar to the previous one, only it returns the estimated profit/loss in the currency of the deposit when a group of positions triggered their take. The profit calculation method is also taken into account: Forex, CFD and Futures .The maximum profit that the function can return is artificially limited by the number 999,999,999. Parameters:
HH. I have attached a script to test the ProfitIFTakeInCurrency() function.
Hi! Don't you have some kind of template (for beginners) to make it easier to write an EA for the tester and for real trading. Something's not moving((((
Template? :)) So take any of my EAs as a starting point...
Thanks.... interesting and useful things in general.... but for now i'm planning to create a trading advisor that would open and close positions based on the simplest signals (crossing averages for example) for starters, but all these checks, determining the lot etc. .... what, when and how... a bit complicated....
Igor, I apologise for my frequent questions, and I really hope this is not too difficult for you..... Could you please tell me what is meant by
gbDisabled
in the OpenPosition() function for online
here is a part of the code:
When compiling it gives an error that the variable is not defined.