//+------------------------------------------------------------------+ //| Awesome_MTF_NL.mq4 | //| -Multitimeframe Normalized / Line | //| Copyright © 2005, MetaQuotes Software Corp. | //| http://www.mql5.com/ru/code/7813 | //| Some features add by AST, 2014 | //+------------------------------------------------------------------+ #property copyright "Copyright © 2005, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" //---- indicator settings #property indicator_separate_window #property indicator_buffers 6 #property indicator_level1 0.0 #property indicator_levelwidth 0 #property indicator_levelstyle STYLE_SOLID #property indicator_levelcolor SlateGray #property indicator_color1 Black #property indicator_color2 Green //colors for 1'st AO #property indicator_color3 Red #property indicator_color4 Black #property indicator_color5 DodgerBlue //colors for 2'st AO #property indicator_color6 DodgerBlue #property indicator_width1 0 #property indicator_width2 2 #property indicator_width3 2 #property indicator_width4 0 #property indicator_width5 2 #property indicator_width6 2 extern string _______Parameter1_______ = "_______Awesome Oscillator 1_____"; extern int AO1_TF=0; // Timeframe extern int ma1_fast=5; //standart AO SMA fast Period=5 extern int ma1_slow=34; //standart AO SMA slow Period=34 extern bool AO1_line=true; extern string _______Parameter2_______ = "_______Awesome Oscillator 2_____"; extern int AO2_TF=0; // Timeframe extern int ma2_fast=21; //custom AO SMA fast Period extern int ma2_slow=55; //custom AO SMA slow Period extern bool AO2_line=true; //---- indicator buffers double ExtBuffer0[]; double ExtBuffer1[]; double ExtBuffer2[]; double ExtBuffer3[]; double ExtBuffer4[]; double ExtBuffer5[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { IndicatorBuffers(6); IndicatorDigits(2); //---- drawing settings if (AO1_line) { SetIndexStyle(0,DRAW_NONE); SetIndexStyle(1,DRAW_LINE); SetIndexStyle(2,DRAW_LINE); } else { SetIndexStyle(0,DRAW_NONE); SetIndexStyle(1,DRAW_HISTOGRAM); SetIndexStyle(2,DRAW_HISTOGRAM); } if (AO2_line) { SetIndexStyle(3,DRAW_NONE); SetIndexStyle(4,DRAW_LINE); SetIndexStyle(5,DRAW_LINE); } else { SetIndexStyle(3,DRAW_NONE); SetIndexStyle(4,DRAW_HISTOGRAM); SetIndexStyle(5,DRAW_HISTOGRAM); } SetIndexDrawBegin(0,ma1_slow); SetIndexDrawBegin(1,ma1_slow); SetIndexDrawBegin(2,ma1_slow); SetIndexDrawBegin(3,ma2_slow); SetIndexDrawBegin(4,ma2_slow); SetIndexDrawBegin(5,ma2_slow); //---- 6 indicator buffers mapping SetIndexBuffer(0,ExtBuffer0); SetIndexBuffer(1,ExtBuffer1); SetIndexBuffer(2,ExtBuffer2); SetIndexBuffer(3,ExtBuffer3); SetIndexBuffer(4,ExtBuffer4); SetIndexBuffer(5,ExtBuffer5); //---- name for DataWindow and indicator subwindow label IndicatorShortName("AO ("+ma1_fast+","+ma1_slow+") TF_"+StrPer(AO1_TF)+"+ AO ("+ma2_fast+","+ma2_slow+") TF_"+StrPer(AO2_TF)); SetIndexLabel(1,NULL); SetIndexLabel(2,NULL); SetIndexLabel(4,NULL); SetIndexLabel(5,NULL); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Awesome Oscillator | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); double AO1_prev,AO1_current,AO2_prev,AO2_current; //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; if(counted_bars==0) limit-=1+1; //---- macd for(int i=0; i=0; i--) { AO1_current=ExtBuffer0[i]; AO1_prev=ExtBuffer0[i+1]; AO2_current=ExtBuffer3[i]; AO2_prev=ExtBuffer3[i+1]; if(AO1_current>AO1_prev) AO1_up=true; if(AO1_currentAO2_prev) AO2_up=true; if(AO2_current