Getting the moving average value

 

Sorry for asking such a silly question but I can't get the moving average number correctly with my code 

 

//+------------------------------------------------------------------+

//|                                                           me.mq4 |

//|                        Copyright 2015, MetaQuotes Software Corp. |

//|                                             https://www.mql5.com |

//+------------------------------------------------------------------+

#property copyright "Copyright 2015, MetaQuotes Software Corp."

#property link      "https://www.mql5.com"

#property version   "1.00"

#property strict



//+------------------------------------------------------------------+

//| Expert initialization function                                   |

//+------------------------------------------------------------------+

int OnInit()

  {

//---

   

//---

   return(INIT_SUCCEEDED);

  }

//+------------------------------------------------------------------+

//| Expert deinitialization function                                 |

//+------------------------------------------------------------------+

void OnDeinit(const int reason)

  {

//---

   

  }

//+------------------------------------------------------------------+

//| Expert tick function                                             |

//+------------------------------------------------------------------+


int NewChart = 0;


void OnTick()

  {

  

        int newChartCheck = iOpen("AUDCAD",PERIOD_M15,1);

        // Alert(newChartCheck);  

         if (NewChart != newChartCheck)

         {

      

            Alert(iMA("AUDCAD",0,14,0,MODE_SMA,PRICE_CLOSE,0));    

            NewChart = newChartCheck;

    //      Alert(iMA(NULL,0,14,0,MODE_SMA,PRICE_CLOSE,0));

         }

   

  }

//+------------------------------------------------------------------+

  

 I have checked the default metatrader moving average number and it doesn't seem ima function is equal to moving average. I need it for the current time we're in + I checked the properties of the iMA and its all equal to the default moving average properties

 
kshahnazari:

Sorry for asking such a silly question but I can't get the moving average number correctly with my code  

I have checked the default metatrader moving average number and it doesn't seem ima function is equal to moving average.

  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.
  2. iMA("AUDCAD", ...        // Symbol unless your dealer has adornments. Just use NULL.
       // Broker's use a variety of nameing patterns: EURUSD, EURUSDm, EURUSDi
       // "EURUSD.", "EURUSD..", "EUR.USD", "EUR/USD", "EURUSD.stp", EURUSDct,
       // "EURUSD.G", "EURUSD+", EURUSDpro at least.
    
  3. "Doesn't seem" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  4. Print close values from bars [zero .. 13], and the ima(..., 0)
 
WHRoeder:

  1. Play video
    Please edit your post.
    For large amounts of code, attach it.
  2. "Doesn't seem" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
  3. Print close values from bars [zero .. 13], and the ima(..., 0)
Thanks for telling me those stuff, first time in this forum needed to know those + The problem was solved by putting NULL at the first as you said , think the reason the code wasn't properly was that the pattern wasn't right and the ima couldn't get the values correctly , thanks alot/
Reason: