//< 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 "10323" //< 7> #define A_System_ReleaseDate "2009.04.05" //< 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> //< System Name > //< 18> string A_System_Name = "A System" ; //< 19> // //< 20> //< 21> //< System Stamp > //< 22> string avs_SystemStamp ; //< 23> // //< 24> //< 25> //< Color/Size Preset > //< 26> extern int aei_ColorAscend = Aqua ; //< 27> extern int aei_ColorDescend = Orange ; //< 28> extern int aei_ColorSuperLabel = White ; //< 29> extern int aei_ColorHorizonLabel = White ; //< 30> extern int aei_ColorPriceLabel = Yellow ; //< 31> extern int aei_ColorSpreadLabel = Yellow ; //< 32> //< 33> extern int aei_ColorHorizonBorder = Lime ; //< 34> extern int aei_ColorAsk = Blue ; //< 35> extern int aei_ColorBid = Red ; //< 36> extern int aei_ColorStops = Green ; //< 37> extern int aei_ColorMargin = Green ; //< 38> //< 39> extern int aei_ColorAskBars = Green ; //< 40> extern int aei_ColorBidBars = Orange ; //< 41> extern int aei_ColorOverlap = Gray ; //< 42> extern int aei_ColorOverlapLines = White ; //< 43> extern int aei_ColorOverlapLabels = White ; //< 44> //< 45> extern int aei_ColorSynthBars = White ; //< 46> extern int aei_ColorSynthMeans = White ; //< 47> extern int aei_ColorSynthSlopes = White ; //< 48> //< 49> extern int aei_SizeSuperLabel = 10 ; //< 50> extern int aei_SizeHorizonLabel = 10 ; //< 51> extern int aei_SizeMaxMinLabels = 10 ; //< 52> extern int aei_SizePriceLabel = 10 ; //< 53> extern int aei_SizeSpreadLabel = 10 ; //< 54> extern int aei_SizePeakArrows = 2 ; //< 55> //< 56> extern int aei_WidthStops = 1 ; //< 57> extern int aei_WidthMargin = 2 ; //< 58> //< 59> extern int aei_SizeOverlapLabel_1 = 10 ; //< 60> extern int aei_SizeOverlapLabel_2 = 10 ; //< 61> extern int aei_SizeOverlapLabel_3 = 10 ; //< 62> extern int aei_SizeOverlapLabel_4 = 10 ; //< 63> // //< 64> //< 65> //< Chart Metrics > //< 66> #property indicator_chart_window //< 67> //< 68> double arv_Chart [] = { EMPTY , //< 69> EMPTY , //< 70> EMPTY , //< 71> EMPTY , //< 72> EMPTY , //< 73> EMPTY , //< 74> EMPTY , //< 75> EMPTY , //< 76> EMPTY , //< 77> EMPTY , //< 78> EMPTY , //< 79> EMPTY } ; //< 80> //< 81> #define ari_TimeZero 0 //< 82> #define ari_TimeRight 1 //< 83> #define ari_TimeLeft 2 //< 84> #define ari_BarRight 3 //< 85> #define ari_BarLeft 4 //< 86> #define ari_BarsTotal 5 //< 87> #define ari_BarsShift 6 //< 88> #define ari_Resolution_H 7 //< 89> #define ari_PriceMax 8 //< 90> #define ari_PriceMin 9 //< 91> #define ari_PriceRange 10 //< 92> #define ari_Resolution_V 11 //< 93> // //< 94> //< 95> #define acs_SuperLabel "SuperLabel" //< 96> string avs_SuperLabel ; //< 97> #define acs_Horizon "Horizon" //< 98> string avs_Horizon ; //< 99> #define acs_Price "Price" //< 100> string avs_Price ; //< 101> #define acs_Spread "Spread" //< 102> string avs_Spread ; //< 103> #define acs_MaxInterval "MaxInterval" //< 104> string avs_MaxInterval ; //< 105> #define acs_MinInterval "MinInterval" //< 106> string avs_MinInterval ; //< 107> #define acs_MaxMinLabel "MaxMinLabel" //< 108> string avs_MaxMinLabel ; //< 109> #define acs_MaxPeak "MaxPeak" //< 110> string avs_MaxPeak ; //< 111> #define acs_MinPeak "MinPeak" //< 112> string avs_MinPeak ; //< 113> //< 114> #define acs_TimeRight "TimeRight" //< 115> string avs_TimeRight ; //< 116> #define acs_TimeLeft "TimeLeft" //< 117> string avs_TimeLeft ; //< 118> #define acs_MaxTime "MaxTime" //< 119> string avs_MaxTime ; //< 120> #define acs_MinTime "MinTime" //< 121> string avs_MinTime ; //< 122> #define acs_Ask "Ask" //< 123> string avs_Ask ; //< 124> #define acs_Bid "Bid" //< 125> string avs_Bid ; //< 126> #define acs_StopsHigh "StopsHigh" //< 127> string avs_StopsHigh ; //< 128> #define acs_StopsLow "StopsLow" //< 129> string avs_StopsLow ; //< 130> #define acs_MarginHigh "MarginHigh" //< 131> string avs_MarginHigh ; //< 132> #define acs_MarginLow "MarginLow" //< 133> string avs_MarginLow ; //< 134> #define acs_MaxPrice "MaxPrice" //< 135> string avs_MaxPrice ; //< 136> #define acs_MinPrice "MinPrice" //< 137> string avs_MinPrice ; //< 138> #define acs_ZeroMaxLevel "ZeroMaxLevel" //< 139> string avs_ZeroMaxLevel ; //< 140> #define acs_ZeroMinLevel "ZeroMinLevel" //< 141> string avs_ZeroMinLevel ; //< 142> #define acs_SuperTrend "SuperTrend" //< 143> string avs_SuperTrend ; //< 144> #define acs_MaxMinTrend "MaxMinTrend" //< 145> string avs_MaxMinTrend ; //< 146> #define acs_ZeroTrend "ZeroTrend" //< 147> string avs_ZeroTrend ; //< 148> #define acs_ZeroMaxTrend "ZeroMaxTrend" //< 149> string avs_ZeroMaxTrend ; //< 150> #define acs_ZeroMinTrend "ZeroMinTrend" //< 151> string avs_ZeroMinTrend ; //< 152> //< 153> #define acs_OrderPrice "OrderPrice" //< 154> string avs_OrderPrice ; //< 155> #define acs_OrderTake "OrderTake" //< 156> string avs_OrderTake ; //< 157> #define acs_OrderStop "OrderStop" //< 158> string avs_OrderStop ; //< 159> #define acs_OrderPriceID "OrderPriceID" //< 160> string avs_OrderPriceID ; //< 161> #define acs_OrderTakeID "OrderTakeID" //< 162> string avs_OrderTakeID ; //< 163> #define acs_OrderStopID "OrderStopID" //< 164> string avs_OrderStopID ; //< 165> //< 166> #define acs_OverlapMaximum "OverlapMaximum" //< 167> string avs_OverlapMaximum ; //< 168> #define acs_OverlapAverage "OverlapAverage" //< 169> string avs_OverlapAverage ; //< 170> #define acs_VolatilityMaximum "VolatilityMaximum" //< 171> string avs_VolatilityMaximum ; //< 172> #define acs_VolatilityAverage "VolatilityAverage" //< 173> string avs_VolatilityAverage ; //< 174> #define acs_VolatilityZero_1 "VolatilityZero_1" //< 175> string avs_VolatilityZero_1 ; //< 176> #define acs_VolatilityZero_2 "VolatilityZero_2" //< 177> string avs_VolatilityZero_2 ; //< 178> #define acs_EfficiencySuper "EfficiencySuper" //< 179> string avs_EfficiencySuper ; //< 180> #define acs_EfficiencyMaxMin "EfficiencyMaxMin" //< 181> string avs_EfficiencyMaxMin ; //< 182> #define acs_EfficiencyZero "EfficiencyZero" //< 183> string avs_EfficiencyZero ; //< 184> //< 185> string avs_Prefix ; //< 186> //< 187> string avs_PrefixMetrics ; //< 188> string avs_PrefixAskBars ; //< 189> string avs_PrefixBidBars ; //< 190> string avs_PrefixSynthBars ; //< 191> string avs_PrefixSynthMeanA ; //< 192> string avs_PrefixSynthMeanB ; //< 193> string avs_PrefixSynthSlopeA ; //< 194> string avs_PrefixSynthSlopeB ; //< 195> string avs_PrefixOverlap ; //< 196> //< 197> string avs_SetupBegin ; //< 198> string avs_SetupOrderLevels ; //< 199> string avs_SetupMetrics ; //< 200> string avs_SetupChartFrames ; //< 201> string avs_SetupSynthFrames ; //< 202> string avs_SetupSynthSize ; //< 203> string avs_SetupHorizonBars ; //< 204> string avs_SetupHorizonSynths ; //< 205> string avs_SetupHorizonDate ; //< 206> string avs_SetupHorizonHour ; //< 207> string avs_SetupEnd ; //< 208> //< 209> int avi_SetupBegin = 1000000000 ; //< 210> int avi_SetupOrderLevels = 0 ; //< 211> int avi_SetupMetrics = 1 ; //< 212> int avi_SetupChartFrames = 1 ; //< 213> int avi_SetupSynthFrames = 1 ; //< 214> int avi_SetupSynthSize = PERIOD_D1 ; //< 215> int avi_SetupHorizonBars = 0 ; //< 216> int avi_SetupHorizonSynths = 0 ; //< 217> int avi_SetupHorizonDate = 0 ; //< 218> int avi_SetupHorizonHour = 0 ; //< 219> int avi_SetupEnd = 1000000000 ; //< 220> //< 221> int avi_FlagMetricsShow ; //< 222> int avi_FlagMetricsCreate ; //< 223> int avi_FlagOrderLevelsShow ; //< 224> int avi_FlagOrderLevelsCreate ; //< 225> int avi_FlagChartFramesShow ; //< 226> int avi_FlagChartFramesCreate ; //< 227> int avi_FlagSynthFramesShow ; //< 228> int avi_FlagSynthFramesCreate ; //< 229> //< 230> double avd_Overlap [] ; //< 231> int avi_Orders ; //< 232> int avi_Horizon ; //< 233> //< 234> int avi_IndexSynthBegin ; //< 235> int avi_IndexSynthEnd ; //< 236> int avi_Synths ; //< 237> //< 238> string avs_Symbol ; //< 239> int avi_Period ; //< 240> //< 241> //----------------------------------------------------------------------------------------//< 242> //< 243> //< 2.2. Special Functions >----------------------------------------------------------------------------------//< 244> //< 245> //< A_System_Indicator: Function init >```````````````````````````````````````````````````````````````````````//< 246> //< 247> int init () //< 248> { //< 249> avs_Symbol = Symbol () ; //< 250> avi_Period = Period () ; //< 251> //< 252> arv_Chart [ ari_TimeZero ] = EMPTY ; //< 253> arv_Chart [ ari_TimeRight ] = EMPTY ; //< 254> arv_Chart [ ari_TimeLeft ] = EMPTY ; //< 255> arv_Chart [ ari_BarRight ] = EMPTY ; //< 256> arv_Chart [ ari_BarLeft ] = EMPTY ; //< 257> arv_Chart [ ari_BarsShift ] = EMPTY ; //< 258> arv_Chart [ ari_BarsTotal ] = EMPTY ; //< 259> arv_Chart [ ari_Resolution_H ] = EMPTY ; //< 260> arv_Chart [ ari_PriceMax ] = EMPTY ; //< 261> arv_Chart [ ari_PriceMin ] = EMPTY ; //< 262> arv_Chart [ ari_PriceRange ] = EMPTY ; //< 263> arv_Chart [ ari_Resolution_V ] = EMPTY ; //< 264> //< 265> avs_Prefix = A_System_Series + A_System_Modification + "." ; //< 266> //< 267> avs_SetupBegin = avs_Prefix + "Setup.0.Begin.=======================" ; //< 268> avs_SetupOrderLevels = avs_Prefix + "Setup.1.1.OrderLevels" ; //< 269> avs_SetupMetrics = avs_Prefix + "Setup.1.2.Metrics" ; //< 270> avs_SetupChartFrames = avs_Prefix + "Setup.1.3.ChartFrames" ; //< 271> avs_SetupSynthFrames = avs_Prefix + "Setup.1.4.SynthFrames" ; //< 272> avs_SetupSynthSize = avs_Prefix + "Setup.2.1.SynthSize" ; //< 273> avs_SetupHorizonBars = avs_Prefix + "Setup.3.1.HorizonBars" ; //< 274> avs_SetupHorizonSynths = avs_Prefix + "Setup.3.2.HorizonSynths" ; //< 275> avs_SetupHorizonDate = avs_Prefix + "Setup.3.3.HorizonDate" ; //< 276> avs_SetupHorizonHour = avs_Prefix + "Setup.3.4.HorizonHour" ; //< 277> avs_SetupEnd = avs_Prefix + "Setup.9.End_=========================" ; //< 278> //< 279> avs_PrefixMetrics = avs_Prefix + "Metric." ; //< 280> avs_PrefixAskBars = avs_Prefix + "AskBar." ; //< 281> avs_PrefixBidBars = avs_Prefix + "BidBar." ; //< 282> avs_PrefixSynthBars = avs_Prefix + "SynthBar." ; //< 283> avs_PrefixSynthMeanA = avs_Prefix + "SynthMean.A" ; //< 284> avs_PrefixSynthMeanB = avs_Prefix + "SynthMean.B" ; //< 285> avs_PrefixSynthSlopeA = avs_Prefix + "SynthSlopeA." ; //< 286> avs_PrefixSynthSlopeB = avs_Prefix + "SynthSlopeB." ; //< 287> avs_PrefixOverlap = avs_Prefix + "OverlapBar." ; //< 288> //< 289> avs_SuperLabel = avs_PrefixMetrics + acs_SuperLabel ; //< 290> avs_Horizon = avs_PrefixMetrics + acs_Horizon ; //< 291> avs_Price = avs_PrefixMetrics + acs_Price ; //< 292> avs_Spread = avs_PrefixMetrics + acs_Spread ; //< 293> avs_MaxInterval = avs_PrefixMetrics + acs_MaxInterval ; //< 294> avs_MinInterval = avs_PrefixMetrics + acs_MinInterval ; //< 295> avs_MaxMinLabel = avs_PrefixMetrics + acs_MaxMinLabel ; //< 296> avs_MaxPeak = avs_PrefixMetrics + acs_MaxPeak ; //< 297> avs_MinPeak = avs_PrefixMetrics + acs_MinPeak ; //< 298> //< 299> avs_TimeRight = avs_PrefixMetrics + acs_TimeRight ; //< 300> avs_TimeLeft = avs_PrefixMetrics + acs_TimeLeft ; //< 301> avs_MaxTime = avs_PrefixMetrics + acs_MaxTime ; //< 302> avs_MinTime = avs_PrefixMetrics + acs_MinTime ; //< 303> avs_Ask = avs_PrefixMetrics + acs_Ask ; //< 304> avs_Bid = avs_PrefixMetrics + acs_Bid ; //< 305> avs_StopsHigh = avs_PrefixMetrics + acs_StopsHigh ; //< 306> avs_StopsLow = avs_PrefixMetrics + acs_StopsLow ; //< 307> avs_MarginHigh = avs_PrefixMetrics + acs_MarginHigh ; //< 308> avs_MarginLow = avs_PrefixMetrics + acs_MarginLow ; //< 309> avs_MaxPrice = avs_PrefixMetrics + acs_MaxPrice ; //< 310> avs_MinPrice = avs_PrefixMetrics + acs_MinPrice ; //< 311> avs_ZeroMaxLevel = avs_PrefixMetrics + acs_ZeroMaxLevel ; //< 312> avs_ZeroMinLevel = avs_PrefixMetrics + acs_ZeroMinLevel ; //< 313> avs_SuperTrend = avs_PrefixMetrics + acs_SuperTrend ; //< 314> avs_MaxMinTrend = avs_PrefixMetrics + acs_MaxMinTrend ; //< 315> avs_ZeroTrend = avs_PrefixMetrics + acs_ZeroTrend ; //< 316> avs_ZeroMaxTrend = avs_PrefixMetrics + acs_ZeroMaxTrend ; //< 317> avs_ZeroMinTrend = avs_PrefixMetrics + acs_ZeroMinTrend ; //< 318> //< 319> avs_OrderPrice = avs_PrefixMetrics + acs_OrderPrice ; //< 320> avs_OrderTake = avs_PrefixMetrics + acs_OrderTake ; //< 321> avs_OrderStop = avs_PrefixMetrics + acs_OrderStop ; //< 322> avs_OrderPriceID = avs_PrefixMetrics + acs_OrderPriceID ; //< 323> avs_OrderTakeID = avs_PrefixMetrics + acs_OrderTakeID ; //< 324> avs_OrderStopID = avs_PrefixMetrics + acs_OrderStopID ; //< 325> //< 326> avs_OverlapMaximum = avs_PrefixMetrics + acs_OverlapMaximum ; //< 327> avs_OverlapAverage = avs_PrefixMetrics + acs_OverlapAverage ; //< 328> avs_VolatilityMaximum = avs_PrefixMetrics + acs_VolatilityMaximum ; //< 329> avs_VolatilityAverage = avs_PrefixMetrics + acs_VolatilityAverage ; //< 330> avs_VolatilityZero_1 = avs_PrefixMetrics + acs_VolatilityZero_1 ; //< 331> avs_VolatilityZero_2 = avs_PrefixMetrics + acs_VolatilityZero_2 ; //< 332> avs_EfficiencySuper = avs_PrefixMetrics + acs_EfficiencySuper ; //< 333> avs_EfficiencyMaxMin = avs_PrefixMetrics + acs_EfficiencyMaxMin ; //< 334> avs_EfficiencyZero = avs_PrefixMetrics + acs_EfficiencyZero ; //< 335> //< 336> //< Existing Objects Deletion > //< 337> int ali_PrefixDigits = StringLen ( avs_Prefix ) ; //< 338> //< 339> int i , N ; N = ObjectsTotal () - 1 ; //< 340> for ( i = N ; i >= 0 ; i -- ) //< 341> { if ( StringLen ( ObjectName ( i ) ) >= ali_PrefixDigits ) //< 342> if ( StringSubstr ( ObjectName ( i ) , 0 , ali_PrefixDigits ) == avs_Prefix ) //< 343> ObjectDelete ( ObjectName ( i ) ) ; } //< 344> //< 345> GlobalVariablesDeleteAll ( avs_Prefix ) ; //< 346> // //< 347> //< 348> avi_FlagMetricsShow = 0 ; //< 349> avi_FlagMetricsCreate = 0 ; //< 350> avi_FlagOrderLevelsShow = 0 ; //< 351> avi_FlagOrderLevelsCreate = 0 ; //< 352> avi_FlagChartFramesShow = 0 ; //< 353> avi_FlagChartFramesCreate = 0 ; //< 354> avi_FlagSynthFramesShow = 0 ; //< 355> avi_FlagSynthFramesCreate = 0 ; //< 356> //< 357> GlobalVariableSet ( avs_SetupBegin , avi_SetupBegin ) ; //< 358> GlobalVariableSet ( avs_SetupOrderLevels , avi_SetupOrderLevels ) ; //< 359> GlobalVariableSet ( avs_SetupMetrics , avi_SetupMetrics ) ; //< 360> GlobalVariableSet ( avs_SetupChartFrames , avi_SetupChartFrames ) ; //< 361> GlobalVariableSet ( avs_SetupSynthFrames , avi_SetupSynthFrames ) ; //< 362> GlobalVariableSet ( avs_SetupSynthSize , avi_SetupSynthSize ) ; //< 363> GlobalVariableSet ( avs_SetupHorizonBars , avi_SetupHorizonBars ) ; //< 364> GlobalVariableSet ( avs_SetupHorizonSynths , avi_SetupHorizonSynths ) ; //< 365> GlobalVariableSet ( avs_SetupHorizonDate , avi_SetupHorizonDate ) ; //< 366> GlobalVariableSet ( avs_SetupHorizonHour , avi_SetupHorizonHour ) ; //< 367> GlobalVariableSet ( avs_SetupEnd , avi_SetupEnd ) ; //< 368> //< 369> avs_SystemStamp = A_System_Series + //< 370> A_System_Modification + " " + //< 371> A_System_Program ; //< 372> //< 373> Alert ( avs_SystemStamp , ": Symbol=" , //< 374> avs_Symbol , ", Period=" , //< 375> avi_Period , ", Reload code=" , //< 376> UninitializeReason () ) ; //< 377> } //< 378> //```````````````````````````````````````````````````````````````````````//< 379> //< 380> //< A_System_Indicator: Function deinit >`````````````````````````````````````````````````````````````````````//< 381> //< 382> int deinit () //< 383> { //< 384> afr_DeleteMetrics () ; //< 385> afr_DeleteOrderLevels () ; //< 386> afr_DeleteChartFrames () ; //< 387> afr_DeleteSynthFrames () ; //< 388> //< 389> GlobalVariablesDeleteAll ( avs_Prefix ) ; //< 390> //< 391> Alert ( avs_SystemStamp , ": Stop code=" , UninitializeReason () ) ; //< 392> } //< 393> //`````````````````````````````````````````````````````````````````````//< 394> //< 395> //< A_System_Indicator: Function start >``````````````````````````````````````````````````````````````````````//< 396> //< 397> int start () //< 398> { //< 399> static bool alb_RunFlag ; if ( ! alb_RunFlag ) { //< 400> if ( NormalizeDouble ( MarketInfo ( avs_Symbol , MODE_TICKVALUE ) , Digits ) > 0 ) //< 401> alb_RunFlag = True ; //< 402> else return(false) ; } //< 403> //< 404> if ( ! GlobalVariableCheck ( avs_SetupBegin ) ) //< 405> GlobalVariableSet ( avs_SetupBegin , avi_SetupBegin ) ; //< 406> if ( ! GlobalVariableCheck ( avs_SetupOrderLevels ) ) //< 407> GlobalVariableSet ( avs_SetupOrderLevels , avi_SetupOrderLevels ) ; //< 408> if ( ! GlobalVariableCheck ( avs_SetupMetrics ) ) //< 409> GlobalVariableSet ( avs_SetupMetrics , avi_SetupMetrics ) ; //< 410> if ( ! GlobalVariableCheck ( avs_SetupChartFrames ) ) //< 411> GlobalVariableSet ( avs_SetupChartFrames , avi_SetupChartFrames ) ; //< 412> if ( ! GlobalVariableCheck ( avs_SetupSynthFrames ) ) //< 413> GlobalVariableSet ( avs_SetupSynthFrames , avi_SetupSynthFrames ) ; //< 414> if ( ! GlobalVariableCheck ( avs_SetupSynthSize ) ) //< 415> GlobalVariableSet ( avs_SetupSynthSize , avi_SetupSynthSize ) ; //< 416> if ( ! GlobalVariableCheck ( avs_SetupHorizonBars ) ) //< 417> GlobalVariableSet ( avs_SetupHorizonBars , avi_SetupHorizonBars ) ; //< 418> if ( ! GlobalVariableCheck ( avs_SetupHorizonSynths ) ) //< 419> GlobalVariableSet ( avs_SetupHorizonSynths , avi_SetupHorizonSynths ) ; //< 420> if ( ! GlobalVariableCheck ( avs_SetupHorizonDate ) ) //< 421> GlobalVariableSet ( avs_SetupHorizonDate , avi_SetupHorizonDate ) ; //< 422> if ( ! GlobalVariableCheck ( avs_SetupHorizonHour ) ) //< 423> GlobalVariableSet ( avs_SetupHorizonHour , avi_SetupHorizonHour ) ; //< 424> if ( ! GlobalVariableCheck ( avs_SetupEnd ) ) //< 425> GlobalVariableSet ( avs_SetupEnd , avi_SetupEnd ) ; //< 426> //< 427> if ( arv_Chart [ ari_TimeZero ] != Time [ 0 ] //< 428> || arv_Chart [ ari_BarLeft ] != WindowFirstVisibleBar () //< 429> || arv_Chart [ ari_Resolution_H ] != WindowBarsPerChart () //< 430> || arv_Chart [ ari_PriceMax ] != WindowPriceMax () //< 431> || arv_Chart [ ari_PriceMin ] != WindowPriceMin () //< 432> || avi_SetupSynthSize != GlobalVariableGet ( avs_SetupSynthSize ) //< 433> || avi_SetupHorizonBars != GlobalVariableGet ( avs_SetupHorizonBars ) //< 434> || avi_SetupHorizonSynths != GlobalVariableGet ( avs_SetupHorizonSynths ) //< 435> || avi_SetupHorizonDate != GlobalVariableGet ( avs_SetupHorizonDate ) //< 436> || avi_SetupHorizonHour != GlobalVariableGet ( avs_SetupHorizonHour ) ) //< 437> //< 438> { avi_SetupSynthSize = GlobalVariableGet ( avs_SetupSynthSize ) ; //< 439> //< 440> afr_DeleteChartFrames () ; //< 441> avi_FlagChartFramesCreate = 1 ; //< 442> afr_DeleteSynthFrames () ; //< 443> avi_FlagSynthFramesCreate = 1 ; //< 444> //< 445> afr_MeasureChart () ; } //< 446> //< 447> avi_Horizon = afi_Horizon () ; //< 448> //< 449> if ( GlobalVariableGet ( avs_SetupOrderLevels ) >= 0 ) //< 450> { if ( avi_FlagOrderLevelsShow == 0 ) //< 451> { avi_FlagOrderLevelsShow = 1 ; //< 452> avi_FlagOrderLevelsCreate = 1 ; } //< 453> afr_PlotOrderLevels () ; } //< 454> else if ( avi_FlagOrderLevelsShow == 1 ) //< 455> { avi_FlagOrderLevelsShow = 0 ; //< 456> afr_DeleteOrderLevels () ; } //< 457> //< 458> if ( GlobalVariableGet ( avs_SetupMetrics ) == 1 ) //< 459> { if ( avi_FlagMetricsShow == 0 ) //< 460> { avi_FlagMetricsShow = 1 ; //< 461> avi_FlagMetricsCreate = 1 ; } //< 462> afr_PlotMetrics () ; } //< 463> else if ( avi_FlagMetricsShow == 1 ) //< 464> { avi_FlagMetricsShow = 0 ; //< 465> afr_DeleteMetrics () ; } //< 466> //< 467> if ( GlobalVariableGet ( avs_SetupChartFrames ) == 1 ) //< 468> { if ( avi_FlagChartFramesShow == 0 ) //< 469> { avi_FlagChartFramesShow = 1 ; //< 470> avi_FlagChartFramesCreate = 1 ; } //< 471> afr_PlotChartFrames () ; } //< 472> else if ( avi_FlagChartFramesShow == 1 ) //< 473> { avi_FlagChartFramesShow = 0 ; //< 474> afr_DeleteChartFrames () ; } //< 475> //< 476> if ( GlobalVariableGet ( avs_SetupSynthFrames ) == 1 ) //< 477> { if ( avi_FlagSynthFramesShow == 0 ) //< 478> { avi_FlagSynthFramesShow = 1 ; //< 479> avi_FlagSynthFramesCreate = 1 ; } //< 480> afr_PlotSynthFrames () ; } //< 481> else if ( avi_FlagSynthFramesShow == 1 ) //< 482> { avi_FlagSynthFramesShow = 0 ; //< 483> afr_DeleteSynthFrames () ; } //< 484> } //< 485> //``````````````````````````````````````````````````````````````````````//< 486> //< 487> //----------------------------------------------------------------------------------//< 488> //< 489> //< 2.3. Common Functions >----------------------------------------------------------------------------------//< 490> //< 491> //< A_System_Indicator: Function List >``````````````````````````````````````````````````````````````````````//< 492> // 01 int afr_MeasureChart // 20 //< 493> // 02 string afs_Interval // 10 //< 494> // 03 int afr_CreateArrow // 4 //< 495> // 04 int afr_ResetArrow // 2 //< 496> // 05 int afr_CreateText // 2 //< 497> // 06 int afr_ResetText // 3 //< 498> // 07 int afr_CreateLineT // 5 //< 499> // 08 int afr_ResetLineT // 5 //< 500> // 09 int afr_CreateLineV // 4 //< 501> // 10 int afr_ResetLineV // 1 //< 502> // 11 int afr_CreateLineH // 4 //< 503> // 12 int afr_ResetLineH // 1 //< 504> // 13 int afr_Reserved // 3 //< 505> // 14 int afr_CreateFrame // 3 //< 506> // 15 int afr_ResetFrame // 4 //< 507> // 16 int afr_DeleteMetrics // 27 //< 508> // 17 int afr_DeleteChartFrames // 17 //< 509> // 18 int afr_DeleteSynthFrames // 8 //< 510> // 19 int afr_DeleteOrderLevels // 10 //< 511> // 20 int afr_PlotOrderLevels // 28 //< 512> // 21 int afr_PlotMetrics // 239 //< 513> // 22 int afr_PlotChartFrames // 334 //< 514> // 23 int afr_PlotSynthFrames // 60 //< 515> // 24 int afi_Horizon // 48 //< 516> //< A_System_Indicator: Function List >``````````````````````````````````````````````````````````````````````//< 517> //< 518> //< A_System_Indicator: Function 1 >`````````````````````````````````````````````````````````````````````````//< 519> int afr_MeasureChart () // 20 //< 520> { //< 521> arv_Chart [ ari_Resolution_H ] = WindowBarsPerChart () ; //< 522> arv_Chart [ ari_BarLeft ] = WindowFirstVisibleBar () ; //< 523> //< 524> if ( arv_Chart [ ari_BarLeft ] < arv_Chart [ ari_Resolution_H ] ) //< 525> arv_Chart [ ari_BarRight ] = 0 ; //< 526> else arv_Chart [ ari_BarRight ] = arv_Chart [ ari_BarLeft ] - arv_Chart [ ari_Resolution_H ] ; //< 527> //< 528> arv_Chart [ ari_BarsTotal ] = arv_Chart [ ari_BarLeft ] - arv_Chart [ ari_BarRight ] + 1 ; //< 529> arv_Chart [ ari_BarsShift ] = arv_Chart [ ari_Resolution_H ] - arv_Chart [ ari_BarsTotal ] ; //< 530> //< 531> arv_Chart [ ari_TimeZero ] = Time [ 0 ] ; //< 532> int ali_IndexRight = arv_Chart [ ari_BarRight ] ; //< 533> int ali_IndexLeft = arv_Chart [ ari_BarLeft ] ; //< 534> arv_Chart [ ari_TimeRight ] = Time [ ali_IndexRight ] ; //< 535> arv_Chart [ ari_TimeLeft ] = Time [ ali_IndexLeft ] ; //< 536> //< 537> arv_Chart [ ari_PriceMax ] = WindowPriceMax () ; //< 538> arv_Chart [ ari_PriceMin ] = WindowPriceMin () ; //< 539> arv_Chart [ ari_PriceRange ] = arv_Chart [ ari_PriceMax ] - arv_Chart [ ari_PriceMin ] ; //< 540> arv_Chart [ ari_Resolution_V ] = arv_Chart [ ari_PriceRange ] / Point ; //< 541> } //< 542> //`````````````````````````````````````````````````````````````````````````//< 543> //< 544> //< A_System_Indicator: Function 2 >`````````````````````````````````````````````````````````````````````````//< 545> string afs_Interval ( // 10 //< 546> int aai_Interval , //< 547> int aai_Seconds = EMPTY ) //< 548> { //< 549> static string als_Result ; //< 550> //< 551> static int ali_Interval ; ali_Interval = MathAbs ( aai_Interval ) ; //< 552> if ( aai_Seconds == EMPTY ) als_Result = TimeToStr ( ali_Interval , TIME_MINUTES ) ; //< 553> else als_Result = TimeToStr ( ali_Interval , TIME_SECONDS ) ; //< 554> //< 555> if ( ali_Interval >= 86400 ) als_Result = ali_Interval / 86400 + " " + als_Result ; //< 556> else if ( aai_Interval < 0 ) als_Result = "-" + als_Result ; //< 557> //< 558> return ( als_Result ) ; //< 559> } //< 560> //`````````````````````````````````````````````````````````````````````````//< 561> //< 562> //< A_System_Indicator: Function 3 >`````````````````````````````````````````````````````````````````````````//< 563> int afr_CreateArrow ( // 4 //< 564> string aas_Name , //< 565> int aai_Color , //< 566> int aai_Width , //< 567> int aai_Char , //< 568> int aai_Time , //< 569> double aad_Price ) //< 570> { //< 571> ObjectCreate ( aas_Name , OBJ_ARROW , 0 , aai_Time , aad_Price ) ; //< 572> ObjectSet ( aas_Name , OBJPROP_COLOR , aai_Color ) ; //< 573> ObjectSet ( aas_Name , OBJPROP_WIDTH , aai_Width ) ; //< 574> ObjectSet ( aas_Name , OBJPROP_ARROWCODE , aai_Char ) ; //< 575> } //< 576> //`````````````````````````````````````````````````````````````````````````//< 577> //< 578> //< A_System_Indicator: Function 4 >`````````````````````````````````````````````````````````````````````````//< 579> int afr_ResetArrow ( // 2 //< 580> string aas_Name , //< 581> int aai_Time , //< 582> double aad_Price ) //< 583> { //< 584> ObjectSet ( aas_Name , OBJPROP_TIME1 , aai_Time ) ; //< 585> ObjectSet ( aas_Name , OBJPROP_PRICE1 , aad_Price ) ; //< 586> } //< 587> //`````````````````````````````````````````````````````````````````````````//< 588> //< 589> //< A_System_Indicator: Function 5 >`````````````````````````````````````````````````````````````````````````//< 590> int afr_CreateText ( // 2 //< 591> string aas_Name , //< 592> int aai_Color , //< 593> int aai_Size , //< 594> int aai_Time , //< 595> double aad_Price , //< 596> string aas_Text ) //< 597> { //< 598> ObjectCreate ( aas_Name , OBJ_TEXT , 0 , aai_Time , aad_Price ) ; //< 599> ObjectSetText( aas_Name , aas_Text , aai_Size , "Courier New" , aai_Color ) ; //< 600> } //< 601> //`````````````````````````````````````````````````````````````````````````//< 602> //< 603> //< A_System_Indicator: Function 6 >`````````````````````````````````````````````````````````````````````````//< 604> int afr_ResetText ( // 3 //< 605> string aas_Name , //< 606> int aai_Color , //< 607> int aai_Size , //< 608> int aai_Time , //< 609> double aad_Price , //< 610> string aas_Text ) //< 611> { //< 612> ObjectSet ( aas_Name , OBJPROP_TIME1 , aai_Time ) ; //< 613> ObjectSet ( aas_Name , OBJPROP_PRICE1 , aad_Price ) ; //< 614> ObjectSetText( aas_Name , aas_Text , aai_Size , "Courier New" , aai_Color ) ; //< 615> } //< 616> //`````````````````````````````````````````````````````````````````````````//< 617> //< 618> //< A_System_Indicator: Function 7 >`````````````````````````````````````````````````````````````````````````//< 619> int afr_CreateLineT ( // 5 //< 620> string aas_Name , //< 621> int aai_Color , //< 622> int aai_Width , //< 623> int aai_Style , //< 624> int aai_Ray , //< 625> int aai_Time1 , //< 626> double aad_Price1 , //< 627> int aai_Time2 , //< 628> double aad_Price2 ) //< 629> { //< 630> ObjectCreate ( aas_Name , OBJ_TREND , 0 , aai_Time1 , aad_Price1 , aai_Time2 , aad_Price2 ) ; //< 631> ObjectSet ( aas_Name , OBJPROP_COLOR , aai_Color ) ; //< 632> ObjectSet ( aas_Name , OBJPROP_WIDTH , aai_Width ) ; //< 633> ObjectSet ( aas_Name , OBJPROP_STYLE , aai_Style ) ; //< 634> ObjectSet ( aas_Name , OBJPROP_RAY , aai_Ray ) ; //< 635> } //< 636> //`````````````````````````````````````````````````````````````````````````//< 637> //< 638> //< A_System_Indicator: Function 8 >`````````````````````````````````````````````````````````````````````````//< 639> int afr_ResetLineT ( // 5 //< 640> string aas_Name , //< 641> int aai_Color , //< 642> int aai_Time1 , //< 643> double aad_Price1 , //< 644> int aai_Time2 , //< 645> double aad_Price2 ) //< 646> { //< 647> ObjectSet ( aas_Name , OBJPROP_COLOR , aai_Color ) ; //< 648> ObjectSet ( aas_Name , OBJPROP_TIME1 , aai_Time1 ) ; //< 649> ObjectSet ( aas_Name , OBJPROP_PRICE1 , aad_Price1 ) ; //< 650> ObjectSet ( aas_Name , OBJPROP_TIME2 , aai_Time2 ) ; //< 651> ObjectSet ( aas_Name , OBJPROP_PRICE2 , aad_Price2 ) ; //< 652> } //< 653> //`````````````````````````````````````````````````````````````````````````//< 654> //< 655> //< A_System_Indicator: Function 9 >`````````````````````````````````````````````````````````````````````````//< 656> int afr_CreateLineV ( // 4 //< 657> string aas_Name , //< 658> int aai_Color , //< 659> int aai_Width , //< 660> int aai_Style , //< 661> int aai_Time ) //< 662> { //< 663> ObjectCreate ( aas_Name , OBJ_VLINE , 0 , aai_Time , 0 ) ; //< 664> ObjectSet ( aas_Name , OBJPROP_COLOR , aai_Color ) ; //< 665> ObjectSet ( aas_Name , OBJPROP_WIDTH , aai_Width ) ; //< 666> ObjectSet ( aas_Name , OBJPROP_STYLE , aai_Style ) ; //< 667> } //< 668> //`````````````````````````````````````````````````````````````````````````//< 669> //< 670> //< A_System_Indicator: Function 10 >`````````````````````````````````````````````````````````````````````````//< 671> int afr_ResetLineV ( // 1 //< 672> string aas_Name , //< 673> int aai_Time ) //< 674> { //< 675> ObjectSet ( aas_Name , OBJPROP_TIME1 , aai_Time ) ; //< 676> } //< 677> //`````````````````````````````````````````````````````````````````````````//< 678> //< 679> //< A_System_Indicator: Function 11 >`````````````````````````````````````````````````````````````````````````//< 680> int afr_CreateLineH ( // 4 //< 681> string aas_Name , //< 682> int aai_Color , //< 683> int aai_Width , //< 684> int aai_Style , //< 685> double aad_Price ) //< 686> { //< 687> ObjectCreate ( aas_Name , OBJ_HLINE , 0 , 0 , aad_Price ) ; //< 688> ObjectSet ( aas_Name , OBJPROP_COLOR , aai_Color ) ; //< 689> ObjectSet ( aas_Name , OBJPROP_WIDTH , aai_Width ) ; //< 690> ObjectSet ( aas_Name , OBJPROP_STYLE , aai_Style ) ; //< 691> } //< 692> //`````````````````````````````````````````````````````````````````````````//< 693> //< 694> //< A_System_Indicator: Function 12 >`````````````````````````````````````````````````````````````````````````//< 695> int afr_ResetLineH ( // 1 //< 696> string aas_Name , //< 697> double aad_Price ) //< 698> { //< 699> ObjectSet ( aas_Name , OBJPROP_PRICE1 , aad_Price ) ; //< 700> } //< 701> //`````````````````````````````````````````````````````````````````````````//< 702> //< 703> //< A_System_Indicator: Function 13 >`````````````````````````````````````````````````````````````````````````//< 704> //`````````````````````````````````````````````````````````````````````````//< 705> //< 706> //< A_System_Indicator: Function 14 >`````````````````````````````````````````````````````````````````````````//< 707> int afr_CreateFrame ( // 3 //< 708> string aas_Name , //< 709> int aai_Color , //< 710> int aai_BackGround , //< 711> int aai_Time1 , //< 712> double aad_Price1 , //< 713> int aai_Time2 , //< 714> double aad_Price2 ) //< 715> { //< 716> ObjectCreate ( aas_Name , OBJ_RECTANGLE , 0 , aai_Time1 , aad_Price1 , aai_Time2 , aad_Price2 ) ; //< 717> ObjectSet ( aas_Name , OBJPROP_COLOR , aai_Color ) ; //< 718> ObjectSet ( aas_Name , OBJPROP_BACK , aai_BackGround ) ; //< 719> } //< 720> //`````````````````````````````````````````````````````````````````````````//< 721> //< 722> //< A_System_Indicator: Function 15 >`````````````````````````````````````````````````````````````````````````//< 723> int afr_ResetFrame ( // 4 //< 724> string aas_Name , //< 725> int aai_Time1 , //< 726> double aad_Price1 , //< 727> int aai_Time2 , //< 728> double aad_Price2 ) //< 729> { //< 730> ObjectSet ( aas_Name , OBJPROP_TIME1 , aai_Time1 ) ; //< 731> ObjectSet ( aas_Name , OBJPROP_PRICE1 , aad_Price1 ) ; //< 732> ObjectSet ( aas_Name , OBJPROP_TIME2 , aai_Time2 ) ; //< 733> ObjectSet ( aas_Name , OBJPROP_PRICE2 , aad_Price2 ) ; //< 734> } //< 735> //`````````````````````````````````````````````````````````````````````````//< 736> //< 737> //< A_System_Indicator: Function 16 >`````````````````````````````````````````````````````````````````````````//< 738> int afr_DeleteMetrics () // 27 //< 739> { //< 740> ObjectDelete ( avs_SuperLabel ) ; //< 741> ObjectDelete ( avs_Horizon ) ; //< 742> ObjectDelete ( avs_Price ) ; //< 743> ObjectDelete ( avs_Spread ) ; //< 744> ObjectDelete ( avs_MaxInterval ) ; //< 745> ObjectDelete ( avs_MinInterval ) ; //< 746> ObjectDelete ( avs_MaxMinLabel ) ; //< 747> ObjectDelete ( avs_MaxPeak ) ; //< 748> ObjectDelete ( avs_MinPeak ) ; //< 749> ObjectDelete ( avs_TimeRight ) ; //< 750> ObjectDelete ( avs_TimeLeft ) ; //< 751> ObjectDelete ( avs_MaxTime ) ; //< 752> ObjectDelete ( avs_MinTime ) ; //< 753> ObjectDelete ( avs_Ask ) ; //< 754> ObjectDelete ( avs_Bid ) ; //< 755> ObjectDelete ( avs_StopsHigh ) ; //< 756> ObjectDelete ( avs_StopsLow ) ; //< 757> ObjectDelete ( avs_MarginHigh ) ; //< 758> ObjectDelete ( avs_MarginLow ) ; //< 759> ObjectDelete ( avs_MaxPrice ) ; //< 760> ObjectDelete ( avs_MinPrice ) ; //< 761> ObjectDelete ( avs_ZeroMaxLevel ) ; //< 762> ObjectDelete ( avs_ZeroMinLevel ) ; //< 763> ObjectDelete ( avs_SuperTrend ) ; //< 764> ObjectDelete ( avs_MaxMinTrend ) ; //< 765> ObjectDelete ( avs_ZeroTrend ) ; //< 766> ObjectDelete ( avs_ZeroMaxTrend ) ; //< 767> ObjectDelete ( avs_ZeroMinTrend ) ; //< 768> } //< 769> //`````````````````````````````````````````````````````````````````````````//< 770> //< 771> //< A_System_Indicator: Function 17 >`````````````````````````````````````````````````````````````````````````//< 772> int afr_DeleteChartFrames () // 17 //< 773> { //< 774> int i , N ; N = ArraySize ( avd_Overlap ) ; //< 775> for ( i = 0 ; i < N ; i ++ ) //< 776> { ObjectDelete ( avs_PrefixAskBars + i ) ; //< 777> ObjectDelete ( avs_PrefixBidBars + i ) ; //< 778> ObjectDelete ( avs_PrefixOverlap + i ) ; } //< 779> if ( N != 0 ) //< 780> { ObjectDelete ( avs_OverlapMaximum ) ; //< 781> ObjectDelete ( avs_OverlapAverage ) ; //< 782> ObjectDelete ( avs_VolatilityMaximum ) ; //< 783> ObjectDelete ( avs_VolatilityAverage ) ; //< 784> ObjectDelete ( avs_VolatilityZero_1 ) ; //< 785> ObjectDelete ( avs_VolatilityZero_2 ) ; //< 786> ObjectDelete ( avs_EfficiencySuper ) ; //< 787> ObjectDelete ( avs_EfficiencyMaxMin ) ; //< 788> ObjectDelete ( avs_EfficiencyZero ) ; } //< 789> //< 790> ArrayResize ( avd_Overlap , 0 ) ; //< 791> } //< 792> //`````````````````````````````````````````````````````````````````````````//< 793> //< 794> //< A_System_Indicator: Function 18 >`````````````````````````````````````````````````````````````````````````//< 795> int afr_DeleteSynthFrames () // 8 //< 796> { //< 797> int i , N ; N = avi_Synths ; //< 798> for ( i = 0 ; i < N ; i ++ ) //< 799> { ObjectDelete ( avs_PrefixSynthBars + i ) ; //< 800> ObjectDelete ( avs_PrefixSynthMeanA + i ) ; //< 801> ObjectDelete ( avs_PrefixSynthMeanB + i ) ; //< 802> ObjectDelete ( avs_PrefixSynthSlopeA + i ) ; //< 803> ObjectDelete ( avs_PrefixSynthSlopeB + i ) ; } //< 804> //< 805> avi_Synths = 0 ; //< 806> } //< 807> //`````````````````````````````````````````````````````````````````````````//< 808> //< 809> //< A_System_Indicator: Function 19 >`````````````````````````````````````````````````````````````````````````//< 810> int afr_DeleteOrderLevels () // 10 //< 811> { //< 812> int i , N ; N = avi_Orders + 1 ; //< 813> for ( i = 1 ; i < N ; i ++ ) //< 814> { ObjectDelete ( avs_OrderPrice + i ) ; //< 815> ObjectDelete ( avs_OrderTake + i ) ; //< 816> ObjectDelete ( avs_OrderStop + i ) ; //< 817> ObjectDelete ( avs_OrderPriceID + i ) ; //< 818> ObjectDelete ( avs_OrderTakeID + i ) ; //< 819> ObjectDelete ( avs_OrderStopID + i ) ; } //< 820> //< 821> avi_Orders = 0 ; //< 822> } //< 823> //`````````````````````````````````````````````````````````````````````````//< 824> //< 825> //< A_System_Indicator: Function 20 >`````````````````````````````````````````````````````````````````````````//< 826> int afr_PlotOrderLevels () // 28 //< 827> { //< 828> afr_DeleteOrderLevels () ; //< 829> //< 830> int ali_OrderID = GlobalVariableGet ( avs_SetupOrderLevels ) ; //< 831> string als_OrderID ; //< 832> //< 833> int i , N ; N = OrdersTotal () ; //< 834> for ( i = 0 ; i < N ; i ++ ) //< 835> { OrderSelect ( i , SELECT_BY_POS , MODE_TRADES ) ; //< 836> if ( ali_OrderID == 0 //< 837> || ali_OrderID == OrderMagicNumber () ) //< 838> { als_OrderID = OrderMagicNumber () + "/" + OrderTicket () ; //< 839> avi_Orders ++ ; } //< 840> else continue ; //< 841> //< 842> int ali_PlotIndex = ( avi_Horizon + arv_Chart [ ari_BarRight ] ) / 2 ; //< 843> int ali_PlotTime = iTime ( avs_Symbol , avi_Period , ali_PlotIndex ) ; //< 844> //< 845> afr_CreateLineH ( avs_OrderPrice + avi_Orders , White , 1 , STYLE_DASH , OrderOpenPrice () ) ; //< 846> afr_CreateLineH ( avs_OrderTake + avi_Orders , Green , 1 , STYLE_DASH , OrderTakeProfit () ) ; //< 847> afr_CreateLineH ( avs_OrderStop + avi_Orders , Red , 1 , STYLE_DASH , OrderStopLoss () ) ; //< 848> //< 849> afr_CreateText ( avs_OrderPriceID + avi_Orders , White , 7 , //< 850> ali_PlotTime , OrderOpenPrice () , als_OrderID ) ; //< 851> afr_CreateText ( avs_OrderTakeID + avi_Orders , Green , 7 , //< 852> ali_PlotTime , OrderTakeProfit () , als_OrderID ) ; //< 853> afr_CreateText ( avs_OrderStopID + avi_Orders , Red , 7 , //< 854> ali_PlotTime , OrderStopLoss () , als_OrderID ) ; //< 855> } //< 856> } //< 857> //`````````````````````````````````````````````````````````````````````````//< 858> //< 859> //< A_System_Indicator: Function 21 >`````````````````````````````````````````````````````````````````````````//< 860> int afr_PlotMetrics () // 239 //< 861> { //< 862> int ali_BarRight = arv_Chart [ ari_BarRight ] ; //< 863> int ali_BarLeft = avi_Horizon ; //< 864> int ali_BarsTotal = ali_BarLeft - ali_BarRight + 1 ; //< 865> //< 866> double ald_Spread = Ask - Bid ; //< 867> double ald_Bid = iClose ( avs_Symbol , avi_Period , ali_BarRight ) ; //< 868> double ald_Ask = ald_Bid + ald_Spread ; //< 869> //< 870> int ali_Digits = MarketInfo ( avs_Symbol , MODE_DIGITS ) ; //< 871> double ald_NominalMargin = MarketInfo ( avs_Symbol , MODE_MARGINREQUIRED ) ; //< 872> double ald_NominalTick = MarketInfo ( avs_Symbol , MODE_TICKVALUE ) ; //< 873> double ald_QuoteTick = MarketInfo ( avs_Symbol , MODE_TICKSIZE ) ; //< 874> double ald_QuotePoint = MarketInfo ( avs_Symbol , MODE_POINT ) ; //< 875> int ali_StopLevel = MarketInfo ( avs_Symbol , MODE_STOPLEVEL ) ; //< 876> //< 877> double ald_NominalPoint = ald_NominalTick * ald_QuotePoint / ald_QuoteTick ; //< 878> int ali_Margin = MathRound ( ald_NominalMargin / ald_NominalPoint ) ; //< 879> double ald_QuoteMargin = ali_Margin * ald_QuotePoint ; //< 880> double ald_QuoteStops = ali_StopLevel * ald_QuotePoint ; //< 881> double ald_HalfMargin = ald_QuoteMargin / 2 ; //< 882> double ald_AveragePrice = ( ald_Ask + ald_Bid ) / 2 ; //< 883> //< 884> int ali_MaxIndex = iHighest ( avs_Symbol , avi_Period , MODE_HIGH , ali_BarsTotal , //< 885> ali_BarRight ) ; //< 886> int ali_MinIndex = iLowest ( avs_Symbol , avi_Period , MODE_LOW , ali_BarsTotal , //< 887> ali_BarRight ) ; //< 888> double ald_MaxPrice = iHigh ( avs_Symbol , avi_Period , ali_MaxIndex ) + ald_Spread ; //< 889> double ald_MinPrice = iLow ( avs_Symbol , avi_Period , ali_MinIndex ) ; //< 890> int ali_MaxTime = iTime ( avs_Symbol , avi_Period , ali_MaxIndex ) ; //< 891> int ali_MinTime = iTime ( avs_Symbol , avi_Period , ali_MinIndex ) ; //< 892> int ali_TimeRight = iTime ( avs_Symbol , avi_Period , ali_BarRight ) ; //< 893> int ali_TimeLeft = iTime ( avs_Symbol , avi_Period , avi_Horizon ) ; //< 894> //< 895> int ali_LastColor ; //< 896> int ali_ZeroColor ; //< 897> double ald_NearestPrice ; //< 898> double ald_FarestPrice ; //< 899> int ali_NearestTime ; //< 900> int ali_FarestTime ; //< 901> int ali_MaxMinTime ; //< 902> int ali_ZeroMaxIndex ; //< 903> int ali_ZeroMinIndex ; //< 904> //< 905> if ( ali_MaxTime > ali_MinTime ) //< 906> { ali_LastColor = aei_ColorAscend ; //< 907> ali_ZeroColor = aei_ColorDescend ; //< 908> ald_NearestPrice = ald_MaxPrice ; //< 909> ald_FarestPrice = ald_MinPrice ; //< 910> ali_NearestTime = ali_MaxTime ; //< 911> ali_FarestTime = ali_MinTime ; //< 912> ali_MaxMinTime = ali_MaxTime - ali_MinTime ; //< 913> ali_ZeroMinIndex = iLowest ( avs_Symbol , avi_Period , MODE_LOW , //< 914> ali_MaxIndex - ali_BarRight + 1 , ali_BarRight ) ; //< 915> ali_ZeroMaxIndex = iHighest ( avs_Symbol , avi_Period , MODE_HIGH , //< 916> ali_ZeroMinIndex - ali_BarRight + 1 , ali_BarRight ) ; //< 917> } //< 918> else { ali_LastColor = aei_ColorDescend ; //< 919> ali_ZeroColor = aei_ColorAscend ; //< 920> ald_NearestPrice = ald_MinPrice ; //< 921> ald_FarestPrice = ald_MaxPrice ; //< 922> ali_NearestTime = ali_MinTime ; //< 923> ali_FarestTime = ali_MaxTime ; //< 924> ali_MaxMinTime = ali_MinTime - ali_MaxTime ; //< 925> ali_ZeroMaxIndex = iHighest ( avs_Symbol , avi_Period , MODE_HIGH , //< 926> ali_MinIndex - ali_BarRight + 1 , ali_BarRight ) ; //< 927> ali_ZeroMinIndex = iLowest ( avs_Symbol , avi_Period , MODE_LOW , //< 928> ali_ZeroMaxIndex - ali_BarRight + 1 , ali_BarRight ) ; //< 929> } //< 930> //< 931> int ali_ZeroMaxTime = iTime ( avs_Symbol , avi_Period , ali_ZeroMaxIndex ) ; //< 932> int ali_ZeroMinTime = iTime ( avs_Symbol , avi_Period , ali_ZeroMinIndex ) ; //< 933> double ald_ZeroMaxPrice = iHigh ( avs_Symbol , avi_Period , ali_ZeroMaxIndex ) + ald_Spread ; //< 934> double ald_ZeroMinPrice = iLow ( avs_Symbol , avi_Period , ali_ZeroMinIndex ) ; //< 935> double ald_ZeroAverage = ( ald_ZeroMaxPrice + ald_ZeroMinPrice ) / 2.0 ; //< 936> //< 937> string als_MaxInterval = DoubleToStr ( ( ald_MaxPrice - ald_Ask ) / ald_QuotePoint , 0 ) + "/" + //< 938> afs_Interval ( ali_TimeRight - ali_MaxTime ) ; //< 939> string als_MinInterval = DoubleToStr ( ( ald_Bid - ald_MinPrice ) / ald_QuotePoint , 0 ) + "/" + //< 940> afs_Interval ( ali_TimeRight - ali_MinTime ) ; //< 941> string als_MaxMinLabel = DoubleToStr ( ( ald_MaxPrice - ald_MinPrice ) / ald_QuotePoint , 0 ) + "/" + //< 942> afs_Interval ( ali_MaxMinTime ) ; //< 943> //< 944> //< SuperLabel > //< 945> int ali_Synths = avi_IndexSynthEnd - avi_IndexSynthBegin + 1 ; //< 946> //< 947> string als_SuperLabel = A_System_Series + A_System_Modification + ": " + //< 948> DoubleToStr ( ( arv_Chart [ ari_PriceMax ] - //< 949> arv_Chart [ ari_PriceMin ] ) / Point , 0 ) + "/" + //< 950> DoubleToStr ( arv_Chart [ ari_BarLeft ] , 0 ) + "-" + //< 951> DoubleToStr ( arv_Chart [ ari_BarRight ] , 0 ) + "=" + //< 952> DoubleToStr ( arv_Chart [ ari_BarsTotal ] , 0 ) + "x" + Period () + "/" + //< 953> ali_Synths + "x" + //< 954> avi_SetupSynthSize ; //< 955> //< 956> int ali_SuperIndex = arv_Chart [ ari_BarLeft ] - arv_Chart [ ari_Resolution_H ] / 2 ; //< 957> //< 958> int ali_Correction = 0 ; //< 959> if ( ali_SuperIndex < 0 ) //< 960> { ali_Correction = - ali_SuperIndex / 2 ; //< 961> ali_SuperIndex = 0 ; } //< 962> //< 963> int ali_SuperPlace = iTime ( avs_Symbol , avi_Period , ali_SuperIndex ) + //< 964> ali_Correction * Period () * 60 ; //< 965> // //< 966> //< 967> //< HorizonLabel > //< 968> string als_Horizon = TimeToStr ( Time [ avi_Horizon ] , TIME_DATE | TIME_MINUTES ) + " - " + //< 969> TimeToStr ( ali_TimeRight , TIME_DATE | TIME_MINUTES ) + " = " + //< 970> afs_Interval ( ali_TimeRight - Time [ avi_Horizon ] ) + " / " + //< 971> avi_Horizon + "-" + //< 972> ali_BarRight + "=" + //< 973> ali_BarsTotal ; //< 974> //< 975> int ali_HorizonIndex = ( avi_Horizon + ali_BarRight ) / 2 ; //< 976> int ali_HorizonPlace = iTime ( avs_Symbol , avi_Period , ali_HorizonIndex ) ; //< 977> double ald_HorizonPrice = ( arv_Chart [ ari_PriceMin ] + ald_MinPrice ) / 2 ; //< 978> // //< 979> //< 980> //< Right Side Label > //< 981> string als_Price = DoubleToStr ( ald_Ask , Digits ) + "/" + DoubleToStr ( ald_Bid , Digits ) ; //< 982> //< 983> string als_Spread = DoubleToStr ( ald_Spread / ald_QuotePoint , 0 ) + //< 984> "/" + ali_StopLevel + "/" + //< 985> DoubleToStr ( ald_QuoteMargin / ald_QuotePoint , 0 ) ; //< 986> //< 987> if ( arv_Chart [ ari_BarsShift ] > 0 ) //< 988> ali_Correction = arv_Chart [ ari_BarsShift ] ; //< 989> else ali_Correction = arv_Chart [ ari_BarsTotal ] / ( - 5 ) ; //< 990> //< 991> int ali_RightPlace = ali_TimeRight + ali_Correction * avi_Period * 60 / 2 ; //< 992> // //< 993> //< 994> if ( avi_FlagMetricsCreate == 1 ) //< 995> { avi_FlagMetricsCreate = 0 ; //< 996> //< 997> afr_CreateLineT ( avs_SuperTrend , ali_LastColor , 1 , STYLE_DOT , 1 , //< 998> ali_FarestTime , ald_FarestPrice , ali_TimeRight , ald_AveragePrice ) ; //< 999> afr_CreateLineT ( avs_MaxMinTrend , ali_LastColor , 1 , STYLE_DOT , 0 , //<1000> ali_NearestTime , ald_NearestPrice , ali_FarestTime , ald_FarestPrice ) ; //<1001> afr_CreateLineT ( avs_ZeroTrend , ali_ZeroColor , 1 , STYLE_DOT , 1 , //<1002> ali_NearestTime , ald_NearestPrice , ali_TimeRight , ald_AveragePrice ) ; //<1003> afr_CreateLineT ( avs_ZeroMaxTrend , ali_ZeroColor , 1 , STYLE_DOT , 0 , //<1004> ali_NearestTime , ald_NearestPrice , ali_ZeroMaxTime , ald_ZeroMaxPrice ) ; //<1005> afr_CreateLineT ( avs_ZeroMinTrend , ali_ZeroColor , 1 , STYLE_DOT , 0 , //<1006> ali_NearestTime , ald_NearestPrice , ali_ZeroMinTime , ald_ZeroMinPrice ) ; //<1007> afr_CreateLineT ( avs_ZeroMaxLevel , ali_ZeroColor , 1 , STYLE_DOT , 1 , //<1008> ali_ZeroMaxTime , ald_ZeroMaxPrice , ali_TimeRight , ald_ZeroMaxPrice ) ; //<1009> afr_CreateLineT ( avs_ZeroMinLevel , ali_ZeroColor , 1 , STYLE_DOT , 1 , //<1010> ali_ZeroMinTime , ald_ZeroMinPrice , ali_TimeRight , ald_ZeroMinPrice ) ; //<1011> //<1012> afr_CreateLineV ( avs_TimeRight , aei_ColorHorizonBorder , 1 , //<1013> STYLE_DOT , ali_TimeRight ) ; //<1014> afr_CreateLineV ( avs_TimeLeft , aei_ColorHorizonBorder , 1 , //<1015> STYLE_DOT , ali_TimeLeft ) ; //<1016> afr_CreateLineV ( avs_MaxTime , aei_ColorAscend , 1 , //<1017> STYLE_DOT , ali_MaxTime ) ; //<1018> afr_CreateLineV ( avs_MinTime , aei_ColorDescend , 1 , //<1019> STYLE_DOT , ali_MinTime ) ; //<1020> afr_CreateLineH ( avs_MaxPrice , aei_ColorAscend , 1 , //<1021> STYLE_DOT , ald_MaxPrice ) ; //<1022> afr_CreateLineH ( avs_MinPrice , aei_ColorDescend , 1 , //<1023> STYLE_DOT , ald_MinPrice ) ; //<1024> afr_CreateLineH ( avs_Ask , aei_ColorAsk , 1 , //<1025> STYLE_SOLID , ald_Ask ) ; //<1026> afr_CreateLineH ( avs_Bid , aei_ColorBid , 1 , //<1027> STYLE_SOLID , ald_Bid ) ; //<1028> afr_CreateLineH ( avs_StopsHigh , aei_ColorStops , aei_WidthStops , //<1029> STYLE_SOLID , ald_Ask + ald_QuoteStops ) ; //<1030> afr_CreateLineH ( avs_StopsLow , aei_ColorStops , aei_WidthStops , //<1031> STYLE_SOLID , ald_Bid - ald_QuoteStops ) ; //<1032> afr_CreateLineH ( avs_MarginHigh , aei_ColorMargin , aei_WidthMargin , //<1033> STYLE_SOLID , ald_AveragePrice + ald_HalfMargin ) ; //<1034> afr_CreateLineH ( avs_MarginLow , aei_ColorMargin , aei_WidthMargin , //<1035> STYLE_SOLID , ald_AveragePrice - ald_HalfMargin ) ; //<1036> afr_CreateArrow ( avs_MaxPeak , aei_ColorAscend , aei_SizePeakArrows , //<1037> 6 , ali_MaxTime , ald_MaxPrice ) ; //<1038> afr_CreateArrow ( avs_MinPeak , aei_ColorDescend , aei_SizePeakArrows , //<1039> 6 , ali_MinTime , ald_MinPrice ) ; //<1040> //<1041> afr_CreateText ( avs_SuperLabel , aei_ColorSuperLabel , aei_SizeSuperLabel , //<1042> ali_SuperPlace , arv_Chart [ ari_PriceMax ] , als_SuperLabel ) ; //<1043> afr_CreateText ( avs_Horizon , aei_ColorHorizonLabel , aei_SizeHorizonLabel , //<1044> ali_HorizonPlace , ald_HorizonPrice , als_Horizon ) ; //<1045> afr_CreateText ( avs_MaxMinLabel , ali_LastColor , aei_SizeMaxMinLabels , //<1046> ali_NearestTime , ald_FarestPrice , als_MaxMinLabel ) ; //<1047> afr_CreateText ( avs_MaxInterval , aei_ColorDescend , aei_SizeMaxMinLabels , //<1048> ali_RightPlace , ald_MaxPrice , als_MaxInterval ) ; //<1049> afr_CreateText ( avs_MinInterval , aei_ColorAscend , aei_SizeMaxMinLabels , //<1050> ali_RightPlace , ald_MinPrice , als_MinInterval ) ; //<1051> afr_CreateText ( avs_Price , aei_ColorPriceLabel , aei_SizePriceLabel , //<1052> ali_RightPlace , ald_Bid , als_Price ) ; //<1053> afr_CreateText ( avs_Spread , aei_ColorSpreadLabel , aei_SizeSpreadLabel , //<1054> ali_RightPlace , ald_AveragePrice - ald_HalfMargin , als_Spread ) ; //<1055> } // if //<1056> else { afr_ResetLineT ( avs_SuperTrend , ali_LastColor , //<1057> ali_FarestTime , ald_FarestPrice , ali_TimeRight , ald_AveragePrice ) ; //<1058> afr_ResetLineT ( avs_MaxMinTrend , ali_LastColor , //<1059> ali_NearestTime , ald_NearestPrice , ali_FarestTime , ald_FarestPrice ) ; //<1060> afr_ResetLineT ( avs_ZeroTrend , ali_ZeroColor , //<1061> ali_NearestTime , ald_NearestPrice , ali_TimeRight , ald_AveragePrice ) ; //<1062> afr_ResetLineT ( avs_ZeroMaxTrend , ali_ZeroColor , //<1063> ali_NearestTime , ald_NearestPrice , ali_ZeroMaxTime , ald_ZeroMaxPrice ) ; //<1064> afr_ResetLineT ( avs_ZeroMinTrend , ali_ZeroColor , //<1065> ali_NearestTime , ald_NearestPrice , ali_ZeroMinTime , ald_ZeroMinPrice ) ; //<1066> afr_ResetLineT ( avs_ZeroMaxLevel , ali_ZeroColor , //<1067> ali_ZeroMaxTime , ald_ZeroMaxPrice , ali_TimeRight , ald_ZeroMaxPrice ) ; //<1068> afr_ResetLineT ( avs_ZeroMinLevel , ali_ZeroColor , //<1069> ali_ZeroMinTime , ald_ZeroMinPrice , ali_TimeRight , ald_ZeroMinPrice ) ; //<1070> //<1071> afr_ResetLineV ( avs_TimeRight , ali_TimeRight ) ; //<1072> afr_ResetLineV ( avs_TimeLeft , ali_TimeLeft ) ; //<1073> afr_ResetLineV ( avs_MaxTime , ali_MaxTime ) ; //<1074> afr_ResetLineV ( avs_MinTime , ali_MinTime ) ; //<1075> afr_ResetLineH ( avs_MaxPrice , ald_MaxPrice ) ; //<1076> afr_ResetLineH ( avs_MinPrice , ald_MinPrice ) ; //<1077> afr_ResetLineH ( avs_Ask , ald_Ask ) ; //<1078> afr_ResetLineH ( avs_Bid , ald_Bid ) ; //<1079> afr_ResetLineH ( avs_StopsHigh , ald_Ask + ald_QuoteStops ) ; //<1080> afr_ResetLineH ( avs_StopsLow , ald_Bid - ald_QuoteStops ) ; //<1081> afr_ResetLineH ( avs_MarginHigh , ald_AveragePrice + ald_HalfMargin ) ; //<1082> afr_ResetLineH ( avs_MarginLow , ald_AveragePrice - ald_HalfMargin ) ; //<1083> afr_ResetArrow ( avs_MaxPeak , ali_MaxTime , ald_MaxPrice ) ; //<1084> afr_ResetArrow ( avs_MinPeak , ali_MinTime , ald_MinPrice ) ; //<1085> //<1086> afr_ResetText ( avs_SuperLabel , aei_ColorSuperLabel , aei_SizeSuperLabel , //<1087> ali_SuperPlace , arv_Chart [ ari_PriceMax ] , als_SuperLabel ) ; //<1088> afr_ResetText ( avs_Horizon , aei_ColorHorizonLabel , aei_SizeHorizonLabel , //<1089> ali_HorizonPlace , ald_HorizonPrice , als_Horizon ) ; //<1090> afr_ResetText ( avs_MaxMinLabel , ali_LastColor , aei_SizeMaxMinLabels , //<1091> ali_NearestTime , ald_FarestPrice , als_MaxMinLabel ) ; //<1092> afr_ResetText ( avs_MaxInterval , aei_ColorDescend , aei_SizeMaxMinLabels , //<1093> ali_RightPlace , ald_MaxPrice , als_MaxInterval ) ; //<1094> afr_ResetText ( avs_MinInterval , aei_ColorAscend , aei_SizeMaxMinLabels , //<1095> ali_RightPlace , ald_MinPrice , als_MinInterval ) ; //<1096> afr_ResetText ( avs_Price , aei_ColorPriceLabel , aei_SizePriceLabel , //<1097> ali_RightPlace , ald_Bid , als_Price ) ; //<1098> afr_ResetText ( avs_Spread , aei_ColorSpreadLabel , aei_SizeSpreadLabel , //<1099> ali_RightPlace , ald_AveragePrice - ald_HalfMargin , als_Spread ) ; //<1100> } // else //<1101> } //<1102> //`````````````````````````````````````````````````````````````````````````//<1103> //<1104> //< A_System_Indicator: Function 22 >`````````````````````````````````````````````````````````````````````````//<1105> int afr_PlotChartFrames () // 334 //<1106> { //<1107> int ali_BarRight = arv_Chart [ ari_BarRight ] ; //<1108> int ali_BarLeft = avi_Horizon ; //<1109> int ali_BarsToCompute = ali_BarLeft - ali_BarRight + 1 ; //<1110> //<1111> double ald_Spread = Ask - Bid ; //<1112> double ald_Bid = iClose ( avs_Symbol , avi_Period , ali_BarRight ) ; //<1113> double ald_Ask = ald_Bid + ald_Spread ; //<1114> //<1115> double ald_AveragePrice = ( ald_Ask + ald_Bid ) / 2 ; //<1116> //<1117> double ald_QuotePoint = MarketInfo ( avs_Symbol , MODE_POINT ) ; //<1118> //<1119> if ( avi_FlagChartFramesCreate == 1 ) //<1120> { avi_FlagChartFramesCreate = 0 ; //<1121> //<1122> if ( ArraySize ( avd_Overlap ) != arv_Chart [ ari_BarsTotal ] ) //<1123> ArrayResize ( avd_Overlap , arv_Chart [ ari_BarsTotal ] ) ; //<1124> //<1125> int ali_Suffix = 0 ; //<1126> int i , N ; N = ali_BarLeft ; //<1127> for ( i = ali_BarRight ; i <= N ; i ++ ) //<1128> { if ( i == 0 ) //<1129> int ali_Time1 = iTime ( avs_Symbol , avi_Period , i ) + avi_Period * 60 ; //<1130> else ali_Time1 = iTime ( avs_Symbol , avi_Period , i - 1 ) ; //<1131> int ali_Time2 = iTime ( avs_Symbol , avi_Period , i ) ; //<1132> double ald_AskHigh = iHigh ( avs_Symbol , avi_Period , i ) + ald_Spread ; //<1133> double ald_AskLow = iLow ( avs_Symbol , avi_Period , i ) + ald_Spread ; //<1134> double ald_BidHigh = iHigh ( avs_Symbol , avi_Period , i ) ; //<1135> double ald_BidLow = iLow ( avs_Symbol , avi_Period , i ) ; //<1136> //<1137> int ali_Index = i - ali_BarRight ; //<1138> avd_Overlap [ ali_Index ] = ald_BidHigh - ald_AskLow ; //<1139> double ald_OverlapBound = arv_Chart [ ari_PriceMax ] - avd_Overlap [ ali_Index ] ; //<1140> //<1141> afr_CreateFrame ( avs_PrefixAskBars + ali_Suffix , aei_ColorAskBars , 1 , //<1142> ali_Time1 , ald_AskHigh , ali_Time2 , ald_AskLow ) ; //<1143> afr_CreateFrame ( avs_PrefixBidBars + ali_Suffix , aei_ColorBidBars , 1 , //<1144> ali_Time1 , ald_BidHigh , ali_Time2 , ald_BidLow ) ; //<1145> afr_CreateFrame ( avs_PrefixOverlap + ali_Suffix , aei_ColorOverlap , 1 , //<1146> ali_Time1 , arv_Chart [ ari_PriceMax ] , ali_Time2 , ald_OverlapBound ) ; //<1147> ali_Suffix ++ ; } //<1148> //<1149> //< Overlap/Volume Labels Computing > //<1150> int ali_OverlapMaxIndex = ArrayMaximum ( avd_Overlap , ali_BarsToCompute , 0 ) ; //<1151> double ald_OverlapMaximum = avd_Overlap [ ali_OverlapMaxIndex ] ; //<1152> //<1153> int ali_VolumeMaxIndex = ArrayMaximum ( Volume , ali_BarsToCompute , ali_BarRight ) ; //<1154> double ald_VolumeMaximum = Volume [ ali_VolumeMaxIndex ] ; //<1155> //<1156> double ald_OverlapAverage = 0 ; //<1157> double ald_VolumeAverage = 0 ; //<1158> for ( i = ali_BarRight ; i <= ali_BarLeft ; i ++ ) //<1159> { ali_Index = i - ali_BarRight ; //<1160> ald_OverlapAverage = ald_OverlapAverage + avd_Overlap [ ali_Index ] ; //<1161> ald_VolumeAverage = ald_VolumeAverage + Volume [ i ] ; } //<1162> ald_OverlapAverage = ald_OverlapAverage / ali_BarsToCompute ; //<1163> ald_VolumeAverage = ald_VolumeAverage / ali_BarsToCompute ; //<1164> //<1165> static int ali_OverlapMaximum ; //<1166> static int ali_OverlapAverage ; //<1167> static int ali_VolumeAverage ; //<1168> static int ali_VolumeMaximum ; //<1169> ali_OverlapMaximum = MathRound ( ald_OverlapMaximum / ald_QuotePoint ) ; //<1170> ali_OverlapAverage = MathRound ( ald_OverlapAverage / ald_QuotePoint ) ; //<1171> ali_VolumeMaximum = ald_VolumeMaximum ; //<1172> ali_VolumeAverage = MathRound ( ald_VolumeAverage ) ; //<1173> //<1174> int ali_LengthZero = TimeCurrent () - iTime ( avs_Symbol , avi_Period , 0 ) ; //<1175> string als_LengthZero = afs_Interval ( ali_LengthZero , 1 ) ; //<1176> string als_CompletenessZero = DoubleToStr ( 100.0 * ali_LengthZero / avi_Period / 60 , 0 ) ; //<1177> //<1178> int ali_OverlapZero = MathRound ( //<1179> ( iHigh ( avs_Symbol , avi_Period , 0 ) - //<1180> iLow ( avs_Symbol , avi_Period , 0 ) - ald_Spread ) //<1181> / ald_QuotePoint ) ; //<1182> //<1183> int ali_VolumeZero = Volume [ 0 ] ; //<1184> //<1185> double ald_TickVolatilityZero = 1.0 * ali_OverlapZero / ali_VolumeZero ; //<1186> string als_TickVolatilityZero = DoubleToStr ( ald_TickVolatilityZero , 4 ) ; //<1187> //<1188> if ( ali_OverlapMaximum <= 0 ) //<1189> double ald_OverlapZeroRelMax = 0 ; //<1190> else ald_OverlapZeroRelMax = 100.0 * ali_OverlapZero / ali_OverlapMaximum ; //<1191> string als_OverlapZeroRelMax = DoubleToStr ( ald_OverlapZeroRelMax , 0 ) ; //<1192> //<1193> if ( ali_OverlapAverage <= 0 ) //<1194> double ald_OverlapZeroRelAv = 0 ; //<1195> else ald_OverlapZeroRelAv = 100.0 * ali_OverlapZero / ali_OverlapAverage ; //<1196> string als_OverlapZeroRelAv = DoubleToStr ( ald_OverlapZeroRelAv , 0 ) ; //<1197> //<1198> if ( ali_VolumeMaximum <= 0 ) //<1199> { double ald_VolumeZeroRelMax = 0 ; //<1200> double ald_TickVolatilityMax = 0 ; } //<1201> else { ald_VolumeZeroRelMax = 100.0 * ali_VolumeZero / ali_VolumeMaximum ; //<1202> ald_TickVolatilityMax = 1.0 * ali_OverlapMaximum / ali_VolumeMaximum ; } //<1203> string als_VolumeZeroRelMax = DoubleToStr ( ald_VolumeZeroRelMax , 0 ) ; //<1204> string als_TickVolatilityMax = DoubleToStr ( ald_TickVolatilityMax , 4 ) ; //<1205> //<1206> if ( ali_VolumeAverage <= 0 ) //<1207> { double ald_VolumeZeroRelAv = 0 ; //<1208> double ald_TickVolatilityAv = 0 ; } //<1209> else { ald_VolumeZeroRelAv = 100.0 * ali_VolumeZero / ali_VolumeAverage ; //<1210> ald_TickVolatilityAv = 1.0 * ali_OverlapAverage / ali_VolumeAverage ; } //<1211> string als_VolumeZeroRelAv = DoubleToStr ( ald_VolumeZeroRelAv , 0 ) ; //<1212> string als_TickVolatilityAv = DoubleToStr ( ald_TickVolatilityAv , 4 ) ; //<1213> //<1214> string als_AverageLabel = ali_OverlapAverage + "/" + //<1215> ali_VolumeAverage + "=" + //<1216> als_TickVolatilityAv ; //<1217> //<1218> string als_MaximumLabel = ali_OverlapMaximum + "/" + //<1219> ali_VolumeMaximum + "=" + //<1220> als_TickVolatilityMax ; //<1221> //<1222> string als_ZeroLabel_1 = als_LengthZero + ": " + //<1223> ali_OverlapZero + "/" + //<1224> ali_VolumeZero + "=" + //<1225> als_TickVolatilityZero ; //<1226> //<1227> string als_ZeroLabel_2 = als_CompletenessZero + "%: " + //<1228> als_OverlapZeroRelAv + "/" + //<1229> als_OverlapZeroRelMax + "%/" + //<1230> als_VolumeZeroRelAv + "/" + //<1231> als_VolumeZeroRelMax + "%" ; //<1232> // //<1233> //<1234> //< Overlap/Volume Label Positioning > //<1235> double ald_MaximumLevel = arv_Chart [ ari_PriceMax ] - ald_OverlapMaximum ; //<1236> double ald_AverageLevel = arv_Chart [ ari_PriceMax ] - ald_OverlapAverage ; //<1237> double ald_AMDistance = ald_MaximumLevel - ald_AverageLevel ; //<1238> //<1239> static double ald_ZeroLevel_1 ; //<1240> ald_ZeroLevel_1 = ald_AverageLevel + ald_AMDistance * 1 / 3 ; //<1241> //<1242> static double ald_ZeroLevel_2 ; //<1243> ald_ZeroLevel_2 = ald_AverageLevel + ald_AMDistance * 2 / 3 ; //<1244> //<1245> if ( arv_Chart [ ari_BarsShift ] > 0 ) //<1246> int ali_Correction = arv_Chart [ ari_BarsShift ] ; //<1247> else ali_Correction = arv_Chart [ ari_BarsTotal ] / ( - 5 ) ; //<1248> int ali_TimeRight = iTime ( avs_Symbol , avi_Period , //<1249> ali_BarRight ) ; //<1250> static int ali_TextTime ; //<1251> ali_TextTime = ali_TimeRight + ali_Correction * avi_Period * 60 / 2 ; //<1252> // //<1253> //<1254> //< Overlap/Volume Labels/Lines Plotting > //<1255> afr_CreateLineH ( avs_OverlapMaximum , aei_ColorOverlapLines , 1 , STYLE_DOT , //<1256> ald_MaximumLevel ) ; //<1257> afr_CreateLineH ( avs_OverlapAverage , aei_ColorOverlapLines , 1 , STYLE_SOLID , //<1258> ald_AverageLevel ) ; //<1259> //<1260> afr_CreateText ( avs_VolatilityAverage , aei_ColorOverlapLabels , aei_SizeOverlapLabel_1 , //<1261> ali_TextTime , ald_AverageLevel , als_AverageLabel ) ; //<1262> afr_CreateText ( avs_VolatilityZero_1 , aei_ColorOverlapLabels , aei_SizeOverlapLabel_2 , //<1263> ali_TextTime , ald_ZeroLevel_1 , als_ZeroLabel_1 ) ; //<1264> afr_CreateText ( avs_VolatilityZero_2 , aei_ColorOverlapLabels , aei_SizeOverlapLabel_3 , //<1265> ali_TextTime , ald_ZeroLevel_2 , als_ZeroLabel_2 ) ; //<1266> afr_CreateText ( avs_VolatilityMaximum , aei_ColorOverlapLabels , aei_SizeOverlapLabel_4 , //<1267> ali_TextTime , ald_MaximumLevel , als_MaximumLabel ) ; //<1268> // //<1269> //<1270> //< Trend Efficiency Computing/Plotting > //<1271> int ali_MaxIndex = iHighest ( avs_Symbol , avi_Period , MODE_HIGH , ali_BarsToCompute , //<1272> ali_BarRight ) ; //<1273> int ali_MinIndex = iLowest ( avs_Symbol , avi_Period , MODE_LOW , ali_BarsToCompute , //<1274> ali_BarRight ) ; //<1275> int ali_IndexShift = MathAbs ( ali_MaxIndex - ali_MinIndex ) / 3 ; //<1276> //<1277> double ald_MaxPrice = iHigh ( avs_Symbol , avi_Period , ali_MaxIndex ) + ald_Spread ; //<1278> double ald_MinPrice = iLow ( avs_Symbol , avi_Period , ali_MinIndex ) ; //<1279> //<1280> int ali_TimeEfficiencySuper ; //<1281> int ali_TimeEfficiencyMaxMin ; //<1282> int ali_TimeEfficiencyZero ; //<1283> //<1284> int ali_NearestIndex ; //<1285> int ali_FarestIndex ; //<1286> double ald_NearestPrice ; //<1287> double ald_FarestPrice ; //<1288> //<1289> if ( ali_MaxIndex > ali_MinIndex ) //<1290> { //<1291> ali_NearestIndex = ali_MinIndex ; //<1292> ali_FarestIndex = ali_MaxIndex ; //<1293> ald_NearestPrice = ald_MinPrice ; //<1294> ald_FarestPrice = ald_MaxPrice ; //<1295> ali_TimeEfficiencySuper = iTime ( avs_Symbol , avi_Period , //<1296> ali_MinIndex + ali_IndexShift * 2 ) ; //<1297> ali_TimeEfficiencyMaxMin = iTime ( avs_Symbol , avi_Period , //<1298> ali_MinIndex + ali_IndexShift ) ; //<1299> ali_TimeEfficiencyZero = iTime ( avs_Symbol , avi_Period , ali_MinIndex ) ; } //<1300> else { //<1301> ali_NearestIndex = ali_MaxIndex ; //<1302> ali_FarestIndex = ali_MinIndex ; //<1303> ald_NearestPrice = ald_MaxPrice ; //<1304> ald_FarestPrice = ald_MinPrice ; //<1305> ali_TimeEfficiencySuper = iTime ( avs_Symbol , avi_Period , //<1306> ali_MaxIndex + ali_IndexShift * 2 ) ; //<1307> ali_TimeEfficiencyMaxMin = iTime ( avs_Symbol , avi_Period , //<1308> ali_MaxIndex + ali_IndexShift ) ; //<1309> ali_TimeEfficiencyZero = iTime ( avs_Symbol , avi_Period , ali_MaxIndex ) ; } //<1310> //<1311> double ald_TrendMaxMin = ald_MaxPrice - ald_MinPrice ; //<1312> double ald_TrendSuper = MathAbs ( ald_FarestPrice - ald_AveragePrice ) ; //<1313> double ald_TrendZero = MathAbs ( ald_NearestPrice - ald_AveragePrice ) ; //<1314> //<1315> double ald_EfficiencySuper = 0 ; //<1316> for ( i = ali_BarRight ; i <= ali_FarestIndex ; i ++ ) //<1317> { ali_Index = i - ali_BarRight ; //<1318> ald_EfficiencySuper = ald_EfficiencySuper + avd_Overlap [ ali_Index ] ; } //<1319> int ali_EfficiencySuper = MathRound ( ald_EfficiencySuper / ald_QuotePoint ) ; //<1320> //<1321> double ald_EfficiencyMaxMin = 0 ; //<1322> for ( i = ali_NearestIndex ; i <= ali_FarestIndex ; i ++ ) //<1323> { ali_Index = i - ali_BarRight ; //<1324> ald_EfficiencyMaxMin = ald_EfficiencyMaxMin + avd_Overlap [ ali_Index ] ; } //<1325> int ali_EfficiencyMaxMin = MathRound ( ald_EfficiencyMaxMin / ald_QuotePoint ) ; //<1326> //<1327> double ald_EfficiencyZero = 0 ; //<1328> for ( i = ali_BarRight ; i <= ali_NearestIndex ; i ++ ) //<1329> { ali_Index = i - ali_BarRight ; //<1330> ald_EfficiencyZero = ald_EfficiencyZero + avd_Overlap [ ali_Index ] ; } //<1331> int ali_EfficiencyZero = MathRound ( ald_EfficiencyZero / ald_QuotePoint ) ; //<1332> //<1333> string als_LabelEfficiencySuper ; //<1334> string als_LabelEfficiencyMaxMin ; //<1335> string als_LabelEfficiencyZero ; //<1336> //<1337> if ( ald_EfficiencySuper > 0 ) //<1338> als_LabelEfficiencySuper = ali_EfficiencySuper + "*" + //<1339> DoubleToStr ( 100 * ald_TrendSuper / //<1340> ald_EfficiencySuper , 2 ) + "%" ; //<1341> else als_LabelEfficiencySuper = "" ; //<1342> //<1343> if ( ald_EfficiencyMaxMin > 0 ) //<1344> als_LabelEfficiencyMaxMin = ali_EfficiencyMaxMin + "*" + //<1345> DoubleToStr ( 100 * ald_TrendMaxMin / //<1346> ald_EfficiencyMaxMin , 2 ) + "%" ; //<1347> else als_LabelEfficiencyMaxMin = "" ; //<1348> //<1349> if ( ald_EfficiencyZero > 0 ) //<1350> als_LabelEfficiencyZero = ali_EfficiencyZero + "*" + //<1351> DoubleToStr ( 100 * ald_TrendZero / //<1352> ald_EfficiencyZero , 2 ) + "%" ; //<1353> else als_LabelEfficiencyZero = "" ; //<1354> //<1355> int ali_EfficiencyFontSize = aei_SizeOverlapLabel_1 ; //<1356> //<1357> afr_CreateText ( avs_EfficiencySuper , aei_ColorOverlapLabels , ali_EfficiencyFontSize , //<1358> ali_TimeEfficiencySuper , ald_AverageLevel , //<1359> als_LabelEfficiencySuper ) ; //<1360> afr_CreateText ( avs_EfficiencyMaxMin , aei_ColorOverlapLabels , ali_EfficiencyFontSize , //<1361> ali_TimeEfficiencyMaxMin , ald_AverageLevel , //<1362> als_LabelEfficiencyMaxMin ) ; //<1363> afr_CreateText ( avs_EfficiencyZero , aei_ColorOverlapLabels , ali_EfficiencyFontSize , //<1364> ali_TimeEfficiencyZero , ald_AverageLevel , //<1365> als_LabelEfficiencyZero ) ; //<1366> // //<1367> //<1368> } // if //<1369> else { ali_Time1 = iTime ( avs_Symbol , avi_Period , 0 ) ; //<1370> ali_Time2 = iTime ( avs_Symbol , avi_Period , 0 ) + avi_Period * 60 ; //<1371> ald_AskHigh = iHigh ( avs_Symbol , avi_Period , 0 ) + ald_Spread ; //<1372> ald_AskLow = iLow ( avs_Symbol , avi_Period , 0 ) + ald_Spread ; //<1373> ald_BidHigh = iHigh ( avs_Symbol , avi_Period , 0 ) ; //<1374> ald_BidLow = iLow ( avs_Symbol , avi_Period , 0 ) ; //<1375> //<1376> avd_Overlap [ 0 ] = ald_BidHigh - ald_AskLow ; //<1377> ald_OverlapBound = arv_Chart [ ari_PriceMax ] - avd_Overlap [ 0 ] ; //<1378> //<1379> ali_LengthZero = TimeCurrent () - iTime ( avs_Symbol , avi_Period , 0 ) ; //<1380> als_LengthZero = afs_Interval ( ali_LengthZero , 1 ) ; //<1381> als_CompletenessZero = DoubleToStr ( 100.0 * ali_LengthZero / avi_Period / 60 , 0 ) ; //<1382> //<1383> ali_OverlapZero = MathRound ( //<1384> ( iHigh ( avs_Symbol , avi_Period , 0 ) - //<1385> iLow ( avs_Symbol , avi_Period , 0 ) - ald_Spread ) //<1386> / ald_QuotePoint ) ; //<1387> //<1388> ali_VolumeZero = Volume [ 0 ] ; //<1389> //<1390> ald_TickVolatilityZero = 1.0 * ali_OverlapZero / ali_VolumeZero ; //<1391> als_TickVolatilityZero = DoubleToStr ( ald_TickVolatilityZero , 4 ) ; //<1392> //<1393> if ( ali_OverlapMaximum <= 0 ) //<1394> ald_OverlapZeroRelMax = 0 ; //<1395> else ald_OverlapZeroRelMax = 100.0 * ali_OverlapZero / ali_OverlapMaximum ; //<1396> als_OverlapZeroRelMax = DoubleToStr ( ald_OverlapZeroRelMax , 0 ) ; //<1397> //<1398> if ( ali_OverlapAverage <= 0 ) //<1399> ald_OverlapZeroRelAv = 0 ; //<1400> else ald_OverlapZeroRelAv = 100.0 * ali_OverlapZero / ali_OverlapAverage ; //<1401> als_OverlapZeroRelAv = DoubleToStr ( ald_OverlapZeroRelAv , 0 ) ; //<1402> //<1403> if ( ali_VolumeMaximum <= 0 ) //<1404> { ald_VolumeZeroRelMax = 0 ; //<1405> ald_TickVolatilityMax = 0 ; } //<1406> else { ald_VolumeZeroRelMax = 100.0 * ali_VolumeZero / ali_VolumeMaximum ; //<1407> ald_TickVolatilityMax = 1.0 * ali_OverlapMaximum / ali_VolumeMaximum ; } //<1408> als_VolumeZeroRelMax = DoubleToStr ( ald_VolumeZeroRelMax , 0 ) ; //<1409> als_TickVolatilityMax = DoubleToStr ( ald_TickVolatilityMax , 4 ) ; //<1410> //<1411> if ( ali_VolumeAverage <= 0 ) //<1412> { ald_VolumeZeroRelAv = 0 ; //<1413> ald_TickVolatilityAv = 0 ; } //<1414> else { ald_VolumeZeroRelAv = 100.0 * ali_VolumeZero / ali_VolumeAverage ; //<1415> ald_TickVolatilityAv = 1.0 * ali_OverlapAverage / ali_VolumeAverage ; } //<1416> als_VolumeZeroRelAv = DoubleToStr ( ald_VolumeZeroRelAv , 0 ) ; //<1417> als_TickVolatilityAv = DoubleToStr ( ald_TickVolatilityAv , 4 ) ; //<1418> //<1419> als_ZeroLabel_1 = als_LengthZero + ": " + //<1420> ali_OverlapZero + "/" + //<1421> ali_VolumeZero + "=" + //<1422> als_TickVolatilityZero ; //<1423> //<1424> als_ZeroLabel_2 = als_CompletenessZero + "%: " + //<1425> als_OverlapZeroRelAv + "/" + //<1426> als_OverlapZeroRelMax + "%/" + //<1427> als_VolumeZeroRelAv + "/" + //<1428> als_VolumeZeroRelMax + "%" ; //<1429> //<1430> afr_ResetFrame ( avs_PrefixAskBars + 0 , ali_Time1 , ald_AskHigh , //<1431> ali_Time2 , ald_AskLow ) ; //<1432> afr_ResetFrame ( avs_PrefixBidBars + 0 , ali_Time1 , ald_BidHigh , //<1433> ali_Time2 , ald_BidLow ) ; //<1434> afr_ResetFrame ( avs_PrefixOverlap + 0 , ali_Time1 , arv_Chart [ ari_PriceMax ] , //<1435> ali_Time2 , ald_OverlapBound ) ; //<1436> afr_ResetText ( avs_VolatilityZero_1 , aei_ColorOverlapLabels , aei_SizeOverlapLabel_2 , //<1437> ali_TextTime , ald_ZeroLevel_1 , als_ZeroLabel_1 ) ; //<1438> afr_ResetText ( avs_VolatilityZero_2 , aei_ColorOverlapLabels , aei_SizeOverlapLabel_3 , //<1439> ali_TextTime , ald_ZeroLevel_2 , als_ZeroLabel_2 ) ; //<1440> } // else //<1441> } //<1442> //`````````````````````````````````````````````````````````````````````````//<1443> //<1444> //< A_System_Indicator: Function 23 >`````````````````````````````````````````````````````````````````````````//<1445> int afr_PlotSynthFrames () // 60 //<1446> { //<1447> int ali_Synth = avi_SetupSynthSize ; //<1448> //<1449> if ( iBars ( avs_Symbol , ali_Synth ) < 2 ) return ; //<1450> //<1451> if ( avi_FlagSynthFramesCreate == 1 ) //<1452> { avi_FlagSynthFramesCreate = 0 ; //<1453> //<1454> if ( avi_Period <= ali_Synth ) //<1455> { //<1456> double ald_Spread = Ask - Bid ; //<1457> int ali_TimeChartBegin = iTime ( avs_Symbol , avi_Period , arv_Chart [ ari_BarRight ] ) ; //<1458> int ali_TimeChartEnd = iTime ( avs_Symbol , avi_Period , arv_Chart [ ari_BarLeft ] ) ; //<1459> //<1460> if ( ali_TimeChartBegin < iTime ( avs_Symbol , ali_Synth , 0 ) ) //<1461> avi_IndexSynthBegin = iBarShift ( avs_Symbol , ali_Synth , ali_TimeChartBegin ) ; //<1462> else avi_IndexSynthBegin = 0 ; //<1463> //<1464> if ( ali_TimeChartEnd < iTime ( avs_Symbol , ali_Synth , 0 ) ) //<1465> avi_IndexSynthEnd = iBarShift ( avs_Symbol , ali_Synth , ali_TimeChartEnd ) ; //<1466> else avi_IndexSynthEnd = 0 ; //<1467> //<1468> if ( avi_IndexSynthEnd == avi_IndexSynthBegin ) avi_IndexSynthEnd ++ ; //<1469> //<1470> avi_Synths = avi_IndexSynthEnd - avi_IndexSynthBegin + 1 ; //<1471> //<1472> int ali_Suffix = 0 ; //<1473> int i , N ; N = avi_IndexSynthEnd ; //<1474> for ( i = avi_IndexSynthBegin ; i <= N ; i ++ ) //<1475> { if ( i == 0 ) //<1476> int ali_Time1 = iTime ( avs_Symbol , ali_Synth , i ) + ali_Synth * 60 ; //<1477> else ali_Time1 = iTime ( avs_Symbol , ali_Synth , i - 1 ) ; //<1478> int ali_Time2 = iTime ( avs_Symbol , ali_Synth , i ) ; //<1479> double ald_BidHigh = iHigh ( avs_Symbol , ali_Synth , i ) ; //<1480> double ald_BidLow = iLow ( avs_Symbol , ali_Synth , i ) ; //<1481> double ald_AskHigh = ald_BidHigh + ald_Spread ; //<1482> double ald_AskLow = ald_BidLow + ald_Spread ; //<1483> double ald_AverageA = ( ald_AskHigh + ald_AskLow ) / 2 ; //<1484> double ald_AverageB = ( ald_BidHigh + ald_BidLow ) / 2 ; //<1485> double ald_OpenBid = iOpen ( avs_Symbol , ali_Synth , i ) ; //<1486> double ald_CloseBid = iClose ( avs_Symbol , ali_Synth , i ) ; //<1487> double ald_OpenAsk = ald_OpenBid + ald_Spread ; //<1488> double ald_CloseAsk = ald_CloseBid + ald_Spread ; //<1489> //<1490> afr_CreateFrame ( avs_PrefixSynthBars + ali_Suffix , //<1491> aei_ColorSynthBars , 0 , //<1492> ali_Time1 , ald_AskHigh , ali_Time2 , ald_BidLow ) ; //<1493> afr_CreateLineT ( avs_PrefixSynthMeanA + ali_Suffix , //<1494> aei_ColorSynthMeans , 1 , STYLE_DOT , 0 , //<1495> ali_Time1 , ald_AverageA , ali_Time2 , ald_AverageA ) ; //<1496> afr_CreateLineT ( avs_PrefixSynthMeanB + ali_Suffix , //<1497> aei_ColorSynthMeans , 1 , STYLE_DOT , 0 , //<1498> ali_Time1 , ald_AverageB , ali_Time2 , ald_AverageB ) ; //<1499> afr_CreateLineT ( avs_PrefixSynthSlopeA + ali_Suffix , //<1500> aei_ColorSynthSlopes , 1 , STYLE_DASH , 0 , //<1501> ali_Time1 , ald_CloseAsk , ali_Time2 , ald_OpenAsk ) ; //<1502> afr_CreateLineT ( avs_PrefixSynthSlopeB + ali_Suffix , //<1503> aei_ColorSynthSlopes , 1 , STYLE_DASH , 0 , //<1504> ali_Time1 , ald_CloseBid , ali_Time2 , ald_OpenBid ) ; //<1505> ali_Suffix ++ ; } } //<1506> } // if //<1507> } //<1508> //`````````````````````````````````````````````````````````````````````````//<1509> //<1510> //< A_System_Indicator: Function 24 >`````````````````````````````````````````````````````````````````````````//<1511> int afi_Horizon () // 48 //<1512> { //<1513> int ali_Result = EMPTY ; //<1514> //<1515> int ali_TimeEnd ; //<1516> //<1517> int ali_SetupBars = GlobalVariableGet ( avs_SetupHorizonBars ) ; //<1518> int ali_SetupSynths = GlobalVariableGet ( avs_SetupHorizonSynths ) ; //<1519> int ali_SetupDate = GlobalVariableGet ( avs_SetupHorizonDate ) ; //<1520> int ali_SetupHour = GlobalVariableGet ( avs_SetupHorizonHour ) ; //<1521> //<1522> if ( ali_SetupBars > 0 ) //<1523> { if ( ali_SetupBars < arv_Chart [ ari_BarsTotal ] ) //<1524> ali_Result = arv_Chart [ ari_BarRight ] + ali_SetupBars - 1 ; //<1525> else GlobalVariableSet ( avs_SetupHorizonBars , avi_SetupHorizonBars ) ; //<1526> } //<1527> //<1528> if ( ali_SetupSynths > 0 ) //<1529> if ( ali_Result == EMPTY ) //<1530> { ali_TimeEnd = iTime ( avs_Symbol , avi_SetupSynthSize , //<1531> avi_IndexSynthBegin + ali_SetupSynths - 1 ) ; //<1532> //<1533> if ( ali_TimeEnd > arv_Chart [ ari_TimeLeft ] ) //<1534> ali_Result = iBarShift ( avs_Symbol , avi_Period , ali_TimeEnd ) ; //<1535> else GlobalVariableSet ( avs_SetupHorizonSynths , avi_SetupHorizonSynths ) ; //<1536> } //<1537> //<1538> if ( ali_SetupDate > 0 ) //<1539> if ( ali_Result == EMPTY ) //<1540> { int ali_Year = MathFloor ( ali_SetupDate / 10000 ) ; //<1541> int ali_Month = MathFloor ( ( ali_SetupDate - ali_Year * 10000 ) / 100 ) ; //<1542> int ali_Day = MathMod ( ( ali_SetupDate - ali_Year * 10000 ) , 100 ) ; //<1543> int ali_Hour = MathFloor ( ali_SetupHour / 100 ) ; //<1544> int ali_Minute = MathMod ( ali_SetupHour , 100 ) ; //<1545> //<1546> ali_TimeEnd = StrToTime ( ali_Year + "." + ali_Month + "." + ali_Day + " " + //<1547> ali_Hour + ":" + ali_Minute ) ; //<1548> //<1549> if ( ali_TimeEnd < arv_Chart [ ari_TimeRight ] //<1550> && ali_TimeEnd > arv_Chart [ ari_TimeLeft ] ) //<1551> ali_Result = iBarShift ( avs_Symbol , avi_Period , ali_TimeEnd ) ; //<1552> //<1553> else { GlobalVariableSet ( avs_SetupHorizonDate , avi_SetupHorizonDate ) ; //<1554> GlobalVariableSet ( avs_SetupHorizonHour , avi_SetupHorizonHour ) ; } //<1555> } //<1556> //<1557> if ( ali_Result < 2 ) //<1558> ali_Result = arv_Chart [ ari_BarLeft ] ; //<1559> //<1560> return ( ali_Result ) ; //<1561> } //<1562> //`````````````````````````````````````````````````````````````````````````//<1563> //<1564> //----------------------------------------------------------------------------------//<1565> //<1566> //=============================================================================================//<1567>