Navigation´╝ÜHome > Content >

BMI_TickData_4MA.mq4

Time: 2012-06-06 | Download file:BMI_TickData_4MA.mq4

#property copyright "Copyright Blue Mental Incorporated"

#property indicator_separate_window
#property indicator_buffers 7
#property indicator_color1 Purple
#property indicator_color2 MediumOrchid
#property indicator_color3 Violet
#property indicator_color4 White
#property indicator_color5 RoyalBlue
#property indicator_color6 Black
#property indicator_color7 Indigo
#property indicator_width1 8
#property indicator_width2 6
#property indicator_width3 4
#property indicator_width4 2
#property indicator_width5 1
#property indicator_width6 2
#property indicator_width7 1

int MA1 = 34;
int MA2 = 21;
int MA3 = 13;
int MA4 =  5;

double CurrentTick[];
double MA1Tick[];
double MA2Tick[];
double MA3Tick[];
double MA4Tick[];
double MinuteLine[];
double mArrow[];
int CurrentTime = 0;
int Once = 0;
int BarCount = 0;
int PreviousTime = 0;

int init() {
   SetIndexBuffer(0, MA1Tick);
   SetIndexBuffer(1, MA2Tick);
   SetIndexBuffer(2, MA3Tick);
   SetIndexBuffer(3, MA4Tick);
   SetIndexBuffer(4, CurrentTick);
   SetIndexBuffer(5, MinuteLine);
   SetIndexBuffer(6, mArrow);
   SetIndexStyle(0, DRAW_LINE);
   SetIndexStyle(1, DRAW_LINE);
   SetIndexStyle(2, DRAW_LINE);
   SetIndexStyle(3, DRAW_LINE);
   SetIndexStyle(4, DRAW_LINE);
   SetIndexStyle(5, DRAW_SECTION);
   SetIndexStyle(6, DRAW_ARROW);
   SetIndexArrow(6,108);
   CurrentTime = TimeCurrent();
   NewBar();
   return (0);
}

int deinit() {
   return (0);
}

int start() {
int x=0;
int cPos,pPos;
double cVal,pVal;
int xTag;


while(MinuteLine[x]==EMPTY_VALUE&&x<1000)
{
x++;
}
if(x<1000){cPos=x;cVal=MinuteLine[x];}
x++;

while(MinuteLine[x]==EMPTY_VALUE&&x<1000)
{
x++;
}
if(x<1000){pPos=x;pVal=MinuteLine[x];}

   double CurrentBid = Bid;
   if (NewBar() == 1) {
      MinuteLine[0]=CurrentBid;
      BarCount++;
      for (int Count = 1; Count < BarCount; Count++) {
         MA1Tick[Count - 1]  = MA1Tick[Count];
         MA2Tick[Count - 1] = MA2Tick[Count];
         MA3Tick[Count - 1] = MA3Tick[Count];
         MA4Tick[Count - 1] = MA4Tick[Count];
         CurrentTick[Count - 1] = CurrentTick[Count];
         MinuteLine[Count-1]=MinuteLine[Count];
      }
      MA1Tick[BarCount - 1] = EMPTY_VALUE;
      MA2Tick[BarCount - 1] = EMPTY_VALUE;
      MA3Tick[BarCount - 1] = EMPTY_VALUE;
      MA4Tick[BarCount - 1] = EMPTY_VALUE;
      CurrentTick[BarCount - 1] = EMPTY_VALUE;
      MinuteLine[BarCount-1]=EMPTY_VALUE;
      BarCount--;
   }
   if (CurrentBid == CurrentTick[0] ) return/*(WARN)*/;
   for (Count = BarCount; Count > 0; Count--) {
      MA1Tick[Count] = MA1Tick[Count - 1];
      MA2Tick[Count] = MA2Tick[Count - 1];
      MA3Tick[Count] = MA3Tick[Count - 1];
      MA4Tick[Count] = MA4Tick[Count - 1];
      CurrentTick[Count] = CurrentTick[Count - 1];
      MinuteLine[Count] = MinuteLine[Count-1];
   }
   CurrentTick[Count] = EMPTY_VALUE;
   if (Once == FALSE) {
      Once = TRUE;
//      MinuteLine[0] = CurrentBid;
      CurrentTick[0] = CurrentBid;
      BarCount++;
   }
   if (TimeMinute(TimeCurrent()) != TimeMinute(CurrentTime)) {
         MinuteLine[0] = CurrentBid;
         CurrentTick[0] = CurrentBid;
         BarCount++;
      CurrentTime = TimeCurrent();
   } else {
      if (CurrentTick[1] != EMPTY_VALUE) {
         MinuteLine[0] = EMPTY_VALUE;
         CurrentTick[0] = CurrentBid;
         BarCount++;
      }   }

   int SumTag;
   double Sum;

SumTag=0; Sum=0;
   for( Count=0;Count        

Recommend