MQ4 code to get signal from two indicators on same window with different scale.

 

Hello,

I combined two indicators such as momentum and moving average of oscillator (OsMA) on same window. I add level 100 on momentum parameter and level 0 on OsMA parameter. Now I would like to use these two parameters to determine the signal by coding on MQ4. Anyone can help? The point here I can spot on chart visually but I do not know how to apply in MQ4

For example I want to spot when the level 100 of momentum is above Level 0 of OsMA.


Appreciate if anyone can help me


Thanks

Moving Average of Oscillator - Oscillators - Technical Indicators - Price Charts, Technical and Fundamental Analysis - MetaTrader 5 Help
  • www.metatrader5.com
Moving Average of Oscillator (OsMA) is the difference between the oscillator and oscillator smoothing. In this case, Moving Average...
 
  1. Dinh Tuan Tran #: For example I want to spot when the level 100 of momentum is above Level 0 of OsMA.

    Momentum is a price difference (±0.01234). OsMA is an oscillator (0 … 100).

    If the window scale is 0 … 100, your momentum is a straight line at the bottom, useless.

    If the window scale is ±0.01234, your oscillator is mostly off screen, useless.


  2. Dinh Tuan Tran #: but I do not know how to apply in MQ4

    Read them in, check for a cross. What's the problem?

    double aPrev = …(i+1), aCurr = …(i),
           bPrev = …(i+1), bCurr = …(i);
    bool   wasUp = aPrev > bPrev,
            isUp = aCurr > bCurr,
         isCross = isUp != wasUp;