Navigation´╝ÜHome > Content >

TMAcentered.mq4

Time: 2018-06-07 | Download file:TMAcentered.mq4

//+------------------------------------------------------------------+
//|                                        TriangularMA centered.mq4 |
//|                                                           mladen |
//+------------------------------------------------------------------+
#property copyright "mladen"
#property link      "mladenfx@gmail.com"

#property indicator_chart_window
#property indicator_buffers 1
#property indicator_color1 Gold

//
//
//
//
//

extern int    HalfLength    =11;
//extern string MAPrice_info  = "0=ClOSE 1=OPEN 2=HIGH 3=LOW 4=MEDIAN 5=TYPICAL 6=WEIGHTED:";
//extern int    Price         = 1;

//
//
//
//
//

double buffer1[];
double weights[];
double sumWeights=0;
int    fullLength;

//+------------------------------------------------------------------+
//|                                                                  |
//+------------------------------------------------------------------+
//
//
//
//

int init()
{
   HalfLength=MathMax(HalfLength,1);
      fullLength = HalfLength*2+1;
      ArrayResize(weights,fullLength);
      
      //
      //
      //
      //
      //
            
      sumWeights          = HalfLength+1;
      weights[HalfLength] = HalfLength+1;
      for (int i=0; i0) counted_bars--;
           limit=Bars-counted_bars;

   //
   //
   //
   //
   //
   
   for (i=limit;i>=0;i--)
   {
      for(sum=0.0, j=0; j=0;i--)
   {
      sum  = (HalfLength+1)*iMA(NULL,0,1,0,MODE_SMA,PRICE_OPEN,i);
      sumw = (HalfLength+1);

      //
      //
      //
      //
      //
      
      for(j=1,k=HalfLength; j        

Recommend