//+------------------------------------------------------------------+ //| MultiMovingAverage.mq4 | //+------------------------------------------------------------------+ #property copyright "Ron T" #property link "http://www.lightpatch.com" #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Lime #property indicator_color2 Blue extern string sym1="EURUSD"; extern string sym2="USDCHF"; extern double const1=1.09;//1.08; //---- buffers double VolBuffer1[]; double VolBuffer2[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //|------------------------------------------------------------------| int init() { if(StringFind(Symbol(),"m",0)>0) { sym1=sym1+"m"; sym2=sym2+"m"; } IndicatorBuffers(2); SetIndexStyle(0,DRAW_LINE,0,2); SetIndexBuffer(0, VolBuffer1); SetIndexStyle(1,DRAW_LINE,0,1); SetIndexBuffer(1, VolBuffer2); return(0); } //+------------------------------------------------------------------+ //| Custor indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { /* int i; for( i=0; i<Bars; i++ ) VolBuffer1[i]=0; return(0); */ } /* int pos1 = iBarShift("GOLD", 0, iTime(NULL,0,x), true); if (iTime("GOLD", 0, pos1) == iTime(NULL,0,x)) // have to be sure the times match. { open8[x]=iVolume("GOLD",0,pos1)/const1();//1*0.25*l1; } else { open8[x]=0;//1*0.25*l1; } */ //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { double curTYP=0; double oldTYP=0; double change=0; double x1,x2; int pos=Bars;///4; // Print ("Start SHOW5TICKS with bars=",pos); while(pos>=0) { //VolBuffer1[pos]=iClose("DOWJONES",0,pos);//Close[pos]; int pos1 = iBarShift(sym1, 0, iTime(NULL,0,pos), true); if (iTime(sym1, 0, pos1) == iTime(NULL,0,pos)) // have to be sure the times match. { x1=(iClose(sym1,0,pos1)); VolBuffer1[pos]=x1;//1*0.25*l1; } else { //VolBuffer1[pos]=x1;//1*0.25*l1; } //VolBuffer1[pos]=iClose("GOLD",0,pos);//Close[pos]; int pos2 = iBarShift(sym2, 0, iTime(NULL,0,pos), true); if (iTime(sym2, 0, pos2) == iTime(NULL,0,pos)) // have to be sure the times match. { x2=iClose(sym2,0,pos2); VolBuffer2[pos]=x2*const1;//1*0.25*l1; } else { //VolBuffer2[pos]=x2;//1*0.25*l1; } pos--; } /* int i; for( i=0; i<Bars; i++ ) VolBuffer1[i]=1; */ return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains tick volumes of each bar
Series array that contains close prices for each bar
Indicator Curves created:
Implements a curve of type DRAW_LINE
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features: