//+------------------------------------------------------------------+ //| GG-Promise.mq4 | //| Copyright © 2010, JJ Newark | //| http:/jjnewark.atw.hu | //+------------------------------------------------------------------+ #property copyright "Copyright © 2010, JJ Newark" #property link "http:/jjnewark.atw.hu" //---- indicator settings #property indicator_separate_window #property indicator_buffers 2 #property indicator_color1 Maroon #property indicator_color2 Chocolate #property indicator_width1 1 #property indicator_width2 1 #property indicator_level1 0.0 #property indicator_levelcolor Silver //---- indicator parameters extern string __Copyright__ = "http://jjnewark.atw.hu"; //int shift[]={0,3,5,8,13,21,34,55,89}; //int shift[]={0,2,3,5,8,13,21,34,55}; int shift[]={0,1,2,3,5,8,13,21,34}; extern int Ma_Period = 12; extern string Help_for_Signal_Tolerance = "Min: 1 (the smaller the faster)"; extern int Signal_Tolerance = 2; extern int Ma_Price = PRICE_TYPICAL; extern int DiffAvg_Period = 12; extern color DiffColor = Maroon; extern string Help_for_DiffType = "0: Value; 1: Percent"; extern int DiffType = 0; /* PRICE_CLOSE 0 Close price. PRICE_OPEN 1 Open price. PRICE_HIGH 2 High price. PRICE_LOW 3 Low price. PRICE_MEDIAN 4 Median price, (high+low)/2. PRICE_TYPICAL 5 Typical price, (high+low+close)/3. PRICE_WEIGHTED 6 Weighted close price, (high+low+close+close)/4. MODE_SMA 0 Simple moving average, MODE_EMA 1 Exponential moving average, MODE_SMMA 2 Smoothed moving average, MODE_LWMA 3 Linear weighted moving average. */ //---- indicator buffers double MainVal[]; double SignalVal[]; double DiffValue[]; double val_0,val_1,val_2,val_3,val_4,val_5,val_6,val_7,val_8; double DiffAvg; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- drawing settings IndicatorBuffers(3); SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,MainVal); SetIndexStyle(1,DRAW_LINE,STYLE_DOT); SetIndexBuffer(1,SignalVal); SetIndexBuffer(2,DiffValue); SetIndexLabel(0,"MainVal"); SetIndexLabel(1,"SignalVal"); //---- indicator buffers mapping //---- IndicatorShortName("JJN-Promise ("+Ma_Period+","+Signal_Tolerance+" - "+Ma_Price+") * http://jjnewark.atw.hu * "); //---- initialization done return(0); } int deinit() { //---- ObjectDelete("_DiffValue"); //---- return(0); } int start() { int counted_bars = IndicatorCounted(); if(counted_bars < 0) return(-1); if(counted_bars > 0) counted_bars--; int limit = Bars - counted_bars; if(counted_bars==0) limit-=1+Signal_Tolerance; //---- for(int i=0; i