Cross

Back to topics list To post a new topic, please log in or register
avatar
2
chalky_123 2016.02.12 05:01
 
This function can apparently work thus, Cross(Ma1,Ma2);  How do I test the result of this test. I cannot find any documentation for this. I am trying to find the point at which the faster moving average crosses the slower moving average, and vice versa.
avatar
Moderator
3418
GumRai 2016.02.12 06:44 #
 
As far as I am aware there is no such function included with mq4
avatar
13000
WHRoeder 2016.02.12 16:21 #
 
chalky_123: Cross(Ma1,Ma2);  I cannot find any documentation for this.
  1. There is no such MT4 function List of MQL4 Functions - MQL4 Documentation
  2. Code it your self
    bool Cross(int MaF, int MaS){
       double f2 = iMA(... MaF ... 2);
       double f1 = iMA(... MaF ... 1);
       double s2 = iMA(... MaS ... 2);
       double s1 = iMA(... MaS ... 1);
       bool wasAbove = f2 > s2;
       bool  isAbove = f1 > s1;
       bool isCross = isAbove != wasAbove;
       return isCross;
    }




Back to topics list  

To add comments, please log in or register