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
Color = (color)((Color & 0xFFFFFF) + (Alpha << 24));
_W(Color)[3] = Alpha;
Forum on trading, automated trading systems and testing trading strategies
Any newbie questions on MQL4, help and discussion on algorithms and codes
fxsaber, 2017.03.07 13:55
template <typename T>
void Swap( T &Value1, T &Value2 )
{
const T Tmp = Value1;
Value1 = Value2;
Value2 = Tmp;
}
// Sort an array of any simple type
template <typename T>
bool MyArraySort( T &Array[] )
{
if (!ArraySort(Array))
{
const int Size = ArraySize(Array);
for (int i = 0; i < Size - 1; i++)
{
const T Tmp = Array[i];
for (int j = i + 1; j < Size; j++)
if (_R(Tmp) == Array[j]) // TypeToBytes.mqh
{
Swap(Array[i + 1], Array[j]);
i++;
}
}
}
return(true);
}
Forum on trading, automated trading systems and testing trading strategies
Libraries: File Mapping without DLL
fxsaber, 2017.04.03 16:07
Thanks to the author for the library!
I made functions for transferring any data. Below script shows their work on the example of ticks
Result
An example of possible practical application of innovations.
Highlighted - the same result in vastly different ways
An example of how this feature can be useful for detecting potential errors.
Write and run the script.
Result.
_WRONG_ASSIGN_OPERATOR(STRUCT) = trueThis indicates that the assignment operator will not copy a structure into a structure of the same type.
If we add more to the structure,
the result will be the same.
It would seem that by fixing this operator to
should make everything correct, but the library says otherwise.
Perhaps, this is the most subtle point of this example.
We fix it to
and we get the result
_WRONG_ASSIGN_OPERATOR(STRUCT) = falseNow the copy operator is written correctly!
You can check the correctness of assignment/copy operators of any simple structures in a similar way.
Result
A NULL string has zero length in bytes. An empty string is 1 byte long (where zero is the end of the string).