1 #include <stdlib.mqh>
\r
2 //+------------------------------------------------------------------+
\r
6 //| Converted by Mql2Mq4 v0.7 |
\r
7 //| http://yousky.free.fr |
\r
8 //| Copyright © 2006, Yousky Soft |
\r
9 //+------------------------------------------------------------------+
\r
11 //#property copyright " CONVERT BY "ENG.AED AL NAIRAB" ."
\r
12 #property link " http://www.nairab.com/"
\r
14 #property indicator_separate_window
\r
15 #property indicator_color1 Blue
\r
16 #property indicator_buffers 1
\r
18 //+------------------------------------------------------------------+
\r
19 //| Common External variables |
\r
20 //+------------------------------------------------------------------+
\r
22 //+------------------------------------------------------------------+
\r
23 //| External variables |
\r
24 //+------------------------------------------------------------------+
\r
25 extern double triger = 0.70;
\r
26 extern double back_test = 20;
\r
28 //+------------------------------------------------------------------+
\r
29 //| Special Convertion Functions |
\r
30 //+------------------------------------------------------------------+
\r
33 double ExtHistoBuffer[];
\r
35 void SetLoopCount(int loops)
\r
39 void SetIndexValue(int shift, double value)
\r
41 ExtHistoBuffer[shift] = value;
\r
44 //+------------------------------------------------------------------+
\r
46 //+------------------------------------------------------------------+
\r
48 //+------------------------------------------------------------------+
\r
49 //| Initialization |
\r
50 //+------------------------------------------------------------------+
\r
54 SetIndexStyle(0, DRAW_LINE, STYLE_SOLID);
\r
55 SetIndexBuffer(0, ExtHistoBuffer);
\r
56 SetIndexStyle(1, DRAW_LINE, STYLE_SOLID);
\r
61 //+------------------------------------------------------------------+
\r
62 //| Local variables |
\r
63 //+------------------------------------------------------------------+
\r
73 Author := CONVERT BY "ENG.AED AL NAIRAB" .
\r
74 Link := http://www.nairab.com/
\r
75 Separate Window := yes
\r
77 First Draw Type := Line
\r
79 Use Second Data := no
\r
81 Second Draw Type := Line
\r
82 Second Symbol := 218
\r
88 // loop from first bar to current bar (with shift=0)
\r
89 for(shift=900;shift>=0 ;shift--){
\r
90 llv=iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, shift)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, shift);
\r
91 hhv=iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, shift)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, shift);
\r
92 for(i=shift;i<=shift+back_test ;i++){
\r
93 llv=MathMin(iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, i)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, i),llv);
\r
94 hhv=MathMax(iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, i)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, i),hhv);
\r
96 if( ( hhv == (iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, shift)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, shift))&& trend == 0)) trend=1;
\r
97 if( ( llv == (iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, shift)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, shift))&& trend == 0)) trend=-1;
\r
98 if( ( llv<0 && trend == -1 && (iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, shift)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, shift))>-1*triger*llv)) trend=1;
\r
99 if( ( hhv>0 && trend == 1 && (iMA(NULL, 0, 5, 0, MODE_SMA, PRICE_MEDIAN, shift)-iMA(NULL, 0, 35, 0, MODE_SMA, PRICE_MEDIAN, shift))<-1*triger*hhv)) trend=-1;
\r
100 SetIndexValue(shift, trend);
\r