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
Is there a code snippet for rsi (not the built in rsi)?
Is there a code snippet for rsi (not the built in rsi)?
Here is an indicator that uses custom function (not the built in RSI) _rsi_function.mq4
It is as simple as it gets, and it can calculate RSI of period 1 (which built in RSI can not do)
Here is an indicator that uses custom function (not the built in RSI) _rsi_function.mq4 It is as simple as it gets, and it can calculate RSI of period 1 (which built in RSI can not do)
Thank you
Is there a code that prevents opening a new order of a same kind on a same bar (if stop loss or take profit was hit, for example)?
Is there a code that prevents opening a new order of a same kind on a same bar (if stop loss or take profit was hit, for example)?
Check the check_can_open function from this EA : https://www.mql5.com/en/forum/174385/page239
Check the check_can_open function from this EA : https://www.mql5.com/en/forum/174385/page239
Got it
Thanks
Metatrader does not know how to sort multidimensional arrays
Here is a simple shell sort procedure that is sorting 2 dimensional array in this case. It is easy to extend it to any dimension of the array :
//
//------------------------------------------------------------------
//
//
//
// shell sort
//
//
//
void SortIt(double& sortArr[][2])
{
int size = ArrayRange(sortArr,0);
int increment = size / 2;
//
//
//
//
//
while (increment > 0)
{
for (int i = increment; i < size; i++)
{
int j = i;
double temp = sortArr[0];
double temi = sortArr[1];
while ((j >= increment) && (sortArr[j-increment][0] < temp))
{
sortArr[j][0] = sortArr[j-increment][0];
sortArr[j][1] = sortArr[j-increment][1];
j = j-increment;
}
sortArr[j,0] = temp;
sortArr[j,1] = temi;
}
if (increment == 2) increment = 1;
else increment = (increment / 2.2);
}
}Metatrader does not know how to sort multidimensional arrays
Here is a simple shell sort procedure that is sorting 2 dimensional array in this case. It is easy to extend it to any dimension of the array :
//
//------------------------------------------------------------------
//
//
//
// shell sort
//
//
//
void SortIt(double& sortArr[][2])
{
int size = ArrayRange(sortArr,0);
int increment = size / 2;
//
//
//
//
//
while (increment > 0)
{
for (int i = increment; i < size; i++)
{
int j = i;
double temp = sortArr[0];
double temi = sortArr[1];
while ((j >= increment) && (sortArr[j-increment][0] < temp))
{
sortArr[j][0] = sortArr[j-increment][0];
sortArr[j][1] = sortArr[j-increment][1];
j = j-increment;
}
sortArr[j,0] = temp;
sortArr[j,1] = temi;
}
if (increment == 2) increment = 1;
else increment = (increment / 2.2);
}
}mladen
Thanks for this. One more question : how can I find out the size of the second dimension?
mladen Thanks for this. One more question : how can I find out the size of the second dimension?
Use ArrayRange(sortArr,1) for the second dimension
Use ArrayRange(sortArr,1) for the second dimension
Got it. Thanks