//< 1. Property >===========================================================================================//< 1> //< 2> #property copyright "Copyright (C) 2009, MetaQuotes Software Corp." //< 3> #property link "http://www.metaquotes.net" //< 4> //< 5> #define A.System.Series "AIS" //< 6> #define A.System.Modification "10306" //< 7> #define A.System.ReleaseDate "26.02.2009" //< 8> #define A.System.Program "Standard Indicator" //< 9> #define A.System.Programmer "Airat Safin http://www.mql4.com/users/Ais" //< 10> //< 11> //===========================================================================================//< 12> //< 13> //< 2. Program >===========================================================================================//< 14> //< 15> //< 2.1. Data >-------------------------------------------------------------------------------------------//< 16> //< 17> string A.System.Name = "A System" ; //< 18> //< 19> string A.System.Stamp ; //< 20> //< 21> #property indicator_chart_window //< 22> //< 23> double arv.Chart [] = { EMPTY , //< 24> EMPTY , //< 25> EMPTY , //< 26> EMPTY , //< 27> EMPTY } ; //< 28> //< 29> #define ari.ZeroTime 0 //< 30> #define ari.Resolution.H 1 //< 31> #define ari.LastBar 2 //< 32> #define ari.PriceMax 3 //< 33> #define ari.PriceMin 4 //< 34> //< 35> #property indicator_buffers 4 //< 36> //< 37> double B0 [] , B1 [] , B2 [] , B3 [] ; //< 38> //< 39> //-------------------------------------------------------------------------------------------//< 40> //< 41> //< 2.2. Functions >-------------------------------------------------------------------------------------------//< 42> //< 43> int init () { SetIndexBuffer ( 3 , B3 ) ; SetIndexStyle ( 3 , DRAW_LINE , STYLE_SOLID , 4 , Blue ) ; //< 44> SetIndexBuffer ( 2 , B2 ) ; SetIndexStyle ( 2 , DRAW_LINE , STYLE_SOLID , 1 , Green ) ; //< 45> SetIndexBuffer ( 1 , B1 ) ; SetIndexStyle ( 1 , DRAW_LINE , STYLE_SOLID , 1 , Yellow ) ; //< 46> SetIndexBuffer ( 0 , B0 ) ; SetIndexStyle ( 0 , DRAW_LINE , STYLE_SOLID , 4 , Red ) ; //< 47> //< 48> arv.Chart [ ari.ZeroTime ] = EMPTY ; //< 49> arv.Chart [ ari.Resolution.H ] = EMPTY ; //< 50> arv.Chart [ ari.LastBar ] = EMPTY ; //< 51> arv.Chart [ ari.PriceMax ] = EMPTY ; //< 52> arv.Chart [ ari.PriceMin ] = EMPTY ; //< 53> //< 54> A.System.Stamp = A.System.Name + ": " + //< 55> A.System.Series + //< 56> A.System.Modification + " " + //< 57> A.System.Program + " " + //< 58> Symbol () + " " + //< 59> Period () ; //< 60> //< 61> Alert ( A.System.Stamp , " Reload " , UninitializeReason () ) ; } //< 62> //< 63> int deinit () { Alert ( A.System.Stamp , " Stop " , UninitializeReason () ) ; } //< 64> //< 65> int start () { if ( arv.Chart [ ari.ZeroTime ] != Time [ 0 ] //< 66> || arv.Chart [ ari.Resolution.H ] != WindowBarsPerChart () //< 67> || arv.Chart [ ari.LastBar ] != WindowFirstVisibleBar () //< 68> || arv.Chart [ ari.PriceMax ] != WindowPriceMax () //< 69> || arv.Chart [ ari.PriceMin ] != WindowPriceMin () ) //< 70> //< 71> { arv.Chart [ ari.ZeroTime ] = Time [ 0 ] ; //< 72> arv.Chart [ ari.Resolution.H ] = WindowBarsPerChart () ; //< 73> arv.Chart [ ari.LastBar ] = WindowFirstVisibleBar () ; //< 74> arv.Chart [ ari.PriceMax ] = WindowPriceMax () ; //< 75> arv.Chart [ ari.PriceMin ] = WindowPriceMin () ; //< 76> //< 77> double ald.AverageBid ; //< 78> double ald.Spread = Ask - Bid ; //< 79> int N = WindowFirstVisibleBar () ; //< 80> for ( int i = 0 ; i <= N ; i ++ ) //< 81> { ald.AverageBid = ( Low [ i ] + High [ i ] ) / 2 ; //< 82> //< 83> B3 [ i ] = High [ i ] + ald.Spread ; //< 84> B2 [ i ] = ald.AverageBid + ald.Spread ; //< 85> B1 [ i ] = ald.AverageBid ; //< 86> B0 [ i ] = Low [ i ] ; } } //< 87> else //< 88> { ald.Spread = Ask - Bid ; //< 89> ald.AverageBid = ( Low [ 0 ] + High [ 0 ] ) / 2 ; //< 90> //< 91> B3 [ 0 ] = High [ 0 ] + ald.Spread ; //< 92> B2 [ 0 ] = ald.AverageBid + ald.Spread ; //< 93> B1 [ 0 ] = ald.AverageBid ; //< 94> B0 [ 0 ] = Low [ 0 ] ; } } //< 95> //< 96> //-------------------------------------------------------------------------------------------//< 97> //< 98> //==============================================================================================//< 99>