//+------------------------------------------------------------------+ //| OsMA.mq4 | //| Copyright © 2004, MetaQuotes Software Corp. | //| http://www.metaquotes.net/ | //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" //---- indicator settings #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 Silver #property indicator_width1 2 //---- indicator parameters //---- indicator buffers double OsmaBuffer[]; double MacdBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- 2 additional buffers are used for counting. IndicatorBuffers(3); //---- drawing settings SetIndexStyle(0,DRAW_LINE); IndicatorDigits(Digits+2); //---- 3 indicator buffers mapping SetIndexBuffer(0,OsmaBuffer); SetIndexBuffer(1,MacdBuffer); //---- name for DataWindow and indicator subwindow label IndicatorShortName("fatl-satl balance"); //---- initialization done return(0); } //+------------------------------------------------------------------+ //| Moving Average of Oscillator | //+------------------------------------------------------------------+ int start() { int limit; int counted_bars=IndicatorCounted(); //---- last counted bar will be recounted if(counted_bars>0) counted_bars--; limit=Bars-counted_bars; //---- macd counted in the 1-st additional buffer for(int i=0; i