Combine MA and Stochastic to one indicator

Jajaofopobo

Trader
Sep 6, 2021
63
7
24
After reading @Enivid post on MA and stochastic strategy. I tried combining the MA and Stochastic indicator into one indicator but I'm having problem with the buffers. I'm not really a coder. When i merged them together and tried to run it, nothing showed on the mt4 (no syntax error).

It seems I'm doing something wrong under the void oncalaculate and initialization. I simply added the Buffer MA codes from the MA indie to it. Is it possible to have both MA and Stochastic on one indicator?? Or anyone with an indicator or something close that can send alert when price is above MA and stochastic is also at the lower limit
 

Jajaofopobo

Trader
Sep 6, 2021
63
7
24
I figured it out already. To those interested, the code
MQL4:
   double MAPrice = 0; double CurrOpenPrice=MarketInfo(Symbol(),MODE_ASK); double Mius;
   double BAROpen = iOpen(NULL,PERIOD_CURRENT,1);bool PriceAboveMa;
 
   if (MAPrice != BAROpen ){
   MAPrice = (iMA(NULL,0,MAPeriod,MAShift,MAMethod,MAAppliedPrice,0));
   MAPrice = newChartCheck;}
   Mius = CurrOpenPrice - MAPrice;
   if (Mius < 0){
   PriceAboveMa= true; ;}
   else  PriceAboveMa= false;
 
Last edited by a moderator: