//+------------------------------------------------------------------+ //| kino_Close-EMA.mq4 | //| Copyright © April 2008, MetaQuotes Software Corp. | //| http://kinonen.over-blog.com | //+------------------------------------------------------------------+ // based on the 4 EMA distance to Close // histo on the biggest EMA , if histo is great you can keep longer the trade // kinonen Octobre 2008 #property copyright "Copyright © 2008, MetaQuotes Software Corp." #property link "http://kinonen.over-blog.com" #property indicator_separate_window #property indicator_buffers 4 #property indicator_color1 Teal #property indicator_color2 Red #property indicator_color3 Yellow #property indicator_color4 Lime //+++++++++++++++++++++++++++++ extern int Price=0; extern string notePrice = "0O,1C 2H3L,4Md 5Tp 6WghC: Md(HL/2)4,Tp(HLC/3)5,Wgh(HLCC/4)6"; extern string MA_Mode = "SMA0 EMA1 SMMA2 LWMA3"; extern int MA1periode=10; extern int MA1mode=1; extern int MA1price=0; extern int MA2periode=21; extern int MA2mode=1; extern int MA2price=0; extern int MA3periode=34; extern int MA3mode=1; extern int MA3price=0; extern int MA4periode=55; extern int MA4mode=1; extern int MA4price=0; extern int zooming=3; double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; double ExtMapBuffer4[]; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_HISTOGRAM); SetIndexBuffer(0,ExtMapBuffer1); SetIndexStyle(3,DRAW_LINE,EMPTY); SetIndexBuffer(3,ExtMapBuffer4); SetIndexStyle(1,DRAW_LINE,EMPTY); SetIndexBuffer(1,ExtMapBuffer2); SetIndexStyle(2,DRAW_LINE,EMPTY); SetIndexBuffer(2,ExtMapBuffer3); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { double val1,val2,val3,val4,val5,val6,val7,val8,val9; //++++++++++++++++++++++++++++++ int limit; int counted_bars = IndicatorCounted(); //---- check for possible errors if(counted_bars < 0) return(-1); //---- last counted bar will be recounted if(counted_bars > 0) counted_bars--; limit = Bars - counted_bars; //========================================== for(int i = limit; i >= 0; i--) { // iMA( string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift) double price=iMA(NULL,0,1,0,MODE_SMA,Price,i); val1=iMA(NULL,0,MA1periode,0,MA1mode,MA1price,i); val2=iMA(NULL,0,MA2periode,0,MA2mode,MA2price,i); val3=iMA(NULL,0,MA3periode,0,MA3mode,MA3price,i); val4=iMA(NULL,0,MA4periode,0,MA4mode,MA4price,i); // val5=Close[i]; val6=val1-price; val7=val2-price; val8=val3-price; val9=val4-price; // collecte des resultats / collecting results ExtMapBuffer4[i]=-zooming*val6; ExtMapBuffer2[i]=-zooming*val7; ExtMapBuffer3[i]=-zooming*val8; ExtMapBuffer1[i]=-zooming*val9; } //---- return(0); } //+------------------------------------------------------------------+
Sample
Analysis
Market Information Used:
Indicator Curves created:
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: