//< 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 "10317.alfa" //< 7> #define A.System.ReleaseDate "27.02.2009" //< 8> #define A.System.Program "Advanced Indicator" //< 9> #define A.System.Programmer "Airat Safin http://www.mql4.com/users/Ais" //< 10> //< 11> //==============================================================================================//< 12> //< 13> //< 2. Program >===========================================================================================//< 14> //< 15> //< 2.1. Global Data >-----------------------------------------------------------------------------------------//< 16> //< 17> //< 2.1.1. System stamp > //< 45> string A.System.Name = "A System" ; //< 18> string A.System.Stamp ; //< 20> // //< 45> //< 21> //< 2.1.2. Chart measure register > //< 45> #property indicator_chart_window //< 22> //< 23> double arv.Chart [] = { EMPTY , //< 24> EMPTY , //< 25> EMPTY , //< 26> EMPTY , //< 27> EMPTY , //< 28> EMPTY , //< 29> EMPTY , //< 30> EMPTY , //< 31> EMPTY , //< 32> EMPTY } ; //< 33> //< 34> #define ari.ZeroTime 0 //< 35> #define ari.Resolution.H 1 //< 36> #define ari.LastBar 2 //< 37> #define ari.FirstBar 3 //< 38> #define ari.TotalBars 4 //< 39> #define ari.ShiftBars 5 //< 40> #define ari.PriceMax 6 //< 41> #define ari.PriceMin 7 //< 42> #define ari.PriceRange 8 //< 43> #define ari.Resolution.V 9 //< 44> // //< 45> //< 45> //< 2.1.3. Line metrics > //< 45> #define acs.Ask "Ask" //< 46> #define acs.Bid "Bid" //< 47> // //< 45> //< 45> //< 2.1.4. Text labels > //< 45> #define acs.Price "Price" //< 47> #define acs.Spread "Spread" //< 47> // //< 45> //< 45> //< 2.1.5. > //< 45> // //< 45> //< 45> #define acs.MarginHigh "MarginHigh" //< 50> #define acs.MarginLow "MarginLow" //< 51> #define acs.StopsHigh "StopsHigh" //< 48> #define acs.StopsLow "StopsLow" //< 49> #define acs.BeginTime "BeginTime" //< 52> #define acs.EndTime "EndTime" //< 53> #define acs.SuperTrend "SuperTrend" //< 58> #define acs.SuperLabel "SuperLabel" //< 57> #define acs.MaxMinTrend "MaxMinTrend" //< 58> #define acs.MaxMinLabel "MaxMinLabel" //< 57> #define acs.ZeroTrend "ZeroTrend" //< 59> #define acs.ZeroMaxTrend "ZeroMaxTrend" //< 59> #define acs.ZeroMaxLevel "ZeroMaxLevel" //< 59> #define acs.ZeroMinTrend "ZeroMinTrend" //< 59> #define acs.ZeroMinLevel "ZeroMinLevel" //< 59> #define acs.MaxPrice "MaxPrice" //< 54> #define acs.MinPrice "MinPrice" //< 55> #define acs.MaxTime "MaxTime" //< 56> #define acs.MinTime "MinTime" //< 57> #define acs.MaxPeak "MaxPeak" //< 56> #define acs.MinPeak "MinPeak" //< 57> #define acs.MaxInterval "MaxInterval" //< 56> #define acs.MinInterval "MinInterval" //< 57> #define acs.OverlapMaximum "OverlapMaximum" //< 60> #define acs.OverlapAverage "OverlapAverage" //< 61> #define acs.VolatilityMaximum "VolatilityMaximum" //< 60> #define acs.VolatilityAverage "VolatilityAverage" //< 61> #define acs.OrderPrice "OrderPrice" //< 61> #define acs.OrderTake "OrderTake" //< 61> #define acs.OrderStop "OrderStop" //< 61> #define acs.OrderPriceID "OrderPriceID" //< 61> #define acs.OrderTakeID "OrderTakeID" //< 61> #define acs.OrderStopID "OrderStopID" //< 61> //< 62> string avs.Ask ; //< 63> string avs.Bid ; //< 64> string avs.Price ; //< 64> string avs.Spread ; //< 64> string avs.MarginHigh ; //< 67> string avs.MarginLow ; //< 68> string avs.StopsHigh ; //< 65> string avs.StopsLow ; //< 66> string avs.BeginTime ; //< 69> string avs.EndTime ; //< 70> string avs.SuperTrend ; //< 75> string avs.SuperLabel ; //< 74> string avs.MaxMinTrend ; //< 75> string avs.MaxMinLabel ; //< 74> string avs.ZeroTrend ; //< 76> string avs.ZeroMaxTrend ; //< 76> string avs.ZeroMaxLevel ; //< 76> string avs.ZeroMinTrend ; //< 76> string avs.ZeroMinLevel ; //< 76> string avs.MaxPrice ; //< 71> string avs.MinPrice ; //< 72> string avs.MaxTime ; //< 73> string avs.MinTime ; //< 74> string avs.MaxPeak ; //< 73> string avs.MinPeak ; //< 74> string avs.MaxInterval ; //< 73> string avs.MinInterval ; //< 74> string avs.OverlapMaximum ; //< 77> string avs.OverlapAverage ; //< 78> string avs.VolatilityMaximum ; //< 60> string avs.VolatilityAverage ; //< 61> string avs.OrderPrice ; //< 61> string avs.OrderTake ; //< 61> string avs.OrderStop ; //< 61> string avs.OrderPriceID ; //< 61> string avs.OrderTakeID ; //< 61> string avs.OrderStopID ; //< 61> //< 79> string avs.Prefix ; //< 80> //< 81> string avs.PrefixMetrics ; //< 82> string avs.PrefixAskBars ; //< 83> string avs.PrefixBidBars ; //< 84> string avs.PrefixOverlap ; //< 85> string avs.PrefixSynthBars ; //< 86> string avs.PrefixSynthMean ; //< 87> string avs.PrefixSynthSlopeA ; //< 88> string avs.PrefixSynthSlopeB ; //< 89> //< 90> string avs.SetupMetrics ; //< 91> string avs.SetupOrderLevels ; //< 92> string avs.SetupChartFrames ; //< 93> string avs.SetupSynthFrames ; //< 94> string avs.SetupSynth ; //< 95> //< 96> int avi.FlagMetricsShow ; //< 97> int avi.FlagMetricsCreate ; //< 98> int avi.FlagOrderLevelsShow ; //< 99> int avi.FlagOrderLevelsCreate ; //<100> int avi.FlagChartFramesShow ; //<101> int avi.FlagChartFramesCreate ; //<102> int avi.FlagSynthFramesShow ; //<103> int avi.FlagSynthFramesCreate ; //<104> //<105> double avd.Overlap [] ; //<106> int avi.Synths ; //<107> int avi.Orders ; //<107> //<108> string avs.Symbol ; //<109> int avi.Period ; //<110> int avi.Synth ; //<111> //<112> //-----------------------------------------------------------------------------------------//<113> //<114> //< 2.2. Special Functions >-----------------------------------------------------------------------------------//<115> //<116> //< A.System.Indicator: Function init >````````````````````````````````````````````````````````````````````````//<117> //<118> int init () //<119> { //<120> avs.Symbol = Symbol () ; //<121> avi.Period = Period () ; //<122> avi.Synth = PERIOD_D1 ; //<123> //<124> arv.Chart [ ari.ZeroTime ] = EMPTY ; //<125> arv.Chart [ ari.Resolution.H ] = EMPTY ; //<126> arv.Chart [ ari.LastBar ] = EMPTY ; //<127> arv.Chart [ ari.PriceMax ] = EMPTY ; //<128> arv.Chart [ ari.PriceMin ] = EMPTY ; //<129> //<130> avs.Prefix = A.System.Series + A.System.Modification + "." ; //<131> //<132> avs.SetupMetrics = avs.Prefix + "Setup.Metrics" ; //<133> avs.SetupOrderLevels = avs.Prefix + "Setup.OrderLevels" ; //<134> avs.SetupChartFrames = avs.Prefix + "Setup.ChartFrames" ; //<135> avs.SetupSynthFrames = avs.Prefix + "Setup.SynthFrames" ; //<136> avs.SetupSynth = avs.Prefix + "Setup.SynthSize" ; //<137> //<138> avs.PrefixMetrics = avs.Prefix + "Metric." ; //<139> avs.PrefixAskBars = avs.Prefix + "AskBar." ; //<140> avs.PrefixBidBars = avs.Prefix + "BidBar." ; //<141> avs.PrefixOverlap = avs.Prefix + "OverlapBar." ; //<142> avs.PrefixSynthBars = avs.Prefix + "SynthBar." ; //<143> avs.PrefixSynthMean = avs.Prefix + "SynthMean." ; //<144> avs.PrefixSynthSlopeA = avs.Prefix + "SynthSlopeA." ; //<145> avs.PrefixSynthSlopeB = avs.Prefix + "SynthSlopeB." ; //<146> //<147> avs.Ask = avs.PrefixMetrics + acs.Ask ; //<148> avs.Bid = avs.PrefixMetrics + acs.Bid ; //<149> avs.Price = avs.PrefixMetrics + acs.Price ; //<149> avs.Spread = avs.PrefixMetrics + acs.Spread ; //<149> avs.MarginHigh = avs.PrefixMetrics + acs.MarginHigh ; //<152> avs.MarginLow = avs.PrefixMetrics + acs.MarginLow ; //<153> avs.StopsHigh = avs.PrefixMetrics + acs.StopsHigh ; //<150> avs.StopsLow = avs.PrefixMetrics + acs.StopsLow ; //<151> avs.BeginTime = avs.PrefixMetrics + acs.BeginTime ; //<154> avs.EndTime = avs.PrefixMetrics + acs.EndTime ; //<155> avs.SuperTrend = avs.PrefixMetrics + acs.SuperTrend ; //<160> avs.SuperLabel = avs.PrefixMetrics + acs.SuperLabel ; //<159> avs.MaxMinTrend = avs.PrefixMetrics + acs.MaxMinTrend ; //<160> avs.MaxMinLabel = avs.PrefixMetrics + acs.MaxMinLabel ; //<159> avs.ZeroTrend = avs.PrefixMetrics + acs.ZeroTrend ; //<161> avs.ZeroMaxTrend = avs.PrefixMetrics + acs.ZeroMaxTrend ; //<161> avs.ZeroMaxLevel = avs.PrefixMetrics + acs.ZeroMaxLevel ; //<161> avs.ZeroMinTrend = avs.PrefixMetrics + acs.ZeroMinTrend ; //<161> avs.ZeroMinLevel = avs.PrefixMetrics + acs.ZeroMinLevel ; //<161> avs.MaxPrice = avs.PrefixMetrics + acs.MaxPrice ; //<156> avs.MinPrice = avs.PrefixMetrics + acs.MinPrice ; //<157> avs.MaxTime = avs.PrefixMetrics + acs.MaxTime ; //<158> avs.MinTime = avs.PrefixMetrics + acs.MinTime ; //<159> avs.MaxPeak = avs.PrefixMetrics + acs.MaxPeak ; //<158> avs.MinPeak = avs.PrefixMetrics + acs.MinPeak ; //<159> avs.MaxInterval = avs.PrefixMetrics + acs.MaxInterval ; //<158> avs.MinInterval = avs.PrefixMetrics + acs.MinInterval ; //<159> avs.OverlapMaximum = avs.PrefixMetrics + acs.OverlapMaximum ; //<162> avs.OverlapAverage = avs.PrefixMetrics + acs.OverlapAverage ; //<163> avs.VolatilityMaximum = avs.PrefixMetrics + acs.VolatilityMaximum ; //<159> avs.VolatilityAverage = avs.PrefixMetrics + acs.VolatilityAverage ; //<159> avs.OrderPrice = avs.PrefixMetrics + acs.OrderPrice ; //<159> avs.OrderTake = avs.PrefixMetrics + acs.OrderTake ; //<159> avs.OrderStop = avs.PrefixMetrics + acs.OrderStop ; //<159> avs.OrderPriceID = avs.PrefixMetrics + acs.OrderPriceID ; //<159> avs.OrderTakeID = avs.PrefixMetrics + acs.OrderTakeID ; //<159> avs.OrderStopID = avs.PrefixMetrics + acs.OrderStopID ; //<159> //<164> int i , N ; N = ObjectsTotal () - 1 ; //<165> for ( i = N ; i >= 0 ; i -- ) //<166> { if ( StringLen ( ObjectName ( i ) ) >= 9 ) //<167> if ( StringSubstr ( ObjectName ( i ) , 0 , 9 ) == avs.Prefix ) //<168> ObjectDelete ( ObjectName ( i ) ) ; } //<169> //<170> avi.FlagMetricsShow = 0 ; //<171> avi.FlagMetricsCreate = 0 ; //<172> avi.FlagOrderLevelsShow = 0 ; //<173> avi.FlagOrderLevelsCreate = 0 ; //<174> avi.FlagChartFramesShow = 0 ; //<175> avi.FlagChartFramesCreate = 0 ; //<176> avi.FlagSynthFramesShow = 0 ; //<177> avi.FlagSynthFramesCreate = 0 ; //<178> //<179> GlobalVariableSet ( avs.SetupMetrics , 1 ) ; //<180> GlobalVariableSet ( avs.SetupOrderLevels , 0 ) ; //<181> GlobalVariableSet ( avs.SetupChartFrames , 1 ) ; //<182> GlobalVariableSet ( avs.SetupSynthFrames , 1 ) ; //<183> GlobalVariableSet ( avs.SetupSynth , avi.Synth ) ; //<184> //<185> A.System.Stamp = A.System.Name + ": " + //<186> A.System.Series + //<187> A.System.Modification + " " + //<188> A.System.Program + " " + //<189> avs.Symbol + " " + //<190> avi.Period ; //<191> //<192> Alert ( A.System.Stamp , " Reload " , UninitializeReason () ) ; //<193> } //<194> //````````````````````````````````````````````````````````````````````````//<195> //<196> //< A.System.Indicator: Function deinit >``````````````````````````````````````````````````````````````````````//<197> //<198> int deinit () //<199> { //<200> afr.DeleteMetrics () ; //<201> afr.DeleteOrderLevels () ; //<202> afr.DeleteChartFrames () ; //<203> afr.DeleteSynthFrames () ; //<204> //<205> GlobalVariableDel ( avs.SetupMetrics ) ; //<206> GlobalVariableDel ( avs.SetupOrderLevels ) ; //<207> GlobalVariableDel ( avs.SetupChartFrames ) ; //<208> GlobalVariableDel ( avs.SetupSynthFrames ) ; //<209> GlobalVariableDel ( avs.SetupSynth ) ; //<210> //<211> Alert ( A.System.Stamp , " Stop " , UninitializeReason () ) ; //<212> } //<213> //``````````````````````````````````````````````````````````````````````//<214> //<215> //< A.System.Indicator: Function start >```````````````````````````````````````````````````````````````````````//<216> //<217> int start () //<218> { //<219> if ( ! GlobalVariableCheck ( avs.SetupMetrics ) ) GlobalVariableSet ( avs.SetupMetrics , 1 ) ; //<220> if ( ! GlobalVariableCheck ( avs.SetupOrderLevels ) ) GlobalVariableSet ( avs.SetupOrderLevels , 0 ) ; //<221> if ( ! GlobalVariableCheck ( avs.SetupChartFrames ) ) GlobalVariableSet ( avs.SetupChartFrames , 1 ) ; //<222> if ( ! GlobalVariableCheck ( avs.SetupSynthFrames ) ) GlobalVariableSet ( avs.SetupSynthFrames , 1 ) ; //<223> if ( ! GlobalVariableCheck ( avs.SetupSynth ) ) GlobalVariableSet ( avs.SetupSynth , avi.Synth ) ; //<224> //<225> if ( arv.Chart [ ari.ZeroTime ] != Time [ 0 ] //<226> || arv.Chart [ ari.Resolution.H ] != WindowBarsPerChart () //<227> || arv.Chart [ ari.LastBar ] != WindowFirstVisibleBar () //<228> || arv.Chart [ ari.PriceMax ] != WindowPriceMax () //<229> || arv.Chart [ ari.PriceMin ] != WindowPriceMin () //<230> || avi.Synth != GlobalVariableGet ( avs.SetupSynth ) ) //<231> //<232> { avi.Synth = GlobalVariableGet ( avs.SetupSynth ) ; //<233> afr.MeasureChart () ; //<234> //<235> afr.DeleteChartFrames () ; //<236> avi.FlagChartFramesCreate = 1 ; //<237> afr.DeleteSynthFrames () ; //<238> avi.FlagSynthFramesCreate = 1 ; } //<239> //<240> if ( GlobalVariableGet ( avs.SetupMetrics ) == 1 ) //<241> { if ( avi.FlagMetricsShow == 0 ) //<242> { avi.FlagMetricsShow = 1 ; //<243> avi.FlagMetricsCreate = 1 ; } //<244> afr.PlotMetrics () ; } //<245> else if ( avi.FlagMetricsShow == 1 ) //<246> { avi.FlagMetricsShow = 0 ; //<247> afr.DeleteMetrics () ; } //<248> //<249> if ( GlobalVariableGet ( avs.SetupOrderLevels ) >= 0 ) //<250> { if ( avi.FlagOrderLevelsShow == 0 ) //<251> { avi.FlagOrderLevelsShow = 1 ; //<252> avi.FlagOrderLevelsCreate = 1 ; } //<253> afr.PlotOrderLevels () ; } //<254> else if ( avi.FlagOrderLevelsShow == 1 ) //<255> { avi.FlagOrderLevelsShow = 0 ; //<256> afr.DeleteOrderLevels () ; } //<257> //<258> if ( GlobalVariableGet ( avs.SetupChartFrames ) == 1 ) //<259> { if ( avi.FlagChartFramesShow == 0 ) //<260> { avi.FlagChartFramesShow = 1 ; //<261> avi.FlagChartFramesCreate = 1 ; } //<262> afr.PlotChartFrames () ; } //<263> else if ( avi.FlagChartFramesShow == 1 ) //<264> { avi.FlagChartFramesShow = 0 ; //<265> afr.DeleteChartFrames () ; } //<266> //<267> if ( GlobalVariableGet ( avs.SetupSynthFrames ) == 1 ) //<268> { if ( avi.FlagSynthFramesShow == 0 ) //<269> { avi.FlagSynthFramesShow = 1 ; //<270> avi.FlagSynthFramesCreate = 1 ; } //<271> afr.PlotSynthFrames () ; } //<272> else if ( avi.FlagSynthFramesShow == 1 ) //<273> { avi.FlagSynthFramesShow = 0 ; //<274> afr.DeleteSynthFrames () ; } //<275> int ali.Exception = GetLastError () ; if ( ali.Exception != 0 ) Alert ( "Exception: " , ali.Exception ) ; } //<276> //```````````````````````````````````````````````````````````````````````//<277> //<278> //-----------------------------------------------------------------------------------//<279> //<280> //< 2.3. Common Functions >-----------------------------------------------------------------------------------//<281> //<282> //< A.System.Indicator: Function List >```````````````````````````````````````````````````````````````````````//<283> // 01 int afr.MeasureChart // 12 //<305> // 02 string afs.Interval // 8 //<305> // 03 int afr.CreateArrow // 4 //<323> // 04 int afr.ResetArrow // 2 //<343> // 05 int afr.CreateText // 2 //<323> // 06 int afr.ResetText // 3 //<343> // 07 int afr.CreateLineT // 5 //<323> // 08 int afr.ResetLineT // 5 //<343> // 09 int afr.CreateLineV // 4 //<360> // 10 int afr.ResetLineV // 1 //<375> // 11 int afr.CreateLineH // 4 //<384> // 12 int afr.ResetLineH // 1 //<399> // 13 int afr.Reserved // 3 //<408> // 14 int afr.CreateFrame // 3 //<408> // 15 int afr.ResetFrame // 4 //<424> // 16 int afr.DeleteMetrics // 27 //<439> // 17 int afr.DeleteChartFrames // 12 //<459> // 18 int afr.DeleteSynthFrames // 8 //<476> // 19 int afr.DeleteOrderLevels // 10 //<493> // 20 int afr.PlotMetrics // 183 //<500> // 21 int afr.PlotOrderLevels // 28 //<596> // 22 int afr.PlotChartFrames // 71 //<608> // 23 int afr.PlotSynthFrames // 46 //<677> //< A.System.Indicator: Function List >```````````````````````````````````````````````````````````````````````//<302> //<303> //< A.System.Indicator: Function 1 >``````````````````````````````````````````````````````````````````````````//<304> int afr.MeasureChart () // 12 //<305> { //<306> arv.Chart [ ari.ZeroTime ] = Time [ 0 ] ; //<307> arv.Chart [ ari.Resolution.H ] = WindowBarsPerChart () ; //<308> arv.Chart [ ari.LastBar ] = WindowFirstVisibleBar () ; //<309> if ( arv.Chart [ ari.LastBar ] < arv.Chart [ ari.Resolution.H ] ) //<310> arv.Chart [ ari.FirstBar ] = 0 ; //<311> else arv.Chart [ ari.FirstBar ] = arv.Chart [ ari.LastBar ] - arv.Chart [ ari.Resolution.H ] + 1 ; //<312> arv.Chart [ ari.TotalBars ] = arv.Chart [ ari.LastBar ] - arv.Chart [ ari.FirstBar ] + 1 ; //<313> arv.Chart [ ari.ShiftBars ] = arv.Chart [ ari.Resolution.H ] - arv.Chart [ ari.TotalBars ] ; //<314> arv.Chart [ ari.PriceMax ] = WindowPriceMax () ; //<315> arv.Chart [ ari.PriceMin ] = WindowPriceMin () ; //<316> arv.Chart [ ari.PriceRange ] = arv.Chart [ ari.PriceMax ] - arv.Chart [ ari.PriceMin ] ; //<317> arv.Chart [ ari.Resolution.V ] = arv.Chart [ ari.PriceRange ] / Point ; //<318> } //<319> //``````````````````````````````````````````````````````````````````````````//<320> //<321> //< A.System.Indicator: Function 2 >``````````````````````````````````````````````````````````````````````````//<304> string afs.Interval ( // 8 //<305> int aai.Interval ) //<306> { //<306> static string als.Result ; //<320> static int ali.Interval ; ali.Interval = MathAbs ( aai.Interval ) ; //<320> als.Result = TimeToStr ( ali.Interval , TIME_MINUTES ) ; //<320> //<320> if ( ali.Interval >= 86400 ) als.Result = ali.Interval / 86400 + "+" + als.Result ; //<320> else if ( aai.Interval < 0 ) als.Result = "-" + als.Result ; //<320> //<320> return ( als.Result ) ; //<320> } //<319> //``````````````````````````````````````````````````````````````````````````//<320> //<321> //< A.System.Indicator: Function 3 >``````````````````````````````````````````````````````````````````````````//<322> int afr.CreateArrow ( // 4 //<323> string aas.Name , //<324> int aai.Color , //<325> int aai.Width , //<363> int aai.Char , //<326> int aai.Time , //<329> double aad.Price ) //<332> { //<333> ObjectCreate ( aas.Name , OBJ_ARROW , 0 , aai.Time , aad.Price ) ; //<334> ObjectSet ( aas.Name , OBJPROP_COLOR , aai.Color ) ; //<335> ObjectSet ( aas.Name , OBJPROP_WIDTH , aai.Width ) ; //<336> ObjectSet ( aas.Name , OBJPROP_ARROWCODE , aai.Char ) ; //<336> } //<339> //``````````````````````````````````````````````````````````````````````````//<340> //<341> //< A.System.Indicator: Function 4 >``````````````````````````````````````````````````````````````````````````//<342> int afr.ResetArrow ( // 2 //<343> string aas.Name , //<324> int aai.Time , //<329> double aad.Price ) //<332> { //<350> ObjectSet ( aas.Name , OBJPROP_TIME1 , aai.Time ) ; //<352> ObjectSet ( aas.Name , OBJPROP_PRICE1 , aad.Price ) ; //<353> } //<356> //``````````````````````````````````````````````````````````````````````````//<357> //<358> //< A.System.Indicator: Function 5 >``````````````````````````````````````````````````````````````````````````//<322> int afr.CreateText ( // 2 //<323> string aas.Name , //<324> int aai.Color , //<325> int aai.Size , //<363> int aai.Time , //<329> double aad.Price , //<332> string aas.Text ) //<324> { //<333> ObjectCreate ( aas.Name , OBJ_TEXT , 0 , aai.Time , aad.Price ) ; //<334> ObjectSetText( aas.Name , aas.Text , aai.Size , "Courier New" , aai.Color ) ; //<339> } //<356> //``````````````````````````````````````````````````````````````````````````//<340> //<341> //< A.System.Indicator: Function 6 >``````````````````````````````````````````````````````````````````````````//<342> int afr.ResetText ( // 3 //<343> string aas.Name , //<324> int aai.Color , //<325> int aai.Size , //<363> int aai.Time , //<329> double aad.Price , //<332> string aas.Text ) //<324> { //<350> ObjectSet ( aas.Name , OBJPROP_TIME1 , aai.Time ) ; //<352> ObjectSet ( aas.Name , OBJPROP_PRICE1 , aad.Price ) ; //<353> ObjectSetText( aas.Name , aas.Text , aai.Size , "Courier New" , aai.Color ) ; //<339> } //<356> //``````````````````````````````````````````````````````````````````````````//<357> //<358> //< A.System.Indicator: Function 7 >``````````````````````````````````````````````````````````````````````````//<322> int afr.CreateLineT ( // 5 //<323> string aas.Name , //<324> int aai.Color , //<325> int aai.Width , //<326> int aai.Style , //<327> int aai.Ray , //<328> int aai.Time1 , //<329> double aad.Price1 , //<330> int aai.Time2 , //<331> double aad.Price2 ) //<332> { //<333> ObjectCreate ( aas.Name , OBJ_TREND , 0 , aai.Time1 , aad.Price1 , aai.Time2 , aad.Price2 ) ; //<334> ObjectSet ( aas.Name , OBJPROP_COLOR , aai.Color ) ; //<335> ObjectSet ( aas.Name , OBJPROP_WIDTH , aai.Width ) ; //<336> ObjectSet ( aas.Name , OBJPROP_STYLE , aai.Style ) ; //<337> ObjectSet ( aas.Name , OBJPROP_RAY , aai.Ray ) ; //<338> } //<339> //``````````````````````````````````````````````````````````````````````````//<340> //<341> //< A.System.Indicator: Function 8 >``````````````````````````````````````````````````````````````````````````//<342> int afr.ResetLineT ( // 5 //<343> string aas.Name , //<344> int aai.Color , //<345> int aai.Time1 , //<346> double aad.Price1 , //<347> int aai.Time2 , //<348> double aad.Price2 ) //<349> { //<350> ObjectSet ( aas.Name , OBJPROP_COLOR , aai.Color ) ; //<351> ObjectSet ( aas.Name , OBJPROP_TIME1 , aai.Time1 ) ; //<352> ObjectSet ( aas.Name , OBJPROP_PRICE1 , aad.Price1 ) ; //<353> ObjectSet ( aas.Name , OBJPROP_TIME2 , aai.Time2 ) ; //<354> ObjectSet ( aas.Name , OBJPROP_PRICE2 , aad.Price2 ) ; //<355> } //<356> //``````````````````````````````````````````````````````````````````````````//<357> //<358> //< A.System.Indicator: Function 9 >``````````````````````````````````````````````````````````````````````````//<359> int afr.CreateLineV ( // 4 //<360> string aas.Name , //<361> int aai.Color , //<362> int aai.Width , //<363> int aai.Style , //<364> int aai.Time ) //<365> { //<366> ObjectCreate ( aas.Name , OBJ_VLINE , 0 , aai.Time , 0 ) ; //<367> ObjectSet ( aas.Name , OBJPROP_COLOR , aai.Color ) ; //<368> ObjectSet ( aas.Name , OBJPROP_WIDTH , aai.Width ) ; //<369> ObjectSet ( aas.Name , OBJPROP_STYLE , aai.Style ) ; //<370> } //<371> //``````````````````````````````````````````````````````````````````````````//<372> //<373> //< A.System.Indicator: Function 10 >``````````````````````````````````````````````````````````````````````````//<374> int afr.ResetLineV ( // 1 //<375> string aas.Name , //<376> int aai.Time ) //<377> { //<378> ObjectSet ( aas.Name , OBJPROP_TIME1 , aai.Time ) ; //<379> } //<380> //``````````````````````````````````````````````````````````````````````````//<381> //<382> //< A.System.Indicator: Function 11 >``````````````````````````````````````````````````````````````````````````//<383> int afr.CreateLineH ( // 4 //<384> string aas.Name , //<385> int aai.Color , //<386> int aai.Width , //<387> int aai.Style , //<388> double aad.Price ) //<389> { //<390> ObjectCreate ( aas.Name , OBJ_HLINE , 0 , 0 , aad.Price ) ; //<391> ObjectSet ( aas.Name , OBJPROP_COLOR , aai.Color ) ; //<392> ObjectSet ( aas.Name , OBJPROP_WIDTH , aai.Width ) ; //<393> ObjectSet ( aas.Name , OBJPROP_STYLE , aai.Style ) ; //<394> } //<395> //``````````````````````````````````````````````````````````````````````````//<396> //<397> //< A.System.Indicator: Function 12 >``````````````````````````````````````````````````````````````````````````//<398> int afr.ResetLineH ( // 1 //<399> string aas.Name , //<400> double aad.Price ) //<401> { //<402> ObjectSet ( aas.Name , OBJPROP_PRICE1 , aad.Price ) ; //<403> } //<404> //``````````````````````````````````````````````````````````````````````````//<405> //<406> //< A.System.Indicator: Function 13 >``````````````````````````````````````````````````````````````````````````//<489> //``````````````````````````````````````````````````````````````````````````//<490> //<491> //< A.System.Indicator: Function 14 >``````````````````````````````````````````````````````````````````````````//<407> int afr.CreateFrame ( // 3 //<408> string aas.Name , //<409> int aai.Color , //<410> int aai.BackGround , //<411> int aai.Time1 , //<412> double aad.Price1 , //<413> int aai.Time2 , //<414> double aad.Price2 ) //<415> { //<416> ObjectCreate ( aas.Name , OBJ_RECTANGLE , 0 , aai.Time1 , aad.Price1 , aai.Time2 , aad.Price2 ) ; //<417> ObjectSet ( aas.Name , OBJPROP_COLOR , aai.Color ) ; //<418> ObjectSet ( aas.Name , OBJPROP_BACK , aai.BackGround ) ; //<419> } //<420> //``````````````````````````````````````````````````````````````````````````//<421> //<422> //< A.System.Indicator: Function 15 >``````````````````````````````````````````````````````````````````````````//<423> int afr.ResetFrame ( // 4 //<424> string aas.Name , //<425> int aai.Time1 , //<426> double aad.Price1 , //<427> int aai.Time2 , //<428> double aad.Price2 ) //<429> { //<430> ObjectSet ( aas.Name , OBJPROP_TIME1 , aai.Time1 ) ; //<431> ObjectSet ( aas.Name , OBJPROP_PRICE1 , aad.Price1 ) ; //<432> ObjectSet ( aas.Name , OBJPROP_TIME2 , aai.Time2 ) ; //<433> ObjectSet ( aas.Name , OBJPROP_PRICE2 , aad.Price2 ) ; //<434> } //<435> //``````````````````````````````````````````````````````````````````````````//<436> //<437> //< A.System.Indicator: Function 16 >``````````````````````````````````````````````````````````````````````````//<438> int afr.DeleteMetrics () // 27 //<439> { //<440> ObjectDelete ( avs.Ask ) ; //<441> ObjectDelete ( avs.Bid ) ; //<442> ObjectDelete ( avs.Price ) ; //<442> ObjectDelete ( avs.Spread ) ; //<442> ObjectDelete ( avs.MarginHigh ) ; //<445> ObjectDelete ( avs.MarginLow ) ; //<446> ObjectDelete ( avs.StopsHigh ) ; //<443> ObjectDelete ( avs.StopsLow ) ; //<444> ObjectDelete ( avs.BeginTime ) ; //<447> ObjectDelete ( avs.EndTime ) ; //<448> ObjectDelete ( avs.SuperTrend ) ; //<453> ObjectDelete ( avs.SuperLabel ) ; //<452> ObjectDelete ( avs.MaxMinTrend ) ; //<453> ObjectDelete ( avs.MaxMinLabel ) ; //<452> ObjectDelete ( avs.ZeroTrend ) ; //<454> ObjectDelete ( avs.ZeroMaxTrend ) ; //<454> ObjectDelete ( avs.ZeroMaxLevel ) ; //<454> ObjectDelete ( avs.ZeroMinTrend ) ; //<454> ObjectDelete ( avs.ZeroMinLevel ) ; //<454> ObjectDelete ( avs.MaxPrice ) ; //<449> ObjectDelete ( avs.MinPrice ) ; //<450> ObjectDelete ( avs.MaxTime ) ; //<451> ObjectDelete ( avs.MinTime ) ; //<452> ObjectDelete ( avs.MaxPeak ) ; //<451> ObjectDelete ( avs.MinPeak ) ; //<452> ObjectDelete ( avs.MaxInterval ) ; //<451> ObjectDelete ( avs.MinInterval ) ; //<452> } //<455> //``````````````````````````````````````````````````````````````````````````//<456> //<457> //< A.System.Indicator: Function 17 >``````````````````````````````````````````````````````````````````````````//<458> int afr.DeleteChartFrames () // 12 //<459> { //<460> int i , N ; N = ArraySize ( avd.Overlap ) ; //<461> for ( i = 0 ; i < N ; i ++ ) //<462> { ObjectDelete ( avs.PrefixAskBars + i ) ; //<463> ObjectDelete ( avs.PrefixBidBars + i ) ; //<464> ObjectDelete ( avs.PrefixOverlap + i ) ; } //<465> if ( N != 0 ) //<467> { ObjectDelete ( avs.OverlapMaximum ) ; //<468> ObjectDelete ( avs.OverlapAverage ) ; //<452> ObjectDelete ( avs.VolatilityMaximum ) ; //<452> ObjectDelete ( avs.VolatilityAverage ) ; } //<469> //<470> ArrayResize ( avd.Overlap , 0 ) ; //<471> } //<472> //``````````````````````````````````````````````````````````````````````````//<473> //<474> //< A.System.Indicator: Function 18 >``````````````````````````````````````````````````````````````````````````//<475> int afr.DeleteSynthFrames () // 8 //<476> { //<477> int i , N ; N = avi.Synths ; //<478> for ( i = 0 ; i < N ; i ++ ) //<479> { ObjectDelete ( avs.PrefixSynthBars + i ) ; //<480> ObjectDelete ( avs.PrefixSynthMean + i ) ; //<481> ObjectDelete ( avs.PrefixSynthSlopeA + i ) ; //<482> ObjectDelete ( avs.PrefixSynthSlopeB + i ) ; } //<483> //<484> avi.Synths = 0 ; //<485> } //<486> //``````````````````````````````````````````````````````````````````````````//<487> //<488> //< A.System.Indicator: Function 19 >``````````````````````````````````````````````````````````````````````````//<492> int afr.DeleteOrderLevels () // 10 //<493> { //<494> int i , N ; N = avi.Orders + 1 ; //<478> for ( i = 1 ; i < N ; i ++ ) //<479> { ObjectDelete ( avs.OrderPrice + i ) ; //<480> ObjectDelete ( avs.OrderTake + i ) ; //<481> ObjectDelete ( avs.OrderStop + i ) ; //<482> ObjectDelete ( avs.OrderPriceID + i ) ; //<480> ObjectDelete ( avs.OrderTakeID + i ) ; //<481> ObjectDelete ( avs.OrderStopID + i ) ; } //<482> //<484> avi.Orders = 0 ; //<485> } //<495> //``````````````````````````````````````````````````````````````````````````//<496> //<497> //< A.System.Indicator: Function 20 >``````````````````````````````````````````````````````````````````````````//<498> //<499> int afr.PlotMetrics () // 183 //<500> { //<501> double ald.Spread = Ask - Bid ; //<502> double ald.Bid = iClose ( avs.Symbol , avi.Period , 0 ) ; //<503> double ald.Ask = ald.Bid + ald.Spread ; //<504> int ali.Digits = MarketInfo ( avs.Symbol , MODE_DIGITS ) ; //<505> double ald.NominalMargin = MarketInfo ( avs.Symbol , MODE_MARGINREQUIRED ) ; //<506> double ald.NominalTick = MarketInfo ( avs.Symbol , MODE_TICKVALUE ) ; //<507> double ald.QuoteTick = MarketInfo ( avs.Symbol , MODE_TICKSIZE ) ; //<508> double ald.QuotePoint = MarketInfo ( avs.Symbol , MODE_POINT ) ; //<509> int ali.StopLevel = MarketInfo ( avs.Symbol , MODE_STOPLEVEL ) ; //<510> //<511> double ald.NominalPoint = ald.NominalTick * ald.QuotePoint / ald.QuoteTick ; //<512> int ali.Margin = MathRound ( ald.NominalMargin / ald.NominalPoint ) ; //<513> double ald.QuoteMargin = ali.Margin * ald.QuotePoint ; //<514> double ald.QuoteStops = ali.StopLevel * ald.QuotePoint ; //<515> double ald.HalfMargin = ald.QuoteMargin / 2 ; //<516> double ald.AveragePrice = ( ald.Ask + ald.Bid ) / 2 ; //<517> //<518> int ali.MaxIndex = iHighest ( avs.Symbol , avi.Period , MODE_HIGH , arv.Chart [ ari.TotalBars ] , //<519> arv.Chart [ ari.FirstBar ] ) ; //<520> int ali.MinIndex = iLowest ( avs.Symbol , avi.Period , MODE_LOW , arv.Chart [ ari.TotalBars ] , //<521> arv.Chart [ ari.FirstBar ] ) ; //<522> double ald.MaxPrice = iHigh ( avs.Symbol , avi.Period , ali.MaxIndex ) + ald.Spread ; //<523> double ald.MinPrice = iLow ( avs.Symbol , avi.Period , ali.MinIndex ) ; //<524> int ali.MaxTime = iTime ( avs.Symbol , avi.Period , ali.MaxIndex ) ; //<525> int ali.MinTime = iTime ( avs.Symbol , avi.Period , ali.MinIndex ) ; //<526> int ali.BeginTime = iTime ( avs.Symbol , avi.Period , arv.Chart [ ari.FirstBar ] ) ; //<527> int ali.EndTime = iTime ( avs.Symbol , avi.Period , arv.Chart [ ari.LastBar ] ) ; //<528> //<529> int ali.LastColor ; //<530> int ali.ZeroColor ; //<531> double ald.NearestPrice ; //<534> double ald.FarestPrice ; //<535> int ali.NearestTime ; //<532> int ali.FarestTime ; //<533> int ali.MaxMinTime ; //<533> int ali.ZeroMaxIndex ; //<533> int ali.ZeroMinIndex ; //<533> //<536> if ( ali.MaxTime > ali.MinTime ) //<537> { ali.LastColor = Aqua ; //<538> ali.ZeroColor = Orange ; //<539> ald.NearestPrice = ald.MaxPrice ; //<542> ald.FarestPrice = ald.MinPrice ; //<542> ali.NearestTime = ali.MaxTime ; //<540> ali.FarestTime = ali.MinTime ; //<541> ali.MaxMinTime = ali.MaxTime - ali.MinTime ; //<541> ali.ZeroMinIndex = iLowest ( avs.Symbol , avi.Period , MODE_LOW , ali.MaxIndex , //<519> arv.Chart [ ari.FirstBar ] ) ; //<520> ali.ZeroMaxIndex = iHighest ( avs.Symbol , avi.Period , MODE_HIGH , ali.ZeroMinIndex , //<519> arv.Chart [ ari.FirstBar ] ) ; //<520> } //<543> else { ali.LastColor = Orange ; //<545> ali.ZeroColor = Aqua ; //<546> ald.NearestPrice = ald.MinPrice ; //<549> ald.FarestPrice = ald.MaxPrice ; //<550> ali.NearestTime = ali.MinTime ; //<547> ali.FarestTime = ali.MaxTime ; //<548> ali.MaxMinTime = ali.MinTime - ali.MaxTime ; //<541> ali.ZeroMaxIndex = iHighest ( avs.Symbol , avi.Period , MODE_HIGH , ali.MinIndex , //<519> arv.Chart [ ari.FirstBar ] ) ; //<520> ali.ZeroMinIndex = iLowest ( avs.Symbol , avi.Period , MODE_LOW , ali.ZeroMaxIndex , //<519> arv.Chart [ ari.FirstBar ] ) ; //<520> } //<550> //<650> int ali.ZeroMaxTime = iTime ( avs.Symbol , avi.Period , ali.ZeroMaxIndex ) ; //<525> int ali.ZeroMinTime = iTime ( avs.Symbol , avi.Period , ali.ZeroMinIndex ) ; //<525> double ald.ZeroMaxPrice = iHigh ( avs.Symbol , avi.Period , ali.ZeroMaxIndex ) + ald.Spread ; //<523> double ald.ZeroMinPrice = iLow ( avs.Symbol , avi.Period , ali.ZeroMinIndex ) ; //<523> double ald.ZeroAverage = ( ald.ZeroMaxPrice + ald.ZeroMinPrice ) / 2.0 ; //<535> //<650> string als.MaxInterval = DoubleToStr ( ( ald.MaxPrice - ald.Ask ) / ald.QuotePoint , 0 ) + "/" + //<650> afs.Interval ( arv.Chart [ ari.ZeroTime ] - ali.MaxTime ) ; //<650> string als.MinInterval = DoubleToStr ( ( ald.Bid - ald.MinPrice ) / ald.QuotePoint , 0 ) + "/" + //<650> afs.Interval ( arv.Chart [ ari.ZeroTime ] - ali.MinTime ) ; //<650> string als.MaxMinLabel = DoubleToStr ( ( ald.MaxPrice - ald.MinPrice ) / ald.QuotePoint , 0 ) + "/" + //<650> afs.Interval ( ali.MaxMinTime ) ; //<650> //<650> string als.SuperLabel = A.System.Series + A.System.Modification + " " + //<650> A.System.Program + ": " + //<650> DoubleToStr ( ( arv.Chart [ ari.PriceMax ] - //<650> arv.Chart [ ari.PriceMin ] ) / ald.QuotePoint , 0 ) + "/" + //<650> afs.Interval ( ali.BeginTime - ali.EndTime ) + "=" + //<650> DoubleToStr ( arv.Chart [ ari.TotalBars ] , 0 ) + "x" + avi.Period + "=" + //<650> avi.Synths + "x" + avi.Synth ; //<650> //<650> int ali.LabelIndex = arv.Chart [ ari.LastBar ] - arv.Chart [ ari.Resolution.H ] / 2 ; //<650> int ali.LabelTime = iTime ( avs.Symbol , avi.Period , ali.LabelIndex ) ; //<525> //<650> string als.Price = DoubleToStr ( Ask , Digits ) + "/" + DoubleToStr ( Bid , Digits ) ; //<650> //<650> string als.Spread = DoubleToStr ( ald.Spread / ald.QuotePoint , 0 ) + //<650> "/" + ali.StopLevel + "/" + //<650> DoubleToStr ( ald.QuoteMargin / ald.QuotePoint , 0 ) ; //<650> //<650> int ali.TextTime = arv.Chart [ ari.ZeroTime ] + //<650> arv.Chart [ ari.ShiftBars ] * avi.Period * 60 / 2 ; //<578> //<650> if ( avi.FlagMetricsCreate == 1 ) //<552> { avi.FlagMetricsCreate = 0 ; //<553> //<556> afr.CreateLineT ( avs.SuperTrend , ali.LastColor , 1 , STYLE_DOT , 1 , //<554> ali.FarestTime , ald.FarestPrice , ali.BeginTime , ald.AveragePrice ) ; //<555> afr.CreateLineT ( avs.MaxMinTrend , ali.LastColor , 1 , STYLE_DOT , 0 , //<554> ali.NearestTime , ald.NearestPrice , ali.FarestTime , ald.FarestPrice ) ; //<555> afr.CreateLineT ( avs.ZeroTrend , ali.ZeroColor , 1 , STYLE_DOT , 1 , //<557> ali.NearestTime , ald.NearestPrice , ali.BeginTime , ald.AveragePrice ) ; //<558> afr.CreateLineT ( avs.ZeroMaxTrend , ali.ZeroColor , 1 , STYLE_DOT , 0 , //<557> ali.NearestTime , ald.NearestPrice , ali.ZeroMaxTime , ald.ZeroMaxPrice ) ; //<558> afr.CreateLineT ( avs.ZeroMinTrend , ali.ZeroColor , 1 , STYLE_DOT , 0 , //<557> ali.NearestTime , ald.NearestPrice , ali.ZeroMinTime , ald.ZeroMinPrice ) ; //<558> afr.CreateLineT ( avs.ZeroMaxLevel , ali.ZeroColor , 1 , STYLE_DOT , 1 , //<557> ali.ZeroMaxTime , ald.ZeroMaxPrice , ali.BeginTime , ald.ZeroMaxPrice ) ; //<558> afr.CreateLineT ( avs.ZeroMinLevel , ali.ZeroColor , 1 , STYLE_DOT , 1 , //<557> ali.ZeroMinTime , ald.ZeroMinPrice , ali.BeginTime , ald.ZeroMinPrice ) ; //<558> //<559> afr.CreateLineV ( avs.BeginTime , Green , 1 , STYLE_DOT , ali.BeginTime ) ; //<560> afr.CreateLineV ( avs.EndTime , Green , 1 , STYLE_DOT , ali.EndTime ) ; //<561> afr.CreateLineV ( avs.MaxTime , Aqua , 1 , STYLE_DOT , ali.MaxTime ) ; //<562> afr.CreateLineV ( avs.MinTime , Orange , 1 , STYLE_DOT , ali.MinTime ) ; //<563> afr.CreateLineH ( avs.MaxPrice , Aqua , 1 , STYLE_DOT , ald.MaxPrice ) ; //<564> afr.CreateLineH ( avs.MinPrice , Orange , 1 , STYLE_DOT , ald.MinPrice ) ; //<565> afr.CreateLineH ( avs.Ask , Blue , 1 , STYLE_SOLID , ald.Ask ) ; //<566> afr.CreateLineH ( avs.Bid , Red , 1 , STYLE_SOLID , ald.Bid ) ; //<567> afr.CreateLineH ( avs.StopsHigh , Green , 1 , STYLE_SOLID , ald.Ask + ald.QuoteStops ) ; //<568> afr.CreateLineH ( avs.StopsLow , Green , 1 , STYLE_SOLID , ald.Bid - ald.QuoteStops ) ; //<569> afr.CreateLineH ( avs.MarginHigh , Green , 2 , STYLE_SOLID , ald.AveragePrice + ald.HalfMargin ) ; //<570> afr.CreateLineH ( avs.MarginLow , Green , 2 , STYLE_SOLID , ald.AveragePrice - ald.HalfMargin ) ; //<571> afr.CreateArrow ( avs.MaxPeak , Aqua , 2 , 6 , ali.MaxTime , ald.MaxPrice ) ; //<555> afr.CreateArrow ( avs.MinPeak , Orange , 2 , 6 , ali.MinTime , ald.MinPrice ) ; //<555> //<559> afr.CreateText ( avs.SuperLabel , White , 10 , //<559> ali.LabelTime , arv.Chart [ ari.PriceMax ] , als.SuperLabel ) ; //<650> afr.CreateText ( avs.MaxMinLabel , ali.LastColor , 10 , //<559> ali.NearestTime , ald.FarestPrice , als.MaxMinLabel ) ; //<650> afr.CreateText ( avs.MaxInterval , Orange , 10 , //<559> ali.TextTime , ald.MaxPrice , als.MaxInterval ) ; //<650> afr.CreateText ( avs.MinInterval , Aqua , 10 , //<559> ali.TextTime , ald.MinPrice , als.MinInterval ) ; //<650> afr.CreateText ( avs.Price , Yellow , 10 , //<559> ali.TextTime , ald.Bid , als.Price ) ; //<650> afr.CreateText ( avs.Spread , Yellow , 10 , //<559> ali.TextTime , ald.AveragePrice - ald.HalfMargin , als.Spread ) ; //<650> } // if //<572> else { afr.ResetLineT ( avs.SuperTrend , ali.LastColor , //<554> ali.FarestTime , ald.FarestPrice , ali.BeginTime , ald.AveragePrice ) ; //<555> afr.ResetLineT ( avs.MaxMinTrend , ali.LastColor , //<573> ali.NearestTime , ald.NearestPrice , ali.FarestTime , ald.FarestPrice ) ; //<574> afr.ResetLineT ( avs.ZeroTrend , ali.ZeroColor , //<576> ali.NearestTime , ald.NearestPrice , ali.BeginTime , ald.AveragePrice ) ; //<577> afr.ResetLineT ( avs.ZeroMaxTrend , ali.ZeroColor , //<557> ali.NearestTime , ald.NearestPrice , ali.ZeroMaxTime , ald.ZeroMaxPrice ) ; //<558> afr.ResetLineT ( avs.ZeroMinTrend , ali.ZeroColor , //<557> ali.NearestTime , ald.NearestPrice , ali.ZeroMinTime , ald.ZeroMinPrice ) ; //<558> afr.ResetLineT ( avs.ZeroMaxLevel , ali.ZeroColor , //<557> ali.ZeroMaxTime , ald.ZeroMaxPrice , ali.BeginTime , ald.ZeroMaxPrice ) ; //<558> afr.ResetLineT ( avs.ZeroMinLevel , ali.ZeroColor , //<557> ali.ZeroMinTime , ald.ZeroMinPrice , ali.BeginTime , ald.ZeroMinPrice ) ; //<558> //<559> afr.ResetLineV ( avs.BeginTime , ali.BeginTime ) ; //<579> afr.ResetLineV ( avs.EndTime , ali.EndTime ) ; //<580> afr.ResetLineV ( avs.MaxTime , ali.MaxTime ) ; //<581> afr.ResetLineV ( avs.MinTime , ali.MinTime ) ; //<582> afr.ResetLineH ( avs.MaxPrice , ald.MaxPrice ) ; //<583> afr.ResetLineH ( avs.MinPrice , ald.MinPrice ) ; //<584> afr.ResetLineH ( avs.Ask , ald.Ask ) ; //<585> afr.ResetLineH ( avs.Bid , ald.Bid ) ; //<586> afr.ResetLineH ( avs.StopsHigh , ald.Ask + ald.QuoteStops ) ; //<587> afr.ResetLineH ( avs.StopsLow , ald.Bid - ald.QuoteStops ) ; //<588> afr.ResetLineH ( avs.MarginHigh , ald.AveragePrice + ald.HalfMargin ) ; //<589> afr.ResetLineH ( avs.MarginLow , ald.AveragePrice - ald.HalfMargin ) ; //<590> afr.ResetArrow ( avs.MaxPeak , ali.MaxTime , ald.MaxPrice ) ; //<555> afr.ResetArrow ( avs.MinPeak , ali.MinTime , ald.MinPrice ) ; //<555> //<578> afr.ResetText ( avs.SuperLabel , White , 10 , //<559> ali.LabelTime , arv.Chart [ ari.PriceMax ] , als.SuperLabel ) ; //<650> afr.ResetText ( avs.MaxMinLabel , ali.LastColor , 10 , //<559> ali.NearestTime , ald.FarestPrice , als.MaxMinLabel ) ; //<650> afr.ResetText ( avs.MaxInterval , Orange , 10 , //<559> ali.TextTime , ald.MaxPrice , als.MaxInterval ) ; //<650> afr.ResetText ( avs.MinInterval , Aqua , 10 , //<559> ali.TextTime , ald.MinPrice , als.MinInterval ) ; //<650> afr.ResetText ( avs.Price , Yellow , 10 , //<559> ali.TextTime , ald.Bid , als.Price ) ; //<650> afr.ResetText ( avs.Spread , Yellow , 10 , //<559> ali.TextTime , ald.AveragePrice - ald.HalfMargin , als.Spread ) ; //<650> } // else //<591> } //<592> //``````````````````````````````````````````````````````````````````````````//<593> //<594> //< A.System.Indicator: Function 21 >``````````````````````````````````````````````````````````````````````````//< > int afr.PlotOrderLevels () // 28 //< > { //< > afr.DeleteOrderLevels () ; //< > //< > int ali.OrderID = GlobalVariableGet ( avs.SetupOrderLevels ) ; //< > string als.OrderID ; //< > //< > int i , N ; N = OrdersTotal () ; //< > for ( i = 0 ; i < N ; i ++ ) //< > { OrderSelect ( i , SELECT_BY_POS , MODE_TRADES ) ; //< > if ( ali.OrderID == 0 //< > || ali.OrderID == OrderMagicNumber () ) //< > { als.OrderID = OrderMagicNumber () + "/" + OrderTicket () ; //< > avi.Orders ++ ; } //< > else continue ; //< > //< > int ali.PlotIndex = arv.Chart [ ari.LastBar ] - arv.Chart [ ari.Resolution.H ] / 2 ; //< > int ali.PlotTime = iTime ( avs.Symbol , avi.Period , ali.PlotIndex ) ; //< > //< > afr.CreateLineH ( avs.OrderPrice + avi.Orders , White , 1 , STYLE_DASH , OrderOpenPrice () ) ; //< > afr.CreateLineH ( avs.OrderTake + avi.Orders , Green , 1 , STYLE_DASH , OrderTakeProfit () ) ; //< > afr.CreateLineH ( avs.OrderStop + avi.Orders , Red , 1 , STYLE_DASH , OrderStopLoss () ) ; //< > //< > afr.CreateText ( avs.OrderPriceID + avi.Orders , White , 7 , //< > ali.PlotTime , OrderOpenPrice () , als.OrderID ) ; //< > afr.CreateText ( avs.OrderTakeID + avi.Orders , Green , 7 , //< > ali.PlotTime , OrderTakeProfit () , als.OrderID ) ; //< > afr.CreateText ( avs.OrderStopID + avi.Orders , Red , 7 , //< > ali.PlotTime , OrderStopLoss () , als.OrderID ) ; //< > } //< > } //< > //``````````````````````````````````````````````````````````````````````````//< > //< > //< A.System.Indicator: Function 22 >``````````````````````````````````````````````````````````````````````````//<607> int afr.PlotChartFrames () // 71 //<608> { //<609> if ( avi.FlagChartFramesCreate == 1 ) //<610> { avi.FlagChartFramesCreate = 0 ; //<611> //<612> if ( ArraySize ( avd.Overlap ) != arv.Chart [ ari.TotalBars ] ) //<613> ArrayResize ( avd.Overlap , arv.Chart [ ari.TotalBars ] ) ; //<614> //<615> int ali.Suffix = 0 ; //<616> int i , N ; N = arv.Chart [ ari.LastBar ] + 1 ; //<617> for ( i = arv.Chart [ ari.FirstBar ] ; i < N ; i ++ ) //<618> { if ( i == 0 ) //<619> int ali.Time1 = iTime ( avs.Symbol , avi.Period , i ) + avi.Period * 60 ; //<620> else ali.Time1 = iTime ( avs.Symbol , avi.Period , i - 1 ) ; //<621> int ali.Time2 = iTime ( avs.Symbol , avi.Period , i ) ; //<622> double ald.AskHigh = iHigh ( avs.Symbol , avi.Period , i ) + Ask - Bid ; //<623> double ald.AskLow = iLow ( avs.Symbol , avi.Period , i ) + Ask - Bid ; //<624> double ald.BidHigh = iHigh ( avs.Symbol , avi.Period , i ) ; //<625> double ald.BidLow = iLow ( avs.Symbol , avi.Period , i ) ; //<626> //<627> int ali.Index = i - arv.Chart [ ari.FirstBar ] ; //<628> avd.Overlap [ ali.Index ] = ald.BidHigh - ald.AskLow ; //<629> double ald.OverlapBound = arv.Chart [ ari.PriceMax ] - avd.Overlap [ ali.Index ] ; //<630> //<631> afr.CreateFrame ( avs.PrefixAskBars + ali.Suffix , Green , 1 , ali.Time1 , //<632> ald.AskHigh , ali.Time2 , ald.AskLow ) ; //<633> afr.CreateFrame ( avs.PrefixBidBars + ali.Suffix , Orange , 1 , ali.Time1 , //<634> ald.BidHigh , ali.Time2 , ald.BidLow ) ; //<635> afr.CreateFrame ( avs.PrefixOverlap + ali.Suffix , Gray , 1 , ali.Time1 , //<636> arv.Chart [ ari.PriceMax ] , ali.Time2 , ald.OverlapBound ) ; //<637> ali.Suffix ++ ; } //<638> //<639> int ali.OverlapMaxIndex = ArrayMaximum ( avd.Overlap , arv.Chart [ ari.TotalBars ] , 0 ) ; //<640> double ald.OverlapMaximum = avd.Overlap [ ali.OverlapMaxIndex ] ; //<641> //<639> double ald.OverlapAverage = 0 ; //<643> for ( i = 0 ; i < arv.Chart [ ari.TotalBars ] ; i ++ ) //<644> ald.OverlapAverage = ald.OverlapAverage + avd.Overlap [ i ] ; //<645> ald.OverlapAverage = ald.OverlapAverage / arv.Chart [ ari.TotalBars ] ; //<646> //<647> int ali.OverlapMaximum = MathRound ( ald.OverlapMaximum / Point ) ; //<648> int ali.OverlapAverage = MathRound ( ald.OverlapAverage / Point ) ; //<649> double ald.MaximumLevel = arv.Chart [ ari.PriceMax ] - ald.OverlapMaximum ; //<641> double ald.AverageLevel = arv.Chart [ ari.PriceMax ] - ald.OverlapAverage ; //<643> //<650> int ali.TextTime = arv.Chart [ ari.ZeroTime ] + //<650> arv.Chart [ ari.ShiftBars ] * avi.Period * 60 / 2 ; //<649> //<650> afr.CreateLineH ( avs.OverlapMaximum , White , 1 , STYLE_DOT , ald.MaximumLevel ) ; //<652> afr.CreateLineH ( avs.OverlapAverage , White , 1 , STYLE_SOLID , ald.AverageLevel ) ; //<654> //<650> afr.CreateText ( avs.VolatilityMaximum , White , 10 , ali.TextTime , ald.MaximumLevel , //<650> ali.OverlapMaximum ) ; //<650> afr.CreateText ( avs.VolatilityAverage , White , 10 , ali.TextTime , ald.AverageLevel , //<650> ali.OverlapAverage ) ; //<650> } // if //<655> else { ali.Time1 = iTime ( avs.Symbol , avi.Period , 0 ) ; //<656> ali.Time2 = iTime ( avs.Symbol , avi.Period , 0 ) + avi.Period * 60 ; //<657> ald.AskHigh = iHigh ( avs.Symbol , avi.Period , 0 ) + Ask - Bid ; //<658> ald.AskLow = iLow ( avs.Symbol , avi.Period , 0 ) + Ask - Bid ; //<659> ald.BidHigh = iHigh ( avs.Symbol , avi.Period , 0 ) ; //<660> ald.BidLow = iLow ( avs.Symbol , avi.Period , 0 ) ; //<661> //<662> avd.Overlap [ 0 ] = ald.BidHigh - ald.AskLow ; //<663> ald.OverlapBound = arv.Chart [ ari.PriceMax ] - avd.Overlap [ 0 ] ; //<664> //<665> afr.ResetFrame ( avs.PrefixAskBars + 0 , ali.Time1 , ald.AskHigh , //<666> ali.Time2 , ald.AskLow ) ; //<667> afr.ResetFrame ( avs.PrefixBidBars + 0 , ali.Time1 , ald.BidHigh , //<668> ali.Time2 , ald.BidLow ) ; //<669> afr.ResetFrame ( avs.PrefixOverlap + 0 , ali.Time1 , arv.Chart [ ari.PriceMax ] , //<670> ali.Time2 , ald.OverlapBound ) ; //<671> } // else //<672> } //<673> //``````````````````````````````````````````````````````````````````````````//<674> //<675> //< A.System.Indicator: Function 23 >``````````````````````````````````````````````````````````````````````````//<676> int afr.PlotSynthFrames () // 46 //<677> { //<678> if ( iBars ( avs.Symbol , avi.Synth ) < 2 ) return ; //<679> //<680> if ( avi.FlagSynthFramesCreate == 1 ) //<681> { avi.FlagSynthFramesCreate = 0 ; //<682> //<683> if ( avi.Period <= avi.Synth ) //<684> { //<685> int ali.TimeChartBegin = iTime ( avs.Symbol , avi.Period , arv.Chart [ ari.FirstBar ] ) ; //<686> int ali.TimeChartEnd = iTime ( avs.Symbol , avi.Period , arv.Chart [ ari.LastBar ] ) ; //<687> //<688> if ( ali.TimeChartBegin < iTime ( avs.Symbol , avi.Synth , 0 ) ) //<689> int ali.IndexSynthBegin = iBarShift ( avs.Symbol , avi.Synth , ali.TimeChartBegin ) ; //<690> else ali.IndexSynthBegin = 0 ; //<691> //<692> if ( ali.TimeChartEnd < iTime ( avs.Symbol , avi.Synth , 0 ) ) //<693> int ali.IndexSynthEnd = iBarShift ( avs.Symbol , avi.Synth , ali.TimeChartEnd ) ; //<694> else ali.IndexSynthEnd = 0 ; //<695> //<696> if ( ali.IndexSynthEnd == ali.IndexSynthBegin ) ali.IndexSynthEnd ++ ; //<697> //<698> avi.Synths = ali.IndexSynthEnd - ali.IndexSynthBegin + 1 ; //<699> //<700> int ali.Suffix = 0 ; //<701> int i , N ; N = ali.IndexSynthEnd + 1 ; //<702> for ( i = ali.IndexSynthBegin ; i < N ; i ++ ) //<703> { if ( i == 0 ) //<704> int ali.Time1 = iTime ( avs.Symbol , avi.Synth , i ) + avi.Synth * 60 ; //<705> else ali.Time1 = iTime ( avs.Symbol , avi.Synth , i - 1 ) ; //<706> int ali.Time2 = iTime ( avs.Symbol , avi.Synth , i ) ; //<707> double ald.Spread = Ask - Bid ; //<708> double ald.AskHigh = iHigh ( avs.Symbol , avi.Synth , i ) + ald.Spread ; //<709> double ald.BidLow = iLow ( avs.Symbol , avi.Synth , i ) ; //<710> double ald.Average = ( ald.AskHigh + ald.BidLow ) / 2 ; //<711> double ald.Open = iOpen ( avs.Symbol , avi.Synth , i ) ; //<712> double ald.Close = iClose ( avs.Symbol , avi.Synth , i ) ; //<713> //<714> afr.CreateFrame ( avs.PrefixSynthBars + ali.Suffix , White , 0 , //<715> ali.Time1 , ald.AskHigh , ali.Time2 , ald.BidLow ) ; //<716> afr.CreateLineT ( avs.PrefixSynthMean + ali.Suffix , White , 1 , STYLE_DOT , 0 , //<718> ali.Time1 , ald.Average , ali.Time2 , ald.Average ) ; //<719> afr.CreateLineT ( avs.PrefixSynthSlopeA + ali.Suffix , White , 1 , STYLE_DASH , 0 , //<721> ali.Time1 , ald.Close + ald.Spread , ali.Time2 , ald.Open + ald.Spread ) ; //<722> afr.CreateLineT ( avs.PrefixSynthSlopeB + ali.Suffix , White , 1 , STYLE_DASH , 0 , //<724> ali.Time1 , ald.Close , ali.Time2 , ald.Open ) ; //<725> ali.Suffix ++ ; } } //<726> } // if //<727> } //<728> //``````````````````````````````````````````````````````````````````````````//<729> //<730> //-----------------------------------------------------------------------------------//<731> //<732> //==============================================================================================//<733>