//+------------------------------------------------------------------+ //Jasmine_Divergence..... part of Jasmine Marble Tunnel Trading System //Based on MACD.... for Jasmine Marble.... //+------------------------------------------------------------------+ #property copyright "Copyright © 2004, MetaQuotes Software Corp." #property link "http://www.metaquotes.net/" //---- indicator settings #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Green #property indicator_color2 Red #property indicator_color3 Blue #property indicator_width1 5 #property indicator_width2 2 //---- indicator parameters extern int FastEMA=13; extern int SlowEMA=21; extern int SignalSMA=8; //---- indicator buffers double OsmaBuffer[]; double MacdBuffer[]; double SignalBuffer[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- 2 additional buffers are used for counting. IndicatorBuffers(3); //---- drawing settings SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexStyle(1,DRAW_LINE); SetIndexStyle(2,DRAW_LINE); SetIndexDrawBegin(0,SignalSMA); SetIndexDrawBegin(1,SignalSMA); IndicatorDigits(Digits+1); IndicatorDigits(Digits+1); //---- 3 indicator buffers mapping SetIndexBuffer(0,OsmaBuffer); SetIndexBuffer(1,MacdBuffer); SetIndexBuffer(2,SignalBuffer); //---- name for DataWindow and indicator subwindow label IndicatorShortName("Jasmine_Divergence ("+FastEMA+","+SlowEMA+","+SignalSMA+")"); SetIndexLabel(1," Jasmine_Divergence "); SetIndexLabel(2,"Signal"); //---- 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