[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 254

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
Folks, previously in the editor when you hover over a reserved word and press f1 a window would open at the bottom with a description of the function, now I don't have this. What could be the problem ?
Who can tell me how to make the result always positive ? (Buy lots - Sell lots)= -0.25, but it must be always positive ?
I do so: if (profitbuy+profitsell > SymbProf_magBUY_magSELL* MathAbs((OrdersTotalMagicBuyLots(MagicBuy)-OrdersTotalMagicSellLots(MagicSell))/Lots)())
what's in brackets?
if (profitbuy+profitsell > SymbProf_magBUY_magSELL* MathAbs((OrdersTotalMagicBuyLots(MagicBuy)-OrdersTotalMagicSellLots(MagicSell))/Lots)(??????))
Where ???? what?
I open a position with a volume = 0.05. Need a code - how to reduce position volume by 0.01 when a loss reaches 100 pips for 5 digits ???
Thank you.
How many EAs I've written, all of them check market conditions (stop levelling, spread, etc.) when trading with pending orders. I've looked at how gridders are written, but I haven't seen any of them check the value of the same stop levelling before sending any order. What is the reason?
There are plenty of metarials on the forum about the tester and why its results differ from real life. Look in the Articles section, this topic has been touched on more than once.
Thank you.
Found an alternative.
It means that in DLL the string is passed exactly as char*, but not as MqlStr. But itdoesn't mean that in ex4 program the string is not stored as MqlString. In general, the transfer of parameters from ex4 to dll (according to the developers) is a rather complex process, accompanied by all kinds of checks and transformations of parameters.
Have you read the MQL4 Reference? MQL4-string is the same as c-string with null-terminator.
The structure is designed only for arranging arrays of strings. Purely an invention of the Metacvots to facilitate the creation of string arrays.
StrStrA from the shlwapi.dll library. Test:
Log:
The mechanism is as follows. Shlwapi.dll in /system32. StrStrA is a WinAPI analog ofStringSubstr. MQL4 is a typeless language, so if we set an int at the output, rather than a string, we get a pointer to it, not a string. StrStrA searches for the first occurrence of a substring in the string (case-sensitive, but since our strings are the same, we don't care), and since our strings are the same, it returns a pointer to the first character of the string, i.e. the string itself.
Let me explain for those who will be using this code. There is no string format in the WinAPI. Instead, there is only the lpsz format (a pointer to the first element of an array of characters ending with 0x00, aka /0). It is a pointer to a memory address. Since our memory cells are 32-bit (i.e. 4 bytes) and int is also 4 bytes in size, everything fits there neatly.
Conclusion: you can easily pack strings into int arrays, thereby emulating structures (and there are no structures and classes in MQL4) to pass them further to the dll, if a structure or class is needed. Self-written dll for data type translation (i.e. constructions like "int(const char*)" (C-type translation) or similar in C++) can not be used now.