//+------------------------------------------------------------------+ //| Web: Q(VolumeNorm).mq4 | //| MNS777 | //| mns777.ru@mail.ru | //+------------------------------------------------------------------+ #property copyright "MNS777" #property link "Web:" //---- îòðèñîâêà èíäèêàòîðà â îòäåëüíîì îêíå #property indicator_separate_window //---- êîëè÷åñòâî èíäèêàòîðíûõ áóôôåðîâ #property indicator_buffers 4 //---- öâåòà èíäèêàòîðà #property indicator_color1 Black #property indicator_color2 Lime #property indicator_color3 Red #property indicator_color4 Blue //---- òîëùèíà èíäèêàòîðíûõ ëèíèé #property indicator_width1 1 #property indicator_width2 2 #property indicator_width3 2 #property indicator_width4 2 //---- ÂÕÎÄÍÛÅ ÏÀÐÀÌÅÒÐÛ ÈÍÄÈÊÀÒÎÐÀ þþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþþææ+ extern int PeriodMA = 24; extern int ShiftMA = 0; extern int ModeMA = 0; extern double K = 1000; extern int MaxBars = 1000 ; // áàðîâ èñòîðèè extern string autor="Mns777.ru@mail.ru"; //---- æææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææææ+ //---- èíäèêàòîðíûå áóôôåðû double ExtBuffer0[]; double ExtBuffer1[]; double ExtBuffer2[]; double SignalBuffer[]; //+------------------------------------------------------------------+ //| indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- ñòèëè èçîáðàæåíèÿ èíäèêàòîðà SetIndexStyle(0,DRAW_NONE); SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexStyle(2,DRAW_HISTOGRAM); SetIndexStyle(3,DRAW_LINE); //---- òî÷íîñòü IndicatorDigits(Digits+1); SetIndexDrawBegin(0,Digits); SetIndexDrawBegin(1,Digits); SetIndexDrawBegin(2,Digits); SetIndexDrawBegin(3,Digits); //---- 3 èíäèêàòîðíûõ áóôôåðà èñïîëüçîâàíû äëÿ ñ÷¸òà. SetIndexBuffer(0,ExtBuffer0); SetIndexBuffer(1,ExtBuffer1); SetIndexBuffer(2,ExtBuffer2); SetIndexBuffer(3,SignalBuffer); //---- èìåíà äëÿ îêîí äàííûõ è ëýéáû äëÿ ñóáúîêîí. IndicatorShortName("Q(VolumeNorm)"); SetIndexLabel(1,NULL); SetIndexLabel(2,NULL); SetIndexLabel(3,"MA"); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); double prev,current; //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=MaxBars; //---- macd for(int i=0; i<limit; i++) ExtBuffer0[i]= ((Close[i] - Open[i])*K)/ Volume[i]; //---- signal line counted in the 2-nd buffer for(i=0; i<limit; i++) SignalBuffer[i]=iMAOnArray(ExtBuffer0,Bars,PeriodMA,ShiftMA,ModeMA,i); //---- dispatch values between 2 buffers bool up=true; for(i=limit-1; i>=0; i--) { current=ExtBuffer0[i]; if(current>0) up=true; if(current<0) up=false; if(!up) { ExtBuffer2[i]=current; ExtBuffer1[i]=0.0; } else { ExtBuffer1[i]=current; ExtBuffer2[i]=0.0; } } //---- done return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Series array that contains close prices for each bar
Series array that contains open prices of each bar
Series array that contains tick volumes of each bar
Indicator Curves created:
Implements a curve of type DRAW_NONE
Implements a curve of type DRAW_HISTOGRAM
Implements a curve of type DRAW_LINE
Indicators Used:
Moving average indicator
Custom Indicators Used:
Order Management characteristics:
Other Features: