//< 1. Property 7 >==========================================================================================//< 1> //< 2> #property copyright "Copyright (C) 2009, MetaQuotes Software Corp." //< 3> #property link "http://www.metaquotes.net" //< 4> //< 5> #define A.Property.Series "AIS" //< 6> #define A.Property.Release "50001" //< 7> #define A.Property.Date "2009.04.22" //< 8> #define A.Property.Program "Trade Machine" //< 9> #define A.Property.Programmer "Airat Safin http://www.mql4.com/users/Ais" //< 10> //< 11> //==========================================================================================//< 12> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////< > //< 2. Structure 7 >==========================================================================================//< > //< > //< 2.1. Code 7 >--------------------------------------------------------------------------------------------//< > //< > int init () { A.Main.Initialization () ; } //< > //< > int start () { A.Control.Run () ; //< > A.Process.Run () ; //< > A.Trading.Run () ; //< > A.Monitor.Run () ; //< > } //< > //< > int deinit () { A.Main.Deinitialization () ; } //< > //< > //--------------------------------------------------------------------------------------------//< > //< > //< 2.2. Content >--------------------------------------------------------------------------------------------//< > //< > //< 3. Data > 33 pages contain 295 elements // int 160 / double 48 / string 87 //< > // 3100 Constants 2 pages contain 8 elements // int 4 / double 1 / string 3 //< > // 3200 Externals 5 pages contain 20 elements // int 9 / double 10 / string 1 //< > // 3300 Registers 9 pages contain 117 elements // int 113 / double 2 / string 2 //< > // 3400 Variables 17 pages contain 150 elements // int 34 / double 35 / string 81 //< > // //< > //< > //< 4. Modules > - functions contain - elements // input - / code - / output - //< > // 4100 Main - functions contain - elements // input - / code - / output - //< > // 4200 Control - functions contain - elements // input - / code - / output - //< > // 4300 Process - functions contain - elements // input - / code - / output - //< > // 4400 Trading - functions contain - elements // input - / code - / output - //< > // 4500 Monitor - functions contain - elements // input - / code - / output - //< > // //< > //< > //--------------------------------------------------------------------------------------------//< > //< > //==========================================================================================//< > ////////////////////////////////////////////////////////////////////////////////////////////////////////////////< > //< 3. Data >==========================================================================================//< > //< > //< 3.1. Constants >------------------------------------------------------------------------------------------//< > //< > // 3100 Constants 2 pages contain 8 elements // int 4 / double 1 / string 3 //< > // 3101 System Contstants 4 elements // int 2 / double 1 / string 1 //< > // 3102 Monitoring Panels Constants 4 elements // int 2 / double - / string 2 //< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3101 System Contstants > 4 elements // int 2 / double 1 / string 1 //< > //< > #define aci.ReleaseNumber 50001 //< > //< > #define acd.TrailStepping 1.0 //< > //< > #define aci.TradingPause 5 //< > //< > string acs.Operation [] = { "Buy" , "Sell" } ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3102 Monitoring Panels Constants > 4 elements // int 2 / double - / string 2 //< > //< > #define acs.FontName "Courier New" //< > #define aci.TextLines 48 //< > #define aci.TextColumns 64 //< > #define acs.Blank " " //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //------------------------------------------------------------------------------------------//< > //< > //< 3.2. Externals >------------------------------------------------------------------------------------------//< > //< > // 3200 Externals 5 pages contain 20 elements // int 9 / double 10 / string 1 //< > // 3201 Order ID 1 elements // int 1 / double - / string - //< > // 3202 Master Symbol 1 elements // int - / double - / string 1 //< > // 3203 Risk Management Preset 4 elements // int - / double 4 / string - //< > // 3204 Automatic Trading Preset 10 elements // int 4 / double 6 / string - //< > // 3205 Zone Preset 4 elements // int 4 / double - / string - //< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3201 Order ID > 1 elements // int 1 / double - / string - //< > //< > extern int aei.OrderID = aci.ReleaseNumber ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3202 Master Symbol > 1 elements // int - / double - / string 1 //< > //< > extern string aes.Symbol = "EURUSD" ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3203 Risk Management Preset > 4 elements // int - / double 4 / string - //< > //< > extern double aed.AccountReserve = 0.20 ; double avd.AccountReserve ; //< > extern double aed.OrderReserve = 0.04 ; double avd.OrderReserve ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3204 Automatic Trading Preset > 10 elements // int 4 / double 6 / string - //< > //< > extern int aei.Timeframe.1 = 15 ; int avi.Timeframe.1 ; //< > extern int aei.Timeframe.2 = 1 ; int avi.Timeframe.2 ; //< > //< > extern double aed.Parameter.1 = 1.0 ; double avd.Parameter.1 ; //< > extern double aed.Parameter.2 = 2.0 ; double avd.Parameter.2 ; //< > extern double aed.Parameter.3 = 3.0 ; double avd.Parameter.3 ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3205 Zone Preset > 4 elements // int 4 / double - / string - //< > //< > extern int aei.ZoneBasePoints = 0 ; int avi.ZoneBasePoints ; //< > extern int aei.ZoneStepPoints = 100 ; int avi.ZoneStepPoints ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //------------------------------------------------------------------------------------------//< > //< > //< 3.3. Registers >------------------------------------------------------------------------------------------//< > //< > // 3300 Registers 9 pages contain 117 elements // int 113 / double 2 / string 2 //< > // 3301 Profile Registers 17 elements // int 17 / double - / string - //< > // 3302 Zone Register 31 elements // int 31 / double - / string - //< > // 3303 M1 Register 23 elements // int 23 / double - / string - //< > // 3304 Stream Registers 8 elements // int 8 / double - / string - //< > // 3305 Volume Registers 6 elements // int 6 / double - / string - //< > // 3306 Fluctuation Register 5 elements // int 5 / double - / string - //< > // 3307 Chart Metrics Register 14 elements // int 14 / double - / string - //< > // 3308 Panel Registers 8 elements // int 5 / double 2 / string 1 //< > // 3309 Currency Register 5 elements // int 4 / double - / string 1 //< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3301 Profile Registers > 17 elements // int 17 / double - / string - //< > //< > #define ari.P.TimeBegin 1 //< > #define ari.P.TimeEnd 2 //< > #define ari.P.Frames 3 //< > #define ari.P.Volume 4 //< > #define ari.P.PricePoints 5 //< > #define ari.P.PriceRange 6 //< > #define ari.P.PriceLowest 7 //< > #define ari.P.PriceHighest 8 //< > #define ari.P.MaxRange 9 //< > #define ari.P.MaxVolume 10 //< > #define ari.P.DateMaxRange 11 //< > #define ari.P.DateMaxVolume 12 //< > #define ari.P.Reserved 13 //< > #define ari.P.RegisterDimension 14 //< > //< > int arv.P.1 [ ari.P.RegisterDimension ] ; //< > int arv.P.2 [ ari.P.RegisterDimension ] ; //< > int arv.P.3 [ ari.P.RegisterDimension ] ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3302 Zone Register > 31 elements // int 31 / double - / string - //< > //< > #define ari.Z.BasePoints 1 //< > #define ari.Z.StepPoints 2 //< > #define ari.Z.PriceHighest 3 //< > #define ari.Z.PriceLowest 4 //< > #define ari.Z.IndexShift 5 //< > #define ari.Z.IndexRange 6 //< > #define ari.Z.IndexCurrent 7 //< > #define ari.Z.IndexChartHighest 8 //< > #define ari.Z.IndexChartLowest 9 //< > #define ari.Z.IndexChartRange 10 //< > #define ari.Z.Set 11 //< > #define ari.Z.Reset 12 //< > #define ari.Z.Reserved 13 //< > #define ari.Z.IndexMax.1 14 //< > #define ari.Z.IndexMax.0 15 //< > #define ari.Z.VolumeMax.1 16 //< > #define ari.Z.VolumeMax.0 17 //< > #define ari.Z.VolumeMean.1 18 //< > #define ari.Z.VolumeMean.0 19 //< > #define ari.Z.Volume.1 20 //< > #define ari.Z.Volume.0 21 //< > #define ari.Z.IndexChartMax.1 22 //< > #define ari.Z.IndexChartMax.0 23 //< > #define ari.Z.VolumeChartMax.1 24 //< > #define ari.Z.VolumeChartMax.0 25 //< > #define ari.Z.VolumeChartMean.1 26 //< > #define ari.Z.VolumeChartMean.0 27 //< > #define ari.Z.VolumeChart.1 28 //< > #define ari.Z.VolumeChart.0 29 //< > #define ari.Z.RegisterDimension 30 //< > //< > int arv.Z [ ari.Z.RegisterDimension ] ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3303 M1 Register > 23 elements // int 23 / double - / string - //< > //< > #define ari.1.Period 1 //< > #define ari.1.Length 2 //< > #define ari.1.Volume.0 3 //< > #define ari.1.Volume.1 4 //< > #define ari.1.VolumeLast.0 5 //< > #define ari.1.VolumeLast.1 6 //< > #define ari.1.VolumePack 7 //< > #define ari.1.Time.0 8 //< > #define ari.1.Time.1 9 //< > #define ari.1.TimeLast.0 10 //< > #define ari.1.TimeLast.1 11 //< > #define ari.1.NewFrames 12 //< > #define ari.1.Reserved 13 //< > #define ari.1.Range.0 14 //< > #define ari.1.Range.1 15 //< > #define ari.1.Length.0 16 //< > #define ari.1.Completeness.0 17 //< > #define ari.1.TimeStamp 18 //< > #define ari.1.TimeLatency 19 //< > #define ari.1.Series 20 //< > #define ari.1.Reset 21 //< > #define ari.1.RegisterDimension 22 //< > //< > int arv.1 [ ari.1.RegisterDimension ] ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3304 Stream Registers > 8 elements // int 8 / double - / string - //< > //< > #define ari.S.RegisterDimension 10 //< > //< > int arv.S.Price [ ari.S.RegisterDimension ] ; //< > int arv.S.Volume [ ari.S.RegisterDimension ] ; //< > int arv.S.Latency [ ari.S.RegisterDimension ] ; //< > int arv.S.Fluctuation [ ari.S.RegisterDimension ] ; //< > int arv.S.TotalVolume [ ari.S.RegisterDimension ] ; //< > int arv.S.TotalLatency [ ari.S.RegisterDimension ] ; //< > int arv.S.TotalFluctuation [ ari.S.RegisterDimension ] ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3305 Volume Registers > 6 elements // int 6 / double - / string - //< > //< > #define ari.V.Total 0 //< > #define ari.V.Lost 11 //< > #define ari.V.RegisterDimension 12 //< > //< > int arv.V.Volume [ ari.V.RegisterDimension ] ; //< > int arv.V.Time [ ari.V.RegisterDimension ] ; //< > int arv.V.Latency [ ari.V.RegisterDimension ] ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3306 Fluctuation Register > 5 elements // int 5 / double - / string - //< > //< > #define ari.F.Zero 0 //< > #define ari.F.Up 1 //< > #define ari.F.Down 2 //< > #define ari.F.RegisterDimension 3 //< > //< > int arv.F.Volume [ ari.F.RegisterDimension ] ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3307 Chart Metrics Register > 14 elements // int 14 / double - / string - //< > //< > #define ari.TimeZero 0 //< > #define ari.TimeRight 1 //< > #define ari.TimeLeft 2 //< > #define ari.BarRight 3 //< > #define ari.BarLeft 4 //< > #define ari.BarsTotal 5 //< > #define ari.BarsShift 6 //< > #define ari.Resolution.H 7 //< > #define ari.PriceMax 8 //< > #define ari.PriceMin 9 //< > #define ari.PriceRange 10 //< > #define ari.Resolution.V 11 //< > #define ari.C.RegisterDimension 12 //< > //< > double arv.Chart [ ari.C.RegisterDimension ] ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3308 Panel Registers > 8 elements // int 5 / double 2 / string 1 //< > //< > #define ari.FontSize 1 //< > #define ari.FontColor 2 //< > #define ari.LineSpace 3 //< > #define ari.PositionX 4 //< > #define ari.PositionY 5 //< > //< > string arn.Panel [] = { "Panel." , //< > "FontSize" , //< > "FontColor" , //< > "LineSpace" , //< > "PositionX" , //< > "PositionY" } ; //< > //< > double arv.Panel.1 [] = { 1 , //< > 9 , //< > White , //< > 1.8 , //< > 0 , //< > 0 } ; //< > //< > double arv.Panel.2 [] = { 2 , //< > 9 , //< > White , //< > 1.8 , //< > 70 , //< > 0 } ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3309 Currency Register > 5 elements // int 4 / double - / string 1 //< > //< > #define ari.Account 0 //< > #define ari.Base 1 //< > #define ari.Quote 2 //< > #define ari.Margin 3 //< > //< > string arn.Currency [] = { "" , "" , "" , "" } ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //------------------------------------------------------------------------------------------//< > //< > //< 3.4. Variables >------------------------------------------------------------------------------------------//< > //< > // 3400 Variables 17 pages contain 150 elements // int 34 / double 35 / string 81 //< > // 3401 Trading Strategy Interface 4 elements // int 1 / double 3 / string - //< > // 3402 Market Data 15 elements // int 1 / double 14 / string - //< > // 3403 Risk Management Data 9 elements // int 2 / double 7 / string - //< > // 3404 Capital Management Data 6 elements // int - / double 6 / string - //< > // 3405 System Flags 5 elements // int 5 / double - / string - //< > // 3406 System Time Metrics 5 elements // int 5 / double - / string - //< > // 3407 System Exception Handler 1 elements // int 1 / double - / string - //< > // 3408 System Counters 9 elements // int 9 / double - / string - //< > // 3409 Market Profiles 3 elements // int - / double 3 / string - //< > // 3410 Market Zones 2 elements // int - / double 2 / string - //< > // 3411 Monitoring Controls 10 elements // int 10 / double - / string - //< > // 3412 Monitoring Buffers 4 elements // int - / double - / string 4 //< > // 3413 Reserved 0 elements // int - / double - / string - //< > // 3414 System Messages 5 elements // int - / double - / string 5 //< > // 3415 Stream Lines 4 elements // int - / double - / string 4 //< > // 3416 Setup Menu Names 35 elements // int - / double - / string 35 //< > // 3417 Plotting Names 33 elements // int - / double - / string 33 //< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3401 Trading Strategy Interface > 4 elements // int 1 / double 3 / string - //< > //< > int avi.Command = EMPTY ; //< > double avd.Price = EMPTY ; //< > double avd.Stop = EMPTY ; //< > double avd.Take = EMPTY ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3402 Market Data > 15 elements // int 1 / double 14 / string - //< > //< > double avd.QuoteAsk ; //< > double avd.QuoteBid ; //< > double avd.QuotePoint ; //< > double avd.QuoteSpread ; //< > double avd.QuoteFreeze ; //< > double avd.QuoteStops ; //< > double avd.QuoteTick ; //< > double avd.NominalTick ; //< > double avd.NominalMargin ; //< > double avd.NominalLot ; //< > double avd.MaximumLots ; //< > double avd.MinimumLots ; //< > double avd.LotStep ; //< > int avi.Digits ; //< > double avd.RealSpread ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3403 Risk Management Data > 9 elements // int 2 / double 7 / string - //< > //< > double avd.QuoteTarget ; //< > double avd.QuoteRisk ; //< > double avd.NominalPoint ; //< > int avi.MarginPoints ; //< > int avi.RiskPoints ; //< > double avd.VARLimit ; //< > double avd.RiskPoint ; //< > double avd.MarginLimit ; //< > double avd.SizeLimit ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3404 Capital Management Data > 6 elements // int - / double 6 / string - //< > //< > double avd.Capital ; //< > double avd.PeakTime ; //< > double avd.PeakEquity ; //< > double avd.InitialEquity ; //< > double avd.InitialCapital ; //< > double avd.EquityReserve ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3405 System Flags > 5 elements // int 5 / double - / string - //< > //< > int avi.SystemFlag ; //< > int avi.TradingFlag ; //< > int avi.LiveModeFlag ; //< > int avi.MonitorFlag.1 ; //< > int avi.MonitorFlag.2 ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3406 System Time Metrics > 5 elements // int 5 / double - / string - //< > //< > int avi.TimeStamp ; //< > int avi.TimeStart ; //< > int avi.TimeLastRun ; //< > //< > int avi.ProcessingRunTime ; //< > int avi.MonitoringRunTime ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3407 System Exception Handler > 1 elements // int 1 / double - / string - //< > //< > int avi.Exception ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3408 System Counters > 9 elements // int 9 / double - / string - //< > //< > int avi.Runs ; //< > int avi.BuyTrades ; //< > int avi.SellTrades ; //< > int avi.TotalTrades ; //< > int avi.Trailes ; //< > int avi.AttemptsTrade ; //< > int avi.AttemptsTrail ; //< > int avi.ExcepionsTrade ; //< > int avi.ExcepionsTrail ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3409 Market Profiles > 3 elements // int - / double 3 / string - //< > //< > double avd.Profile.1 [] ; //< > double avd.Profile.2 [] ; //< > double avd.Profile.3 [] ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3410 Market Zones > 2 elements // int - / double 2 / string - //< > //< > double avd.Zone.1 [] ; //< > double avd.Zone.0 [] ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3411 Monitoring Controls > 10 elements // int 10 / double - / string - //< > //< > int avi.OrderSelect = 0 ; //< > //< > int avi.PlotOrderLevels = 1 ; //< > int avi.PlotTimeBorders = 1 ; //< > int avi.PlotZoneLevels = 1 ; //< > int avi.PlotProfiles = 1 ; //< > //< > int avi.FlagOrderLevelsExist ; //< > int avi.FlagTimeBordersExist ; //< > int avi.FlagZoneLevelsExist ; //< > int avi.FlagProfilesExist ; //< > //< > int avi.FlagBackground = 1 ; //< > //< > //< 3411 Monitoring Controls > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3412 Monitoring Buffers > 4 elements // int - / double - / string 4 //< > //< > string avs.TextBuffer.1 [ aci.TextLines ] ; //< > string avs.BufferName.1 [ aci.TextLines ] ; //< > //< > string avs.TextBuffer.2 [ aci.TextLines ] ; //< > string avs.BufferName.2 [ aci.TextLines ] ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3413 Reserved > 0 elements // int - / double - / string - //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3414 System Messages > 5 elements // int - / double - / string 5 //< > //< > string avs.SystemMessage ; //< > string avs.LocalMessage ; //< > string avs.SystemStamp ; //< > string avs.LocalStamp ; //< > //< > string avs.ProcessingMessage ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3415 Stream Lines > 4 elements // int - / double - / string 4 //< > //< > string avs.StreamLine.1 ; //< > string avs.StreamLine.2 ; //< > string avs.StreamLine.3 ; //< > string avs.StreamLine.4 ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3416 Setup Menu Names > 35 elements // int - / double - / string 35 //< > //< > string avs.SetupPrefix ; //< > //< > string avs.SetupBegin ; //< > string avs.SetupEnd ; //< > //< > string avs.SetupAccountReserve ; //< > string avs.SetupOrderReserve ; //< > //< > string avs.SetupTrading ; //< > string avs.SetupTimeframe.1 ; //< > string avs.SetupTimeframe.2 ; //< > string avs.SetupParameter.1 ; //< > string avs.SetupParameter.2 ; //< > string avs.SetupParameter.3 ; //< > //< > string avs.SetupMonitor.1 ; //< > string avs.SetupFontSize.1 ; //< > string avs.SetupFontColor.1 ; //< > string avs.SetupLineSpace.1 ; //< > string avs.SetupPositionX.1 ; //< > string avs.SetupPositionY.1 ; //< > //< > string avs.SetupMonitor.2 ; //< > string avs.SetupFontSize.2 ; //< > string avs.SetupFontColor.2 ; //< > string avs.SetupLineSpace.2 ; //< > string avs.SetupPositionX.2 ; //< > string avs.SetupPositionY.2 ; //< > //< > string avs.SetupOrderSelect ; //< > string avs.SetupPlotOrderLevels ; //< > string avs.SetupPlotTimeBorders ; //< > string avs.SetupPlotZoneLevels ; //< > string avs.SetupPlotProfiles ; //< > //< > string avs.SetupProfileReset ; //< > string avs.SetupZoneReset ; //< > //< > string avs.SetupZoneBasePoints ; //< > string avs.SetupZoneStepPoints ; //< > //< > string avs.SetupCommand ; //< > string avs.SetupTake ; //< > string avs.SetupStop ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 3417 Plotting Names > 33 elements // int - / double - / string 33 //< > //< > string avs.PlotPrefix ; //< > //< > #define acs.OrderPrice "OrderPrice" //< > string avs.OrderPrice ; //< > #define acs.OrderTake "OrderTake" //< > string avs.OrderTake ; //< > #define acs.OrderStop "OrderStop" //< > string avs.OrderStop ; //< > #define acs.OrderPriceID "OrderPriceID" //< > string avs.OrderPriceID ; //< > #define acs.OrderTakeID "OrderTakeID" //< > string avs.OrderTakeID ; //< > #define acs.OrderStopID "OrderStopID" //< > string avs.OrderStopID ; //< > //< > #define acs.TimeBegin.2 "TimeBegin.2." //< > string avs.TimeBegin.2 ; //< > #define acs.TimeBegin.3 "TimeBegin.3." //< > string avs.TimeBegin.3 ; //< > //< > #define acs.ZoneLevels "ZoneLevels" //< > string avs.ZoneLevels ; //< > #define acs.Profile.1 "Profile.1." //< > string avs.Profile.1 ; //< > #define acs.Profile.0 "Profile.0." //< > string avs.Profile.0 ; //< > #define acs.Line.1 "Line.1." //< > string avs.Line.1 ; //< > #define acs.Line.0 "Line.0." //< > string avs.Line.0 ; //< > #define acs.Line.Central "Line.Central" //< > string avs.Line.Central ; //< > #define acs.Line.Average.1 "Line.Average.1" //< > string avs.Line.Average.1 ; //< > #define acs.Line.Average.0 "Line.Average.0" //< > string avs.Line.Average.0 ; //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //------------------------------------------------------------------------------------------//< > //< > //==========================================================================================//< > ////////////////////////////////////////////////////////////////////////////////////////////////////////////////< > //< 4. Modules >==========================================================================================//< > //< > //< 4.1. Main >------------------------------------------------------------------------------------------//< > //< > // 4100 Main 5 functions contain - elements // input 6 / code - / output - //< > // 4101 int A.Main.Initialization - elements // input - / code - / output - //< > // 4102 int A.Main.Deinitialization 7 elements // input - / code 7 / output - //< > // 4103 int afr.CurrencyDetector 24 elements // input 2 / code 22 / output - //< > // 4104 string afs.Interval 9 elements // input 2 / code 7 / output - //< > // 4105 string afs.Time 8 elements // input 2 / code 6 / output - //< > //< > //< 4101 Main Module >````````````````````````````````````````````````````````````````````````````````````````//< > //< > int A.Main.Initialization () // - elements // input - / code - / output - //< > { //< > //< > A.Main.Initialization.Old () ; //< > } //< > //````````````````````````````````````````````````````````````````````````````````````````//< > //< > //< 4102 Main Module >````````````````````````````````````````````````````````````````````````````````````````//< > //< > int A.Main.Deinitialization () // 7 elements // input - / code 7 / output - //< > { //< > //< 1. Modules Deinitialization 4 > //< > afr.ControlDeinitialization () ; //< > afr.ProcessDeinitialization () ; //< > afr.TradingDeinitialization () ; //< > afr.MonitorDeinitialization () ; //< > // //< > //< > //< 2. Final Alert 3 > //< > Alert ( avs.SystemStamp , ": Stop code=" , UninitializeReason () //< > , "/" , avi.ExcepionsTrade //< > , "/" , avi.ExcepionsTrail ) ; //< > // //< > } //< > //````````````````````````````````````````````````````````````````````````````````````````//< > //< > //< 4103 Main Module >````````````````````````````````````````````````````````````````````````````````````````//< > //< > int afr.CurrencyDetector ( // 24 elements // input 2 / code 22 / output - //< > string aas.Symbol , //< > string& aas.Currency [] ) //< > { //< > aas.Currency [ ari.Account ] = AccountCurrency () ; //< > //< > if ( ( MarketInfo ( aas.Symbol , MODE_PROFITCALCMODE ) == 0 ) //< > && ( MarketInfo ( aas.Symbol , MODE_MARGINCALCMODE ) == 0 ) //< > && ( StringLen ( aas.Symbol ) == 6 ) //< > && ( StringFind ( aas.Symbol , "#" ) == -1 ) //< > && ( StringFind ( aas.Symbol , "@" ) == -1 ) //< > && ( StringFind ( aas.Symbol , "_" ) == -1 ) ) //< > { aas.Currency [ ari.Base ] = StringSubstr ( aas.Symbol , 0 , 3 ) ; //< > aas.Currency [ ari.Quote ] = StringSubstr ( aas.Symbol , 3 , 3 ) ; //< > } //< > else //< > { aas.Currency [ ari.Base ] = aas.Symbol ; //< > aas.Currency [ ari.Quote ] = aas.Currency [ ari.Account ] ; //< > } //< > //< > if ( avd.NominalMargin > 0 ) //< > { if ( AccountLeverage () == MathRound ( avd.NominalLot / avd.NominalMargin ) ) //< > aas.Currency [ ari.Margin ] = aas.Currency [ ari.Account ] ; //< > else aas.Currency [ ari.Margin ] = aas.Currency [ ari.Base ] ; //< > } //< > else //< > { aas.Currency [ ari.Margin ] = "" ; //< > } //< > } //< > //````````````````````````````````````````````````````````````````````````````````````````//< > //< > //< 4104 Main Module >````````````````````````````````````````````````````````````````````````````````````````//< > //< > string afs.Interval ( // 9 elements // input 2 / code 7 / output - //< > int aai.Interval , //< > int aai.Seconds = EMPTY ) //< > { //< > static string als.Result ; //< > //< > static int ali.Interval ; ali.Interval = MathAbs ( aai.Interval ) ; //< > if ( aai.Seconds == EMPTY ) als.Result = TimeToStr ( ali.Interval , TIME_MINUTES ) ; //< > else als.Result = TimeToStr ( ali.Interval , TIME_SECONDS ) ; //< > //< > if ( ali.Interval >= 86400 ) als.Result = ali.Interval / 86400 + " " + als.Result ; //< > else if ( aai.Interval < 0 ) als.Result = "-" + als.Result ; //< > //< > return ( als.Result ) ; //< > } //< > //````````````````````````````````````````````````````````````````````````````````````````//< > //< > //< 4105 Main Module >````````````````````````````````````````````````````````````````````````````````````````//< > //< > string afs.Time ( // 8 elements // input 2 / code 6 / output - //< > int aai.Time , //< > int aai.Seconds = EMPTY ) //< > { //< > static string als.Result ; //< > //< > if ( aai.Seconds == EMPTY ) int ali.Mode = TIME_DATE | TIME_MINUTES ; //< > else if ( aai.Seconds == 1 ) ali.Mode = TIME_DATE | TIME_SECONDS ; //< > else ali.Mode = TIME_SECONDS ; //< > //< > als.Result = TimeToStr ( aai.Time , ali.Mode ) ; //< > //< > return ( als.Result ) ; //< > } //< > //````````````````````````````````````````````````````````````````````````````````````````//< > //< > //------------------------------------------------------------------------------------------//< > //< > //< 4.2. Control >------------------------------------------------------------------------------------------//< > //< > // 4200 Control - functions contain - elements // input - / code - / output - //< > // 4201 - elements // input - / code - / output - //< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 4201 > - elements // int - / double - / string - //< > //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //------------------------------------------------------------------------------------------//< > //< > //< 4.3. Process >------------------------------------------------------------------------------------------//< > // 4300 Process - functions contain - elements // input - / code - / output - //< > // 4301 - elements // input - / code - / output - //< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 4301 > - elements // int - / double - / string - //< > //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //------------------------------------------------------------------------------------------//< > //< > //< 4.4. Trading >------------------------------------------------------------------------------------------//< > //< > // 4400 Trading - functions contain - elements // input - / code - / output - //< > // 4401 - elements // input - / code - / output - //< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 4401 > - elements // int - / double - / string - //< > //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //------------------------------------------------------------------------------------------//< > //< > //< 4.5. Monitor >------------------------------------------------------------------------------------------//< > //< > // 4500 Monitor - functions contain - elements // input - / code - / output - //< > // 4501 - elements // input - / code - / output - //< > //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< 4501 > - elements // int - / double - / string - //< > //< > //< > // //< > //````````````````````````````````````````````````````````````````````````````````````````````````````````````//< > //< > //------------------------------------------------------------------------------------------//< > //< > //==========================================================================================//< > //< 5. Program Initialization 31 >============================================================================//< 502> //< 503> int A.Main.Initialization.Old () //< 504> { //< 505> //< 506> //< 5.1. External Variables Load 9 >``````````````````````````````````````````````````````````````````````````//< 507> //< 508> avd.AccountReserve = aed.AccountReserve ; //< 509> avd.OrderReserve = aed.OrderReserve ; //< 510> //< 511> avi.Timeframe.1 = aei.Timeframe.1 ; //< 512> avi.Timeframe.2 = aei.Timeframe.2 ; //< 513> avd.Parameter.1 = aed.Parameter.1 ; //< 514> avd.Parameter.2 = aed.Parameter.2 ; //< 515> avd.Parameter.3 = aed.Parameter.3 ; //< 516> //< 517> avi.ZoneBasePoints = aei.ZoneBasePoints ; //< 518> avi.ZoneStepPoints = aei.ZoneStepPoints ; //< 519> //< 520> //``````````````````````````````````````````````````````````````````````````//< 521> //< 522> //< 5.2. System Controls Reset 9 >````````````````````````````````````````````````````````````````````````````//< 523> //< 524> avi.TimeStart = TimeLocal () ; //< 525> avi.TimeStamp = TimeLocal () ; //< 526> //< 527> avd.PeakTime = TimeLocal () ; //< 528> avd.PeakEquity = AccountEquity () ; //< 529> avd.InitialEquity = AccountEquity () ; //< 530> avd.InitialCapital = avd.PeakEquity * ( 1 - avd.AccountReserve ) ; //< 531> //< 532> avi.TradingFlag = 1 ; //< 533> avi.MonitorFlag.1 = 1 ; //< 534> avi.MonitorFlag.2 = 1 ; //< 535> //< 536> //````````````````````````````````````````````````````````````````````````````//< 537> //< 538> //< 5.3. System Stamp Reset 3 >```````````````````````````````````````````````````````````````````````````````//< 539> //< 540> avs.SystemStamp = A.Property.Series + //< 541> A.Property.Release + " " + //< 542> A.Property.Program ; //< 543> //< 544> //```````````````````````````````````````````````````````````````````````````````//< 545> //< 546> //< 5.4. First Alert 8 >``````````````````````````````````````````````````````````````````````````````````````//< 547> //< 548> Alert ( avs.SystemStamp , ": Symbol=" , //< 549> aes.Symbol , ", Preset=" , //< 550> avi.Timeframe.1 , "/" , //< 551> avi.Timeframe.2 , "/" , //< 552> DoubleToStr ( avd.Parameter.1 , 1 ) , "/" , //< 553> DoubleToStr ( avd.Parameter.2 , 1 ) , "/" , //< 554> DoubleToStr ( avd.Parameter.3 , 1 ) , " " //< 555> , ", Start code=" , UninitializeReason () ) ; //< 556> //< 557> //``````````````````````````````````````````````````````````````````````````````````````//< 558> //< 559> //< 5.5. .Extra Code Initialization 2 >```````````````````````````````````````````````````````````````````````//< 560> //< 561> afr.ProcessingInitialization () ; //< 562> afr.ControlInitialization () ; //< 563> //< 564> //```````````````````````````````````````````````````````````````````````//< 565> //< 566> } //< 567> //============================================================================//< 568> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////< 569> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////< 592> //< 7. Main Program 207 >=====================================================================================//< 593> //< 594> int A.Process.Run () {} //< 595> int A.Trading.Run () {} //< 595> int A.Monitor.Run () {} //< 595> //< 594> int A.Control.Run () //< 595> { //< 596> //< 597> //< 7.1. System Controls Reset On Enter 75 >``````````````````````````````````````````````````````````````````//< 598> //< 599> //< 7.1.1. Run Mode Detection 1 > //< 600> avi.LiveModeFlag = ! IsTesting () || IsVisualMode () ; //< 601> // //< 602> //< 603> //< 7.1.2. Live Mode Subroutine 23 > //< 604> if ( avi.LiveModeFlag == 1 ) //< 605> { //< 606> if ( ! GlobalVariableCheck ( avs.SetupBegin ) ) //< 607> GlobalVariableSet ( avs.SetupBegin , aci.ReleaseNumber ) ; //< 608> if ( ! GlobalVariableCheck ( avs.SetupAccountReserve ) ) //< 609> GlobalVariableSet ( avs.SetupAccountReserve , avd.AccountReserve ) ; //< 610> if ( ! GlobalVariableCheck ( avs.SetupOrderReserve ) ) //< 611> GlobalVariableSet ( avs.SetupOrderReserve , avd.OrderReserve ) ; //< 612> if ( ! GlobalVariableCheck ( avs.SetupTrading ) ) //< 613> GlobalVariableSet ( avs.SetupTrading , avi.TradingFlag ) ; //< 614> if ( ! GlobalVariableCheck ( avs.SetupTimeframe.1 ) ) //< 615> GlobalVariableSet ( avs.SetupTimeframe.1 , avi.Timeframe.1 ) ; //< 616> if ( ! GlobalVariableCheck ( avs.SetupTimeframe.2 ) ) //< 617> GlobalVariableSet ( avs.SetupTimeframe.2 , avi.Timeframe.2 ) ; //< 618> if ( ! GlobalVariableCheck ( avs.SetupParameter.1 ) ) //< 619> GlobalVariableSet ( avs.SetupParameter.1 , avd.Parameter.1 ) ; //< 620> if ( ! GlobalVariableCheck ( avs.SetupParameter.2 ) ) //< 621> GlobalVariableSet ( avs.SetupParameter.2 , avd.Parameter.2 ) ; //< 622> if ( ! GlobalVariableCheck ( avs.SetupParameter.3 ) ) //< 623> GlobalVariableSet ( avs.SetupParameter.3 , avd.Parameter.3 ) ; //< 624> if ( ! GlobalVariableCheck ( avs.SetupEnd ) ) //< 625> GlobalVariableSet ( avs.SetupEnd , aci.ReleaseNumber ) ; //< 626> } //< 627> // //< 628> //< 629> //< 7.1.3. All Modes Subroutine 8 > //< 630> if ( GlobalVariableGet ( avs.SetupTrading ) == 1 ) //< 631> { avi.SystemFlag = 1 ; //< 632> avi.TradingFlag = 1 ; //< 633> avs.SystemMessage = "Trading is enabled" ; } //< 634> else //< 635> { avi.SystemFlag = 0 ; //< 636> avi.TradingFlag = 0 ; //< 637> avs.SystemMessage = "Trading is disabled" ; } //< 638> // //< 639> //< 640> //< 7.1.4. Live Mode Subroutine 43 > //< 641> if ( avi.LiveModeFlag == 1 ) //< 642> { //< 643> avd.AccountReserve = GlobalVariableGet ( avs.SetupAccountReserve ) ; //< 644> avd.OrderReserve = GlobalVariableGet ( avs.SetupOrderReserve ) ; //< 645> avi.Timeframe.1 = GlobalVariableGet ( avs.SetupTimeframe.1 ) ; //< 646> avi.Timeframe.2 = GlobalVariableGet ( avs.SetupTimeframe.2 ) ; //< 647> avd.Parameter.1 = GlobalVariableGet ( avs.SetupParameter.1 ) ; //< 648> avd.Parameter.2 = GlobalVariableGet ( avs.SetupParameter.2 ) ; //< 649> avd.Parameter.3 = GlobalVariableGet ( avs.SetupParameter.3 ) ; //< 650> //< 651> if ( avi.Timeframe.1 != PERIOD_M1 //< 652> && avi.Timeframe.1 != PERIOD_M5 //< 653> && avi.Timeframe.1 != PERIOD_M15 //< 654> && avi.Timeframe.1 != PERIOD_M30 //< 655> && avi.Timeframe.1 != PERIOD_H1 //< 656> && avi.Timeframe.1 != PERIOD_H4 //< 657> && avi.Timeframe.1 != PERIOD_D1 //< 658> && avi.Timeframe.1 != PERIOD_W1 //< 659> && avi.Timeframe.1 != PERIOD_MN1 ) //< 660> { avi.Timeframe.1 = 0 ; //< 661> avi.SystemFlag = 0 ; //< 662> avi.TradingFlag = 0 ; //< 663> GlobalVariableSet ( avs.SetupTimeframe.1 , avi.Timeframe.1 ) ; //< 664> GlobalVariableSet ( avs.SetupTrading , avi.TradingFlag ) ; //< 665> avs.SystemMessage = "Check Timeframe.1" ; //< 666> Alert ( avs.SystemStamp , ": Symbol=" , //< 667> aes.Symbol , " " , avs.SystemMessage ) ; } //< 668> //< 669> if ( avi.Timeframe.2 != PERIOD_M1 //< 670> && avi.Timeframe.2 != PERIOD_M5 //< 671> && avi.Timeframe.2 != PERIOD_M15 //< 672> && avi.Timeframe.2 != PERIOD_M30 //< 673> && avi.Timeframe.2 != PERIOD_H1 //< 674> && avi.Timeframe.2 != PERIOD_H4 //< 675> && avi.Timeframe.2 != PERIOD_D1 //< 676> && avi.Timeframe.2 != PERIOD_W1 //< 677> && avi.Timeframe.2 != PERIOD_MN1 ) //< 678> { avi.Timeframe.2 = 0 ; //< 679> avi.SystemFlag = 0 ; //< 680> avi.TradingFlag = 0 ; //< 681> GlobalVariableSet ( avs.SetupTimeframe.2 , avi.Timeframe.2 ) ; //< 682> GlobalVariableSet ( avs.SetupTrading , avi.TradingFlag ) ; //< 683> avs.SystemMessage = "Check Timeframe.2" ; //< 684> Alert ( avs.SystemStamp , ": Symbol=" , //< 685> aes.Symbol , " " , avs.SystemMessage ) ; } //< 686> } //< 687> // //< 688> //< 689> //``````````````````````````````````````````````````````````````````//< 690> //< 691> //````````````````````````````````````````````````````````````````````````````//< 692> //< 693> if ( TimeLocal () - avi.TimeStamp < aci.TradingPause ) //< 694> { avs.SystemMessage = "Trading pause " + aci.TradingPause + " seconds" ; avi.SystemFlag = 0 ; } //< 695> //< 696> //````````````````````````````````````````````````````````````````````````````//< 697> //< 698> //< 7.3. Equity Control 6 >```````````````````````````````````````````````````````````````````````````````````//< 699> //< 700> if ( AccountEquity () - avd.PeakEquity > 0 ) //< 701> { avd.PeakEquity = AccountEquity () ; //< 702> avd.PeakTime = TimeLocal () ; } //< 703> //< 704> avd.Capital = avd.PeakEquity * ( 1 - avd.AccountReserve ) ; //< 705> avd.EquityReserve = AccountEquity () - avd.Capital ; //< 706> avd.VARLimit = AccountEquity () * avd.OrderReserve ; //< 707> //< 708> if ( avd.EquityReserve - avd.VARLimit < 0 ) //< 709> { avs.SystemMessage = "System stop" ; avi.SystemFlag = 0 ; } //< 710> //< 711> //```````````````````````````````````````````````````````````````````````````````````//< 712> //< 713> //< 7.4. Data Feed 16 >```````````````````````````````````````````````````````````````````````````````````````//< 714> //< 715> //< 7.4.1. Common Data Feed 15 > //< 716> avd.QuoteAsk = MarketInfo ( aes.Symbol , MODE_ASK ) ; //< 717> avd.QuoteBid = MarketInfo ( aes.Symbol , MODE_BID ) ; //< 718> avd.QuotePoint = MarketInfo ( aes.Symbol , MODE_POINT ) ; //< 719> avd.QuoteSpread = MarketInfo ( aes.Symbol , MODE_SPREAD ) * avd.QuotePoint ; //< 720> avd.QuoteFreeze = MarketInfo ( aes.Symbol , MODE_FREEZELEVEL ) * avd.QuotePoint ; //< 721> avd.QuoteStops = MarketInfo ( aes.Symbol , MODE_STOPLEVEL ) * avd.QuotePoint ; //< 722> avd.QuoteTick = MarketInfo ( aes.Symbol , MODE_TICKSIZE ) ; //< 723> avd.NominalTick = MarketInfo ( aes.Symbol , MODE_TICKVALUE ) ; //< 724> avd.NominalMargin = MarketInfo ( aes.Symbol , MODE_MARGINREQUIRED ) ; //< 725> avd.NominalLot = MarketInfo ( aes.Symbol , MODE_LOTSIZE ) ; //< 726> avd.MaximumLots = MarketInfo ( aes.Symbol , MODE_MAXLOT ) ; //< 727> avd.MinimumLots = MarketInfo ( aes.Symbol , MODE_MINLOT ) ; //< 728> avd.LotStep = MarketInfo ( aes.Symbol , MODE_LOTSTEP ) ; //< 729> avi.Digits = MarketInfo ( aes.Symbol , MODE_DIGITS ) ; //< 730> avd.RealSpread = avd.QuoteAsk - avd.QuoteBid ; //< 731> // //< 732> //< 733> //< 7.4.2. Special Data Processing 1 > //< 734> afr.Processing () ; //< 735> // //< 736> //< 737> //```````````````````````````````````````````````````````````````````````````````````````//< 738> //< 739> //< 7.5. Trading Strategy Interface Reset 4 >`````````````````````````````````````````````````````````````````//< 740> //< 741> avi.Command = EMPTY ; //< 742> avd.Price = EMPTY ; //< 743> avd.Stop = EMPTY ; //< 744> avd.Take = EMPTY ; //< 745> //< 746> //`````````````````````````````````````````````````````````````````//< 747> //< 748> //< 7.6. Position Management Module 38 >``````````````````````````````````````````````````````````````````````//< 749> //< 750> //< 7.6.1. Position Management Module Entry Point 7 > //< 751> if ( avi.SystemFlag == 1 ) //< 752> if ( OrdersTotal () > 0 ) //< 753> //< 754> { int i , N ; N = OrdersTotal () - 1 ; //< 755> for ( i = N ; i >= 0 ; i -- ) //< 756> { OrderSelect ( i , SELECT_BY_POS , MODE_TRADES ) ; //< 757> if ( OrderMagicNumber () != aei.OrderID ) continue ; //< 758> else avi.SystemFlag = 0 ; //< 759> // //< 760> //< 761> //< 7.6.2. Trailing Strategy Module Invocation 1 > //< 762> afr.TrailingStrategy () ; //< 763> // //< 764> //< 765> //< 7.6.3. Order Modify Trading Function 28 > //< 766> if ( avd.Stop > 0 ) //< 767> { int ali.TrailPoints = MathRound ( MathAbs ( OrderStopLoss () - avd.Stop ) //< 768> / avd.QuotePoint ) ; //< 769> if ( ali.TrailPoints >= MarketInfo ( aes.Symbol , MODE_FREEZELEVEL ) ) //< 770> { //< 771> //< Trading Function Execution Sequence > //< 772> //< Step 1 > //< 773> avs.LocalStamp = avs.SystemStamp + ": Attempt to trail " + //< 774> aes.Symbol + " " + //< 775> acs.Operation [ OrderType () ] + " #" + //< 776> OrderMagicNumber () + "/" + //< 777> OrderTicket () ; //< 778> //< Step 2 > //< 779> Alert ( avs.LocalStamp , " +" , //< 780> ali.TrailPoints , " from " , //< 781> DoubleToStr ( OrderStopLoss () , avi.Digits ) , " to " , //< 782> DoubleToStr ( avd.Stop , avi.Digits ) ) ; //< 783> //< Step 3 > //< 784> OrderModify ( OrderTicket () , //< 785> OrderOpenPrice () , //< 786> avd.Stop , //< 787> OrderTakeProfit () , 0 , 0 ) ; //< 788> //< Step 4 > //< 789> avi.TimeStamp = TimeLocal () ; //< 790> //< 791> //< Step 5 > //< 792> avi.Exception = GetLastError () ; //< 793> //< 794> //< Step 6 > //< 795> if ( avi.Exception == 0 ) avs.LocalMessage = " Success " ; //< 796> else avs.LocalMessage = " Failure " + avi.Exception ; //< 797> //< 798> //< Step 7 > //< 799> avi.AttemptsTrail ++ ; //< 800> if ( avi.Exception == 0 ) avi.Trailes ++ ; //< 801> else avi.ExcepionsTrail ++ ; //< 802> //< 803> //< Step 8 > //< 804> Alert ( avs.LocalStamp + avs.LocalMessage ) ; //< 805> //< 806> //< Step 9 > //< 807> avs.SystemMessage = "Trailing Stop" + avs.LocalMessage ; //< 808> //< 809> // //< 810> } // if 7.6.3 //< 811> } // if 7.6.3 //< 812> // //< 813> //< 814> //< 7.6.4. Position Management Module Exit Point 2 > //< 815> } // for 7.6.1 //< 816> } // if 7.6.1 //< 817> // //< 818> //< 819> //``````````````````````````````````````````````````````````````````````//< 820> //< 821> //< 7.7. Trading Strategy Logic 4 >```````````````````````````````````````````````````````````````````````````//< 822> //< 823> //< 7.7.1. Trading Strategy Entry Point 2 > //< 824> if ( avi.SystemFlag == avi.SystemFlag ) //< 825> { //< 826> // //< 827> //< 828> //< 7.7.2. Trading Strategy Module Invocation 1 > //< 829> afr.TradingStrategy () ; //< 830> // //< 831> //< 832> //< 7.7.3. Trading Strategy Exit Point 1 > //< 833> } // if 7.7.1 //< 834> // //< 835> //< 836> //```````````````````````````````````````````````````````````````````````````//< 837> //< 838> //< 7.8. Trading Module 59 >``````````````````````````````````````````````````````````````````````````````````//< 839> //< 840> //< 7.8.1. Trading Module Entry Point 3 > //< 841> if ( avi.Command > EMPTY ) //< 842> if ( IsTradeAllowed () ) //< 843> { //< 844> // //< 845> //< 846> //< 7.8.2. Risk Management 9 > //< 847> avd.QuoteTarget = MathAbs ( avd.Price - avd.Take ) ; //< 848> avd.QuoteRisk = MathAbs ( avd.Price - avd.Stop ) ; //< 849> avd.NominalPoint = avd.NominalTick * avd.QuotePoint / avd.QuoteTick ; //< 850> avi.MarginPoints = MathRound ( avd.NominalMargin / avd.NominalPoint ) ; //< 851> avi.RiskPoints = MathRound ( avd.QuoteRisk / avd.QuotePoint ) ; //< 852> avd.VARLimit = AccountEquity () * avd.OrderReserve ; //< 853> avd.RiskPoint = avd.VARLimit / avi.RiskPoints ; //< 854> avd.MarginLimit = avd.RiskPoint * avi.MarginPoints ; //< 855> avd.SizeLimit = avd.MarginLimit / avd.NominalMargin ; //< 856> // //< 857> //< 858> //< 7.8.3. Operation Size Control 17 > //< 859> if ( avd.SizeLimit >= avd.MinimumLots ) //< 860> { int ali.Steps = MathFloor ( ( avd.SizeLimit - avd.MinimumLots ) //< 861> / avd.LotStep ) ; //< 862> double ald.Size = avd.MinimumLots + avd.LotStep * ali.Steps ; } //< 863> else ald.Size = 0 ; //< 864> //< 865> if ( ald.Size > avd.MaximumLots ) //< 866> ald.Size = avd.MaximumLots ; //< 867> //< 868> if ( ald.Size >= avd.MinimumLots ) //< 869> double ald.MarginCheck = AccountFreeMarginCheck ( aes.Symbol , avi.Command , ald.Size ) ; //< 870> else ald.MarginCheck = EMPTY ; //< 871> //< 872> if ( ald.MarginCheck <= 0 //< 873> || GetLastError () == 134 ) avi.SystemFlag = 0 ; //< 874> else //< 875> { double ald.Margin = AccountFreeMargin () - ald.MarginCheck ; //< 876> double ald.Contract = ald.Size * avd.NominalPoint / avd.QuotePoint ; //< 877> double ald.VAR = avd.QuoteRisk * ald.Contract ; //< 878> double ald.Target = avd.QuoteTarget * ald.Contract ; } //< 879> // //< 880> //< 881> //< 7.8.4. Order Send Trading Function 29 > //< 882> if ( avi.SystemFlag == 1 ) //< 883> { //< 884> //< Trading Function Execution Sequence > //< 885> //< Step 1 > //< 886> avs.LocalStamp = avs.SystemStamp + ": Attempt to " + //< 887> acs.Operation [ avi.Command ] + " " + //< 888> DoubleToStr ( ald.Size , 2 ) + " " + //< 889> aes.Symbol + " at " + //< 890> DoubleToStr ( avd.Price , avi.Digits ) + " sl: " + //< 891> DoubleToStr ( avd.Stop , avi.Digits ) + " tp: " + //< 892> DoubleToStr ( avd.Take , avi.Digits ) + " //" ; //< 893> //< Step 2 > //< 894> Alert ( avs.LocalStamp , " Margin: " , //< 895> DoubleToStr ( ald.Margin , 2 ) , " / VAR: -" , //< 896> DoubleToStr ( ald.VAR , 2 ) , " / Target: " , //< 897> DoubleToStr ( ald.Target , 2 ) ) ; //< 898> //< Step 3 > //< 899> int ali.Ticket = OrderSend ( aes.Symbol , avi.Command , ald.Size , //< 900> avd.Price , 0 , avd.Stop , avd.Take , "" , //< 901> aei.OrderID , 0 , 0 ) ; //< 902> //< Step 4 > //< 903> avi.TimeStamp = TimeLocal () ; //< 904> //< 905> //< Step 5 > //< 906> avi.Exception = GetLastError () ; //< 907> //< 908> //< Step 6 > //< 909> if ( avi.Exception == 0 ) avs.LocalMessage = " Success " + ali.Ticket ; //< 910> else avs.LocalMessage = " Failure " + avi.Exception ; //< 911> //< 912> //< Step 7 > //< 913> avi.AttemptsTrade ++ ; //< 914> if ( avi.Exception == 0 ) //< 915> { if ( avi.Command == OP_BUY ) //< 916> avi.BuyTrades ++ ; //< 917> else avi.SellTrades ++ ; //< 918> avi.TotalTrades ++ ; } //< 919> else avi.ExcepionsTrade ++ ; //< 920> //< 921> //< Step 8 > //< 922> Alert ( avs.LocalStamp + avs.LocalMessage ) ; //< 923> //< 924> //< Step 9 > //< 925> avs.SystemMessage = acs.Operation [ avi.Command ] + avs.LocalMessage ; //< 926> //< 927> // //< 928> } // if 7.8.4 //< 929> // //< 930> //< 931> //< 7.8.5. Trading Module Exit Point 1 > //< 932> } // if 7.8.1 //< 933> // //< 934> //< 935> //``````````````````````````````````````````````````````````````````````````````````//< 936> //< 937> //< 7.9. Monitoring Module 1 >````````````````````````````````````````````````````````````````````````````````//< 938> //< 939> if ( avi.LiveModeFlag == 1 ) afr.Monitoring () ; //< 940> //< 941> //````````````````````````````````````````````````````````````````````````````````//< 942> //< 943> //< 7.10. System Controls Reset On Exit 2 >```````````````````````````````````````````````````````````````````//< 944> //< 945> avi.TimeLastRun = TimeLocal () ; //< 946> avi.Runs ++ ; //< 947> //< 948> //```````````````````````````````````````````````````````````````````//< 949> //< 950> //< 951> avi.Exception = GetLastError () ; if ( avi.Exception != 0 ) Alert ( "avi.Exception: " , avi.Exception ) ; //< 952> //< 953> } //< 954> //=====================================================================================//< 955> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////< 956> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////< 957> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////< 958> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////< 959> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////< 960> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////< 961> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////< 962> //< 8. Extra Code >===========================================================================================//< 963> //< 964> //< A.System.Extra: Structure >-------------------------------------------------------------------------------//< 965> //< 966> //< Processing Module > //< 967> // 1100 Data - pages contain - elements // int - / double - / string - //< 968> // 1200 Functions - methods contain - elements // input - / code - / output - //< 969> // //< 970> //< 971> //< Control Module > //< 972> // 2100 Data 5 pages contain 34 elements // int 8 / double 2 / string 24 //< 973> // 2200 Functions 24 methods contain 449 elements // input 18 / code 431 / output - //< 974> // //< 975> //< 976> //-------------------------------------------------------------------------------//< 977> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////< 978> //< A.System.Extra: Processing Module Structure >-------------------------------------------------------------//< 979> //< 980> //< 1100 Data > - pages contain - elements // int - / double - / string - //< 981> //< 1100 Market Profile - elements // int - / double - / string - //< 982> //< 1100 Profile Registers - elements // int - / double - / string - //< 983> //< 1100 Timeframe Register - elements // int - / double - / string - //< 984> //< 1100 Processing Messages - elements // int - / double - / string - //< 985> //< 1100 Processing Control - elements // int - / double - / string - //< 986> // //< 987> //< 988> //< 1200 Functions > - methods contain - elements // input - / code - / output - //< 989> // 1201 int afr.ProcessingInitialization - elements // input - / code - / output - //< 990> // 1202 int afr.ProcessingDeinitialization - elements // input - / code - / output - //< 991> // 1202 int afr.ResetMarketProfiles - elements // input - / code - / output - //< 992> // 1202 int afr.ResetMarketProfile.3 - elements // input - / code - / output - //< 993> // 1202 int afr.ControlDataIntegrity - elements // input - / code - / output - //< 994> // 1203 int afr.ResetTimeframeRegister - elements // input - / code - / output - //< 995> // 1204 int afr.SetTimeframeRegister - elements // input - / code - / output - //< 996> // 1205 int afr.Processing - elements // input - / code - / output - //< 997> // 1206 int afr.TrailingStrategy 1 elements // input - / code 1 / output - //< 998> // 1207 int afr.TradingStrategy 4 elements // input - / code 4 / output - //< 999> // //<1000> //<1001> //-------------------------------------------------------------//<1002> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////<1003> //< A.System.Extra: Control Module Structure >----------------------------------------------------------------//<1004> //<1005> //< 2100 Data > 5 pages contain 35 elements // int 10 / double 2 / string 23 //<1006> //< 2101 Monitoring Constants 6 elements // int 2 / double - / string 4 //<1007> //< 2102 Monitoring Buffers 4 elements // int - / double - / string 4 //<1008> //< 2103 Monitoring Preset 10 elements // int 7 / double 2 / string 1 //<1009> //< 2104 Monitoring Setup Names 14 elements // int - / double - / string 14 //<1010> //< 2105 Monitoring Setup Data 1 elements // int 1 / double - / string - //<1011> // //<1012> //<1013> //< 2200 Functions > 24 methods contain 450 elements // input 18 / code 432 / output - //<1014> // 2201 int afr.ControlInitialization 3 elements // input - / code 3 / output - //<1015> // 2202 int afr.ControlDeinitialization 3 elements // input - / code 3 / output - //<1016> // 2203 int afr.CreateSetup 47 elements // input - / code 47 / output - //<1017> // 2204 int afr.DeleteSetup 1 elements // input - / code 1 / output - //<1018> // 2205 int afr.ResetSetup 33 elements // input - / code 33 / output - //<1019> // 2206 int afr.Monitoring 21 elements // input - / code 21 / output - //<1020> // 2207 int afr.CreatePanel.1 5 elements // input - / code 5 / output - //<1021> // 2208 int afr.CreatePanel.2 5 elements // input - / code 5 / output - //<1022> // 2209 int afr.DeletePanel.1 3 elements // input - / code 3 / output - //<1023> // 2210 int afr.DeletePanel.2 3 elements // input - / code 3 / output - //<1024> // 2211 int afr.ResetPanel.1 7 elements // input - / code 7 / output - //<1025> // 2212 int afr.ResetPanel.2 7 elements // input - / code 7 / output - //<1026> // 2213 int afr.Reserved 0 elements // input - / code - / output - //<1027> // 2214 int afr.ResetTextLine.1 9 elements // input 1 / code 8 / output - //<1028> // 2215 int afr.ResetTextLine.2 9 elements // input 1 / code 8 / output - //<1029> // 2216 int afr.SetTextLine.1 4 elements // input 1 / code 3 / output - //<1030> // 2217 int afr.SetTextLine.2 4 elements // input 1 / code 3 / output - //<1031> // 2218 int afr.SetText.1 14 elements // input 4 / code 10 / output - //<1032> // 2219 int afr.SetText.2 14 elements // input 4 / code 10 / output - //<1033> // 2220 int afr.Report.1 198 elements // input - / code 198 / output - //<1034> // 2221 int afr.Report.2 25 elements // input - / code 25 / output - //<1035> // 2222 int afs.Time 8 elements // input 2 / code 6 / output - //<1036> // 2223 int afs.Interval 9 elements // input 2 / code 7 / output - //<1037> // 2224 int afr.CurrencyDetector 18 elements // input 2 / code 16 / output - //<1038> // //<1039> //<1040> //----------------------------------------------------------------//<1041> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////<1042> //-----------------------------------------------------------------------//<1043> //<1044> //< A.System.Extra: Control Module Function 1202 >````````````````````````````````````````````````````````````//<1059> int afr.TradingDeinitialization () // 0 elements // input - / code - / output - //<1060> { //<1061> } //<1062> //````````````````````````````````````````````````````````````//<1063> //<1064> //< A.System.Extra: Control Module Function 1201 >````````````````````````````````````````````````````````````//<1045> int afr.ProcessingInitialization () // 4 elements // input - / code 4 / output - //<1046> { //<1047> afr.ResetMarketProfile.1 () ; //<1048> afr.ResetMarketProfile.2 () ; //<1049> afr.ResetMarketProfile.3 () ; //<1050> afr.ResetMarketZones () ; //<1051> afr.ResetRegisterM1 () ; //<1052> afr.ResetRegisterStream () ; //<1053> afr.ResetRegisterVolume () ; //<1054> afr.ResetRegisterFluctuation () ; //<1055> } //<1056> //````````````````````````````````````````````````````````````//<1057> //<1058> //< A.System.Extra: Control Module Function 1202 >````````````````````````````````````````````````````````````//<1059> int afr.ProcessDeinitialization () // 0 elements // input - / code - / output - //<1060> { //<1061> } //<1062> //````````````````````````````````````````````````````````````//<1063> //<1064> //< A.System.Extra: Processing Module Function 1203 >`````````````````````````````````````````````````````````//<1065> int afr.ResetMarketProfile.1 () // - elements // input - / code - / output - //<1066> { //<1067> int ali.Period = PERIOD_M1 ; //<1068> double ald.QuotePoint = MarketInfo ( aes.Symbol , MODE_POINT ) ; //<1069> //<1070> int ali.FileHandle = FileOpen ( aes.Symbol + ".CSV" , FILE_CSV | FILE_READ , ";" ) ; //<1071> arv.P.1 [ ari.P.TimeBegin ] = FileReadNumber ( ali.FileHandle ) ; //<1072> arv.P.1 [ ari.P.TimeEnd ] = FileReadNumber ( ali.FileHandle ) ; //<1073> arv.P.1 [ ari.P.Frames ] = FileReadNumber ( ali.FileHandle ) ; //<1074> arv.P.1 [ ari.P.PricePoints ] = FileReadNumber ( ali.FileHandle ) ; //<1075> arv.P.1 [ ari.P.MaxRange ] = FileReadNumber ( ali.FileHandle ) ; //<1076> arv.P.1 [ ari.P.MaxVolume ] = FileReadNumber ( ali.FileHandle ) ; //<1077> arv.P.1 [ ari.P.DateMaxRange ] = FileReadNumber ( ali.FileHandle ) ; //<1078> arv.P.1 [ ari.P.DateMaxVolume ] = FileReadNumber ( ali.FileHandle ) ; //<1079> arv.P.1 [ ari.P.PriceLowest ] = MathRound ( FileReadNumber ( ali.FileHandle ) / ald.QuotePoint ) ; //<1080> double ald.Volume = FileReadNumber ( ali.FileHandle ) ; //<1081> //<1082> ArrayResize ( avd.Profile.1 , arv.P.1 [ ari.P.PricePoints ] ) ; //<1083> ArrayInitialize ( avd.Profile.1 , 0 ) ; //<1084> //<1085> avd.Profile.1 [ 0 ] = ald.Volume ; //<1086> //<1087> int i , j , N = arv.P.1 [ ari.P.PricePoints ] ; //<1088> for ( i = 1 ; i < N ; i ++ ) //<1089> { //<1090> FileReadNumber ( ali.FileHandle ) ; //<1091> avd.Profile.1 [ i ] = FileReadNumber ( ali.FileHandle ) ; //<1092> ald.Volume = ald.Volume + avd.Profile.1 [ i ] ; //<1093> } //<1094> //<1095> FileClose ( ali.FileHandle ) ; //<1096> //<1097> Alert ( avs.SystemStamp , ": External History Maximal M1 Range = " , arv.P.1 [ ari.P.MaxRange ] , //<1098> " / " , afs.Time ( arv.P.1 [ ari.P.DateMaxRange ] ) ) ; //<1099> Alert ( avs.SystemStamp , ": External History Maximal M1 Volume = " , arv.P.1 [ ari.P.MaxVolume ] , //<1100> " / " , afs.Time ( arv.P.1 [ ari.P.DateMaxVolume ] ) ) ; //<1101> //<1102> arv.P.1 [ ari.P.Volume ] = MathRound ( ald.Volume ) ; //<1103> arv.P.1 [ ari.P.PriceRange ] = arv.P.1 [ ari.P.PricePoints ] - 1 ; //<1104> arv.P.1 [ ari.P.PriceHighest ] = arv.P.1 [ ari.P.PriceLowest ] + arv.P.1 [ ari.P.PriceRange ] ; //<1105> } //<1106> //`````````````````````````````````````````````````````````//<1107> //<1108> //< A.System.Extra: Processing Module Function 1203 >`````````````````````````````````````````````````````````//<1109> int afr.ResetMarketProfile.2 () // - elements // input - / code - / output - //<1110> { //<1111> int ali.Period = PERIOD_M1 ; //<1112> double ald.QuotePoint = MarketInfo ( aes.Symbol , MODE_POINT ) ; //<1113> //<1114> ArrayResize ( avd.Profile.2 , arv.P.1 [ ari.P.PricePoints ] ) ; //<1115> ArrayInitialize ( avd.Profile.2 , 0 ) ; //<1116> //<1117> arv.P.2 [ ari.P.PricePoints ] = arv.P.1 [ ari.P.PricePoints ] ; //<1118> arv.P.2 [ ari.P.PriceRange ] = arv.P.1 [ ari.P.PriceRange ] ; //<1119> arv.P.2 [ ari.P.PriceLowest ] = arv.P.1 [ ari.P.PriceLowest ] ; //<1120> arv.P.2 [ ari.P.PriceHighest ] = arv.P.1 [ ari.P.PriceHighest ] ; //<1121> arv.P.2 [ ari.P.MaxRange ] = 1 ; //<1122> arv.P.2 [ ari.P.MaxVolume ] = 1 ; //<1123> //<1124> int ali.IndexBegin = iBarShift ( aes.Symbol , ali.Period , arv.P.1 [ ari.P.TimeEnd ] ) - 1 ; //<1125> int ali.IndexEnd = 1 ; //<1126> //<1127> if ( iTime ( aes.Symbol , ali.Period , ali.IndexBegin + 2 ) == 0 ) //<1128> ali.IndexEnd = ali.IndexBegin ; //<1129> //<1130> if ( ali.IndexBegin < ali.IndexEnd ) //<1131> ali.IndexBegin = ali.IndexEnd ; //<1132> //<1133> arv.P.2 [ ari.P.TimeBegin ] = iTime ( aes.Symbol , ali.Period , ali.IndexBegin ) ; //<1134> arv.P.2 [ ari.P.TimeEnd ] = iTime ( aes.Symbol , ali.Period , ali.IndexEnd ) ; //<1135> arv.P.2 [ ari.P.Frames ] = ali.IndexBegin - ali.IndexEnd ; //<1136> arv.P.2 [ ari.P.Volume ] = 0 ; //<1137> //<1138> int i , j ; //<1139> for ( i = 1 ; i < arv.P.2 [ ari.P.Frames ] ; i ++ ) //<1140> { //<1141> int ali.IndexHigh = MathRound ( iHigh ( aes.Symbol , ali.Period , i ) / ald.QuotePoint ) //<1142> - arv.P.2 [ ari.P.PriceLowest ] ; //<1143> //<1144> int ali.IndexLow = MathRound ( iLow ( aes.Symbol , ali.Period , i ) / ald.QuotePoint ) //<1145> - arv.P.2 [ ari.P.PriceLowest ] ; //<1146> //<1147> double ald.VolumeFrame = iVolume ( aes.Symbol , ali.Period , i ) ; //<1148> //<1149> arv.P.2 [ ari.P.Volume ] = arv.P.2 [ ari.P.Volume ] + ald.VolumeFrame ; //<1150> //<1151> double ald.VolumePoint = ald.VolumeFrame / ( ali.IndexHigh - ali.IndexLow + 1 ) ; //<1152> //<1153> for ( j = ali.IndexLow ; j <= ali.IndexHigh ; j ++ ) //<1154> avd.Profile.2 [ j ] = avd.Profile.2 [ j ] + ald.VolumePoint ; //<1155> //<1156> int ali.Range = MathRound ( ( iHigh ( aes.Symbol , ali.Period , i ) //<1157> - iLow ( aes.Symbol , ali.Period , i ) ) / ald.QuotePoint ) ; //<1158> //<1159> if ( arv.P.2 [ ari.P.MaxRange ] - ali.Range < 0 ) //<1160> { arv.P.2 [ ari.P.MaxRange ] = ali.Range ; //<1161> arv.P.2 [ ari.P.DateMaxRange ] = iTime ( aes.Symbol , ali.Period , i ) ; //<1162> } //<1163> //<1164> if ( arv.P.2 [ ari.P.MaxVolume ] - ald.VolumeFrame < 0 ) //<1165> { arv.P.2 [ ari.P.MaxVolume ] = ald.VolumeFrame ; //<1166> arv.P.2 [ ari.P.DateMaxVolume ] = iTime ( aes.Symbol , ali.Period , i ) ; //<1167> } //<1168> } //<1169> //<1170> Alert ( avs.SystemStamp , ": Local History Maximal M1 Range = " , arv.P.2 [ ari.P.MaxRange ] , //<1171> " / " , afs.Time ( arv.P.2 [ ari.P.DateMaxRange ] ) ) ; //<1172> Alert ( avs.SystemStamp , ": Local History Maximal M1 Volume = " , arv.P.2 [ ari.P.MaxVolume ] , //<1173> " / " , afs.Time ( arv.P.2 [ ari.P.DateMaxVolume ] ) ) ; //<1174> } //<1175> //`````````````````````````````````````````````````````````//<1176> //<1177> //< A.System.Extra: Processing Module Function 1203 >`````````````````````````````````````````````````````````//<1178> int afr.ResetMarketProfile.3 () // - elements // input - / code - / output - //<1179> { //<1180> int ali.Period = PERIOD_M1 ; //<1181> double ald.QuotePoint = MarketInfo ( aes.Symbol , MODE_POINT ) ; //<1182> //<1183> ArrayResize ( avd.Profile.3 , arv.P.2 [ ari.P.PricePoints ] ) ; //<1184> ArrayInitialize ( avd.Profile.3 , 0 ) ; //<1185> //<1186> arv.P.3 [ ari.P.PricePoints ] = arv.P.2 [ ari.P.PricePoints ] ; //<1187> arv.P.3 [ ari.P.PriceRange ] = arv.P.2 [ ari.P.PriceRange ] ; //<1188> arv.P.3 [ ari.P.PriceLowest ] = arv.P.2 [ ari.P.PriceLowest ] ; //<1189> arv.P.3 [ ari.P.PriceHighest ] = arv.P.2 [ ari.P.PriceHighest ] ; //<1190> arv.P.3 [ ari.P.MaxRange ] = 1 ; //<1191> arv.P.3 [ ari.P.MaxVolume ] = 1 ; //<1192> //<1193> arv.P.3 [ ari.P.TimeBegin ] = iTime ( aes.Symbol , ali.Period , 0 ) ; //<1194> arv.P.3 [ ari.P.TimeEnd ] = iTime ( aes.Symbol , ali.Period , 0 ) ; //<1195> arv.P.3 [ ari.P.Frames ] = 0 ; //<1196> arv.P.3 [ ari.P.Volume ] = 0 ; //<1197> //<1198> static int ali.Resets ; ali.Resets ++ ; //<1199> //<1200> avs.SystemMessage = ": Local History Reset " + ali.Resets ; //<1201> Alert ( avs.SystemStamp , avs.SystemMessage ) ; //<1202> } //<1203> //`````````````````````````````````````````````````````````//<1204> //<1205> //< A.System.Extra: Processing Module Function 1203 >`````````````````````````````````````````````````````````//<1206> int afr.ResetRegisterM1 () // - elements // input - / code - / output - //<1207> { //<1208> int ali.Period = PERIOD_M1 ; //<1209> //<1210> GlobalVariableSet ( avs.SetupProfileReset , EMPTY ) ; //<1211> arv.1 [ ari.1.Reset ] = EMPTY ; //<1212> //<1213> arv.1 [ ari.1.Period ] = ali.Period ; //<1214> arv.1 [ ari.1.Length ] = ali.Period * 60 ; //<1215> //<1216> arv.1 [ ari.1.Volume.0 ] = iVolume ( aes.Symbol , ali.Period , 0 ) ; //<1217> arv.1 [ ari.1.Volume.1 ] = iVolume ( aes.Symbol , ali.Period , 1 ) ; //<1218> arv.1 [ ari.1.VolumeLast.0 ] = iVolume ( aes.Symbol , ali.Period , 0 ) ; //<1219> arv.1 [ ari.1.VolumeLast.1 ] = iVolume ( aes.Symbol , ali.Period , 1 ) ; //<1220> arv.1 [ ari.1.Time.0 ] = iTime ( aes.Symbol , ali.Period , 0 ) ; //<1221> arv.1 [ ari.1.Time.1 ] = iTime ( aes.Symbol , ali.Period , 1 ) ; //<1222> arv.1 [ ari.1.TimeLast.0 ] = iTime ( aes.Symbol , ali.Period , 0 ) ; //<1223> arv.1 [ ari.1.TimeLast.1 ] = iTime ( aes.Symbol , ali.Period , 1 ) ; //<1224> arv.1 [ ari.1.Range.0 ] = 0 ; //<1225> arv.1 [ ari.1.Range.1 ] = 0 ; //<1226> //<1227> arv.1 [ ari.1.TimeStamp ] = GetTickCount () ; //<1228> } //<1229> //`````````````````````````````````````````````````````````//<1230> //<1231> //< A.System.Extra: Processing Module Function 1203 >`````````````````````````````````````````````````````````//<1232> int afr.ResetRegisterStream () // - elements // input - / code - / output - //<1233> { //<1234> double ald.QuoteBid = MarketInfo ( aes.Symbol , MODE_BID ) ; //<1235> double ald.QuotePoint = MarketInfo ( aes.Symbol , MODE_POINT ) ; //<1236> //<1237> arv.S.Price [ 1 ] = MathRound ( ald.QuoteBid / ald.QuotePoint ) ; //<1238> } //<1239> //`````````````````````````````````````````````````````````//<1240> //<1241> //< A.System.Extra: Processing Module Function 1203 >`````````````````````````````````````````````````````````//<1242> int afr.ResetRegisterVolume () // - elements // input - / code - / output - //<1243> { //<1244> for ( int i = 1 ; i < ari.V.RegisterDimension ; i ++ ) //<1245> arv.V.Volume [ i ] = 0 ; //<1246> //<1247> arv.V.Volume [ ari.V.Total ] = arv.1 [ ari.1.Volume.0 ] ; //<1248> arv.V.Volume [ ari.V.Lost ] = arv.1 [ ari.1.Volume.0 ] ; //<1249> arv.V.Time [ ari.V.Total ] = TimeCurrent () ; //<1250> arv.V.Time [ ari.V.Lost ] = TimeCurrent () ; //<1251> } //<1252> //`````````````````````````````````````````````````````````//<1253> //<1254> //< A.System.Extra: Processing Module Function 1203 >`````````````````````````````````````````````````````````//<1255> int afr.ResetRegisterFluctuation () // - elements // input - / code - / output - //<1256> { //<1257> for ( int i = 1 ; i < ari.F.RegisterDimension ; i ++ ) //<1258> arv.F.Volume [ i ] = 0 ; //<1259> } //<1260> //`````````````````````````````````````````````````````````//<1261> //<1262> //< A.System.Extra: Processing Module Function 1204 >`````````````````````````````````````````````````````````//<1263> int afr.SetRegisterM1 () // - elements // input - / code - / output - //<1264> { //<1265> int ali.Period = arv.1 [ ari.1.Period ] ; //<1266> //<1267> //< Begin Of Timeframe Processing > //<1268> arv.1 [ ari.1.Volume.0 ] = iVolume ( aes.Symbol , ali.Period , 0 ) ; //<1269> arv.1 [ ari.1.Volume.1 ] = iVolume ( aes.Symbol , ali.Period , 1 ) ; //<1270> arv.1 [ ari.1.Time.0 ] = iTime ( aes.Symbol , ali.Period , 0 ) ; //<1271> arv.1 [ ari.1.Time.1 ] = iTime ( aes.Symbol , ali.Period , 1 ) ; //<1272> //<1273> arv.1 [ ari.1.Range.0 ] = MathRound ( ( iHigh ( aes.Symbol , ali.Period , 0 ) //<1274> - iLow ( aes.Symbol , ali.Period , 0 ) ) / avd.QuotePoint ) ; //<1275> arv.1 [ ari.1.Range.1 ] = MathRound ( ( iHigh ( aes.Symbol , ali.Period , 1 ) //<1276> - iLow ( aes.Symbol , ali.Period , 1 ) ) / avd.QuotePoint ) ; //<1277> // //<1278> //<1279> //< New Ticks And Frames Detection And Computing > //<1280> int ali.FrameDelay = ( arv.1 [ ari.1.Time.0 ] - arv.1 [ ari.1.TimeLast.0 ] ) / 60 ; //<1281> if ( ali.FrameDelay > 0 ) //<1282> { //<1283> //< New Frames Computing > //<1284> int ali.IndexLast.1 = iBarShift ( aes.Symbol , ali.Period , arv.1 [ ari.1.TimeLast.1 ] , 1 ) ; //<1285> arv.1 [ ari.1.NewFrames ] = ali.IndexLast.1 - 1 ; //<1286> //<1287> int ali.VolumePack = 0 ; //<1288> for ( int i = 1 ; i <= arv.1 [ ari.1.NewFrames ] ; i ++ ) //<1289> ali.VolumePack = ali.VolumePack + iVolume ( aes.Symbol , ali.Period , i ) ; //<1290> //<1291> arv.1 [ ari.1.VolumePack ] = ali.VolumePack - arv.1 [ ari.1.VolumeLast.0 ] //<1292> + arv.1 [ ari.1.Volume.0 ] ; //<1293> // //<1294> } //<1295> else { //<1296> //< New Ticks Computing > //<1297> arv.1 [ ari.1.NewFrames ] = 0 ; //<1298> arv.1 [ ari.1.VolumePack ] = arv.1 [ ari.1.Volume.0 ] - arv.1 [ ari.1.VolumeLast.0 ] ; //<1299> // //<1300> } //<1301> // //<1302> //<1303> //< M1 Series Computing > //<1304> arv.1 [ ari.1.Series ] = 0 ; //<1305> //<1306> for ( i = 1 ; arv.1 [ ari.1.Series ] == 0 ; i ++ ) //<1307> if ( NormalizeDouble ( iHigh ( aes.Symbol , ali.Period , i ) //<1308> + avd.RealSpread - avd.QuoteBid , avi.Digits ) < 0 ) //<1309> arv.1 [ ari.1.Series ] = i ; //<1310> else if ( NormalizeDouble ( iLow ( aes.Symbol , ali.Period , i ) //<1311> - avd.QuoteAsk , avi.Digits ) > 0 ) //<1312> arv.1 [ ari.1.Series ] = -i ; //<1313> else continue ; //<1314> // //<1315> //<1316> //< End Of Timeframe Processing > //<1317> arv.1 [ ari.1.VolumeLast.0 ] = arv.1 [ ari.1.Volume.0 ] ; //<1318> arv.1 [ ari.1.VolumeLast.1 ] = arv.1 [ ari.1.Volume.1 ] ; //<1319> arv.1 [ ari.1.TimeLast.0 ] = iTime ( aes.Symbol , ali.Period , 0 ) ; //<1320> arv.1 [ ari.1.TimeLast.1 ] = iTime ( aes.Symbol , ali.Period , 1 ) ; //<1321> //<1322> arv.1 [ ari.1.Length.0 ] = TimeCurrent () - arv.1 [ ari.1.Time.0 ] ; //<1323> arv.1 [ ari.1.Completeness.0 ] = MathRound ( 100.0 * arv.1 [ ari.1.Length.0 ] / arv.1 [ ari.1.Length ] ) ; //<1324> arv.1 [ ari.1.TimeLatency ] = GetTickCount () - arv.1 [ ari.1.TimeStamp ] ; //<1325> arv.1 [ ari.1.TimeStamp ] = GetTickCount () ; //<1326> // //<1327> } //<1328> //`````````````````````````````````````````````````````````//<1329> //<1330> //< A.System.Extra: Processing Module Function 1204 >`````````````````````````````````````````````````````````//<1331> int afr.SetRegisterStream () // - elements // input - / code - / output - //<1332> { //<1333> arv.S.Price [ 0 ] = MathRound ( avd.QuoteBid / avd.QuotePoint ) ; //<1334> arv.S.Volume [ 0 ] = arv.1 [ ari.1.VolumePack ] ; //<1335> arv.S.Latency [ 0 ] = arv.1 [ ari.1.TimeLatency ] ; //<1336> arv.S.Fluctuation [ 0 ] = arv.S.Price [ 0 ] - arv.S.Price [ 1 ] ; //<1337> arv.S.TotalVolume [ 0 ] = 0 ; //<1338> arv.S.TotalLatency [ 0 ] = 0 ; //<1339> arv.S.TotalFluctuation [ 0 ] = 0 ; //<1340> //<1341> int i , N = ari.S.RegisterDimension - 1 ; //<1342> for ( i = N - 1 ; i >= 0 ; i -- ) //<1343> { //<1344> arv.S.TotalVolume [ 0 ] = arv.S.TotalVolume [ 0 ] + arv.S.Volume [ i ] ; //<1345> arv.S.TotalLatency [ 0 ] = arv.S.TotalLatency [ 0 ] + arv.S.Latency [ i ] ; //<1346> arv.S.TotalFluctuation [ 0 ] = arv.S.TotalFluctuation [ 0 ] + arv.S.Fluctuation [ i ] ; //<1347> } //<1348> //<1349> for ( i = N ; i > 0 ; i -- ) //<1350> { //<1351> arv.S.Price [ i ] = arv.S.Price [ i - 1 ] ; //<1352> arv.S.Volume [ i ] = arv.S.Volume [ i - 1 ] ; //<1353> arv.S.Latency [ i ] = arv.S.Latency [ i - 1 ] ; //<1354> arv.S.Fluctuation [ i ] = arv.S.Fluctuation [ i - 1 ] ; //<1355> arv.S.TotalVolume [ i ] = arv.S.TotalVolume [ i - 1 ] ; //<1356> arv.S.TotalLatency [ i ] = arv.S.TotalLatency [ i - 1 ] ; //<1357> arv.S.TotalFluctuation [ i ] = arv.S.TotalFluctuation [ i - 1 ] ; //<1358> } //<1359> //<1360> //< Fluctuation Sequence Length Computing > //<1361> arv.S.Fluctuation [ 0 ] = 0 ; //<1362> arv.S.TotalFluctuation [ 0 ] = 0 ; //<1363> //<1364> i = 1 ; //<1365> if ( arv.S.Fluctuation [ 1 ] > 0 ) //<1366> while ( arv.S.Fluctuation [ i ] > 0 && i < N ) //<1367> { arv.S.Fluctuation [ 0 ] ++ ; //<1368> i ++ ; //<1369> } //<1370> else while ( arv.S.Fluctuation [ i ] < 0 && i < N ) //<1371> { arv.S.Fluctuation [ 0 ] -- ; //<1372> i ++ ; //<1373> } //<1374> //<1375> i = 1 ; //<1376> if ( arv.S.TotalFluctuation [ 1 ] > 0 ) //<1377> while ( arv.S.TotalFluctuation [ i ] > 0 && i < N ) //<1378> { arv.S.TotalFluctuation [ 0 ] ++ ; //<1379> i ++ ; //<1380> } //<1381> else while ( arv.S.TotalFluctuation [ i ] < 0 && i < N ) //<1382> { arv.S.TotalFluctuation [ 0 ] -- ; //<1383> i ++ ; //<1384> } //<1385> // //<1386> } //<1387> //`````````````````````````````````````````````````````````//<1388> //<1389> //< A.System.Extra: Processing Module Function 1204 >`````````````````````````````````````````````````````````//<1390> int afr.SetRegisterVolume () // - elements // input - / code - / output - //<1391> { //<1392> arv.V.Volume [ ari.V.Total ] = arv.V.Volume [ ari.V.Total ] + arv.1 [ ari.1.VolumePack ] ; //<1393> arv.V.Time [ ari.V.Total ] = TimeCurrent () ; //<1394> //<1395> if ( arv.1 [ ari.1.VolumePack ] >= ari.V.RegisterDimension ) //<1396> { arv.V.Volume [ ari.V.Lost ] = arv.V.Volume [ ari.V.Lost ] + arv.1 [ ari.1.VolumePack ] ; //<1397> arv.V.Time [ ari.V.Lost ] = TimeCurrent () ; //<1398> arv.V.Latency [ ari.V.Lost ] = arv.1 [ ari.1.TimeLatency ] ; //<1399> } //<1400> else for ( int i = 1 ; i < ari.V.RegisterDimension ; i ++ ) //<1401> if ( arv.1 [ ari.1.VolumePack ] == i ) //<1402> { arv.V.Volume [ i ] ++ ; //<1403> arv.V.Time [ i ] = TimeCurrent () ; //<1404> arv.V.Latency [ i ] = arv.1 [ ari.1.TimeLatency ] ; //<1405> break ; //<1406> } //<1407> } //<1408> //`````````````````````````````````````````````````````````//<1409> //<1410> //< A.System.Extra: Processing Module Function 1204 >`````````````````````````````````````````````````````````//<1411> int afr.SetRegisterFluctuation () // - elements // input - / code - / output - //<1412> { //<1413> if ( arv.1 [ ari.1.VolumePack ] < ari.V.RegisterDimension ) //<1414> { if ( arv.S.Fluctuation [ 1 ] > 0 ) //<1415> arv.F.Volume [ ari.F.Up ] = arv.F.Volume [ ari.F.Up ] + arv.1 [ ari.1.VolumePack ] ; //<1416> else if ( arv.S.Fluctuation [ 1 ] < 0 ) //<1417> arv.F.Volume [ ari.F.Down ] = arv.F.Volume [ ari.F.Down ] + arv.1 [ ari.1.VolumePack ] ; //<1418> else //<1419> arv.F.Volume [ ari.F.Zero ] = arv.F.Volume [ ari.F.Zero ] + arv.1 [ ari.1.VolumePack ] ; //<1420> } // else //<1421> } //<1422> //`````````````````````````````````````````````````````````//<1423> //<1424> //< A.System.Extra: Processing Module Function 1203 >`````````````````````````````````````````````````````````//<1425> int afr.SetMarketProfiles () // - elements // input - / code - / output - //<1426> { //<1427> //< Local Variables Declaration > //<1428> int ali.Period = PERIOD_M1 ; //<1429> // //<1430> //<1431> //< Set Profile 3 > //<1432> int i , j , N = arv.1 [ ari.1.NewFrames ] ; //<1433> for ( i = 1 ; i <= N ; i ++ ) //<1434> { //<1435> int ali.IndexHigh = MathRound ( iHigh ( aes.Symbol , ali.Period , i ) / avd.QuotePoint ) //<1436> - arv.P.3 [ ari.P.PriceLowest ] ; //<1437> int ali.IndexLow = MathRound ( iLow ( aes.Symbol , ali.Period , i ) / avd.QuotePoint ) //<1438> - arv.P.3 [ ari.P.PriceLowest ] ; //<1439> double ald.VolumeFrame = iVolume ( aes.Symbol , ali.Period , i ) ; //<1440> //<1441> arv.P.3 [ ari.P.Volume ] = ald.VolumeFrame + arv.P.3 [ ari.P.Volume ] ; //<1442> //<1443> double ald.VolumePoint = ald.VolumeFrame / ( ali.IndexHigh - ali.IndexLow + 1 ) ; //<1444> //<1445> for ( j = ali.IndexLow ; j <= ali.IndexHigh ; j ++ ) //<1446> avd.Profile.3 [ j ] = avd.Profile.3 [ j ] + ald.VolumePoint ; //<1447> //<1448> int ali.Range = MathRound ( ( iHigh ( aes.Symbol , ali.Period , i ) //<1449> - iLow ( aes.Symbol , ali.Period , i ) ) / avd.QuotePoint ) ; //<1450> //<1451> if ( arv.P.3 [ ari.P.MaxRange ] - ali.Range < 0 ) //<1452> { arv.P.3 [ ari.P.MaxRange ] = ali.Range ; //<1453> arv.P.3 [ ari.P.DateMaxRange ] = iTime ( aes.Symbol , ali.Period , i ) ; //<1454> static int ali.MaxRanges ; ali.MaxRanges ++ ; //<1455> Print ( avs.SystemStamp , ": Maximal Range " , ali.MaxRanges , " = " , //<1456> arv.P.3 [ ari.P.MaxRange ] , " / " , //<1457> afs.Time ( arv.P.3 [ ari.P.DateMaxRange ] ) ) ; //<1458> } //<1459> //<1460> if ( arv.P.3 [ ari.P.MaxVolume ] - ald.VolumeFrame < 0 ) //<1461> { arv.P.3 [ ari.P.MaxVolume ] = ald.VolumeFrame ; //<1462> arv.P.3 [ ari.P.DateMaxVolume ] = iTime ( aes.Symbol , ali.Period , i ) ; //<1463> static int ali.MaxVolumes ; ali.MaxVolumes ++ ; //<1464> Print ( avs.SystemStamp , ": Maximal Volume " , ali.MaxVolumes , " = " , //<1465> arv.P.3 [ ari.P.MaxVolume ] , " / " , //<1466> afs.Time ( arv.P.3 [ ari.P.DateMaxVolume ] ) ) ; //<1467> } //<1468> } //<1469> //<1470> arv.P.3 [ ari.P.TimeEnd ] = iTime ( aes.Symbol , ali.Period , 1 ) ; //<1471> arv.P.3 [ ari.P.Frames ] = arv.P.3 [ ari.P.Frames ] + arv.1 [ ari.1.NewFrames ] ; //<1472> // //<1473> } //<1474> //`````````````````````````````````````````````````````````//<1475> //<1476> //< A.System.Extra: Processing Module Function 1203 >`````````````````````````````````````````````````````````//<1477> int afr.ResetMarketZones () // - elements // input - / code - / output - //<1478> { //<1479> //< Zones Preparation > //<1480> double ald.QuotePoint = MarketInfo ( aes.Symbol , MODE_POINT ) ; //<1481> //<1482> if ( avi.ZoneStepPoints < 1 ) //<1483> avi.ZoneStepPoints = MathRound ( 0.001 / ald.QuotePoint ) ; //<1484> //<1485> GlobalVariableSet ( avs.SetupZoneReset , EMPTY ) ; //<1486> //<1487> arv.Z [ ari.Z.Reset ] = EMPTY ; //<1488> arv.Z [ ari.Z.Set ] = 1 ; //<1489> //<1490> arv.Z [ ari.Z.BasePoints ] = avi.ZoneBasePoints ; //<1491> arv.Z [ ari.Z.StepPoints ] = avi.ZoneStepPoints ; //<1492> arv.Z [ ari.Z.PriceHighest ] = arv.P.3 [ ari.P.PriceHighest ] ; //<1493> arv.Z [ ari.Z.PriceLowest ] = arv.P.3 [ ari.P.PriceLowest ] ; //<1494> //<1495> int ali.IndexHighest = MathFloor ( 1.0 //<1496> * ( arv.Z [ ari.Z.PriceHighest ] - arv.Z [ ari.Z.BasePoints ] ) //<1497> / arv.Z [ ari.Z.StepPoints ] ) ; //<1498> //<1499> int ali.IndexLowest = MathFloor ( 1.0 //<1500> * ( arv.Z [ ari.Z.PriceLowest ] - arv.Z [ ari.Z.BasePoints ] ) //<1501> / arv.Z [ ari.Z.StepPoints ] ) ; //<1502> //<1503> arv.Z [ ari.Z.IndexShift ] = ali.IndexLowest ; //<1504> arv.Z [ ari.Z.IndexRange ] = ali.IndexHighest - ali.IndexLowest + 1 ; //<1505> //<1506> ArrayResize ( avd.Zone.0 , arv.Z [ ari.Z.IndexRange ] ) ; //<1507> ArrayResize ( avd.Zone.1 , arv.Z [ ari.Z.IndexRange ] ) ; //<1508> ArrayInitialize ( avd.Zone.0 , 0 ) ; //<1509> ArrayInitialize ( avd.Zone.1 , 0 ) ; //<1510> // //<1511> //<1512> //< Main Processing > //<1513> int ali.PriceShift , ali.PriceRange ; //<1514> //<1515> double ald.Volume.0 = 0 ; //<1516> double ald.Volume.1 = 0 ; //<1517> int i , j , N = arv.Z [ ari.Z.IndexRange ] - 1 ; //<1518> for ( i = 0 ; i <= N ; i ++ ) //<1519> { //<1520> if ( i == 0 ) //<1521> { ali.PriceShift = 0 ; //<1522> //<1523> ali.PriceRange = arv.Z [ ari.Z.BasePoints ] //<1524> + arv.Z [ ari.Z.StepPoints ] * ( arv.Z [ ari.Z.IndexShift ] + 1 ) //<1525> - arv.Z [ ari.Z.PriceLowest ] ; //<1526> } //<1527> else if ( i == N ) //<1528> { ali.PriceShift = arv.Z [ ari.Z.BasePoints ] //<1529> + arv.Z [ ari.Z.StepPoints ] * ( arv.Z [ ari.Z.IndexShift ] + i ) //<1530> - arv.Z [ ari.Z.PriceLowest ] ; //<1531> //<1532> ali.PriceRange = arv.Z [ ari.Z.PriceHighest ] //<1533> - arv.Z [ ari.Z.BasePoints ] //<1534> - arv.Z [ ari.Z.StepPoints ] * ( arv.Z [ ari.Z.IndexShift ] + i ) ; //<1535> } //<1536> else //<1537> { ali.PriceShift = arv.Z [ ari.Z.BasePoints ] //<1538> + arv.Z [ ari.Z.StepPoints ] * ( arv.Z [ ari.Z.IndexShift ] + i ) //<1539> - arv.Z [ ari.Z.PriceLowest ] ; //<1540> //<1541> ali.PriceRange = arv.Z [ ari.Z.StepPoints ] ; //<1542> } //<1543> //<1544> for ( j = 0 ; j < ali.PriceRange ; j ++ ) //<1545> { //<1546> avd.Zone.0 [ i ] = avd.Zone.0 [ i ] + avd.Profile.2 [ ali.PriceShift + j ] ; //<1547> avd.Zone.1 [ i ] = avd.Zone.1 [ i ] + avd.Profile.2 [ ali.PriceShift + j ] //<1548> + avd.Profile.1 [ ali.PriceShift + j ] ; //<1549> } //<1550> //<1551> ald.Volume.0 = ald.Volume.0 + avd.Zone.0 [ i ] ; //<1552> ald.Volume.1 = ald.Volume.1 + avd.Zone.1 [ i ] ; //<1553> } //<1554> // //<1555> //<1556> //< Check Processing > //<1557> double ald.VolumeCheck.0 = 0 ; //<1558> double ald.VolumeCheck.1 = 0 ; //<1559> for ( j = 0 ; j < arv.P.2 [ ari.P.PriceRange ] ; j ++ ) //<1560> { ald.VolumeCheck.0 = ald.VolumeCheck.0 + avd.Profile.2 [ j ] ; //<1561> ald.VolumeCheck.1 = ald.VolumeCheck.1 + avd.Profile.2 [ j ] //<1562> + avd.Profile.1 [ j ] ; //<1563> } //<1564> // //<1565> //<1566> //< Reset Peport > //<1567> static int ali.Resets ; ali.Resets ++ ; //<1568> //<1569> avs.SystemMessage = ": Market Zones Reset " + ali.Resets + " " + //<1570> arv.Z [ ari.Z.BasePoints ] + "/" + //<1571> arv.Z [ ari.Z.StepPoints ] + " " + //<1572> arv.Z [ ari.Z.IndexShift ] + "/" + //<1573> arv.Z [ ari.Z.IndexRange ] + " " + //<1574> DoubleToStr ( ald.Volume.1 , 0 ) + "/" + //<1575> DoubleToStr ( ald.VolumeCheck.1 , 0 ) + " " + //<1576> DoubleToStr ( ald.Volume.0 , 0 ) + "/" + //<1577> DoubleToStr ( ald.VolumeCheck.0 , 0 ) ; //<1578> //<1579> Alert ( avs.SystemStamp , avs.SystemMessage ) ; //<1580> // //<1581> } //<1582> //`````````````````````````````````````````````````````````//<1583> //<1584> //< A.System.Extra: Processing Module Function 1203 >`````````````````````````````````````````````````````````//<1585> int afr.SetMarketZones () // - elements // input - / code - / output - //<1586> { //<1587> //<1588> //< Every Tick Processing > //<1589> arv.Z [ ari.Z.IndexCurrent ] = MathFloor ( ( avd.QuoteBid / avd.QuotePoint - arv.Z [ ari.Z.BasePoints ] ) //<1590> / arv.Z [ ari.Z.StepPoints ] //<1591> - arv.Z [ ari.Z.IndexShift ] ) ; //<1592> // //<1593> //<1594> //< New M1 Frame / Post Reset Processing > //<1595> if ( arv.1 [ ari.1.NewFrames ] > 0 //<1596> || arv.Z [ ari.Z.Set ] == 1 ) //<1597> { arv.Z [ ari.Z.Set ] = 0 ; //<1598> //<1599> //< Clear Profile Plotter > //<1600> afr.DeleteZoneLevels () ; //<1601> afr.DeleteProfiles () ; //<1602> // //<1603> //<1604> //< Chart Price Metrics > //<1605> static int ali.PriceChartMax ; //<1606> static int ali.PriceChartMin ; //<1607> //<1608> static int ali.PriceHighest ; //<1609> static int ali.PriceLowest ; //<1610> //<1611> ali.PriceChartMax = MathRound ( WindowPriceMax () / avd.QuotePoint ) ; //<1612> ali.PriceChartMin = MathRound ( WindowPriceMin () / avd.QuotePoint ) ; //<1613> //<1614> if ( arv.Z [ ari.Z.PriceHighest ] > ali.PriceChartMax ) //<1615> ali.PriceHighest = ali.PriceChartMax ; //<1616> else ali.PriceHighest = arv.Z [ ari.Z.PriceHighest ] ; //<1617> //<1618> if ( arv.Z [ ari.Z.PriceLowest ] < ali.PriceChartMin ) //<1619> ali.PriceLowest = ali.PriceChartMin ; //<1620> else ali.PriceLowest = arv.Z [ ari.Z.PriceLowest ] ; //<1621> //<1622> arv.Z [ ari.Z.IndexChartHighest ] = MathFloor ( ( ali.PriceHighest - arv.Z [ ari.Z.BasePoints ] ) //<1623> / arv.Z [ ari.Z.StepPoints ] ) //<1624> - arv.Z [ ari.Z.IndexShift ] ; //<1625> //<1626> arv.Z [ ari.Z.IndexChartLowest ] = MathFloor ( ( ali.PriceLowest - arv.Z [ ari.Z.BasePoints ] ) //<1627> / arv.Z [ ari.Z.StepPoints ] ) //<1628> - arv.Z [ ari.Z.IndexShift ] ; //<1629> //<1630> arv.Z [ ari.Z.IndexChartRange ] = arv.Z [ ari.Z.IndexChartHighest ] //<1631> - arv.Z [ ari.Z.IndexChartLowest ] + 1 ; //<1632> // //<1633> //<1634> //< Volume Metrics > //<1635> double ald.Volume.1 = 0 ; //<1636> double ald.Volume.0 = 0 ; //<1637> for ( int i = 0 ; i < arv.Z [ ari.Z.IndexRange ] ; i ++ ) //<1638> { //<1639> ald.Volume.1 = ald.Volume.1 + avd.Zone.1 [ i ] ; //<1640> ald.Volume.0 = ald.Volume.0 + avd.Zone.0 [ i ] ; //<1641> } //<1642> arv.Z [ ari.Z.Volume.1 ] = MathRound ( ald.Volume.1 ) ; //<1643> arv.Z [ ari.Z.Volume.0 ] = MathRound ( ald.Volume.0 ) ; //<1644> arv.Z [ ari.Z.VolumeMean.1 ] = MathRound ( ald.Volume.1 / arv.Z [ ari.Z.IndexRange ] ) ; //<1645> arv.Z [ ari.Z.VolumeMean.0 ] = MathRound ( ald.Volume.0 / arv.Z [ ari.Z.IndexRange ] ) ; //<1646> //<1647> ald.Volume.1 = 0 ; //<1648> ald.Volume.0 = 0 ; //<1649> for ( i = arv.Z [ ari.Z.IndexChartLowest ] ; i <= arv.Z [ ari.Z.IndexChartHighest ] ; i ++ ) //<1650> { //<1651> ald.Volume.1 = ald.Volume.1 + avd.Zone.1 [ i ] ; //<1652> ald.Volume.0 = ald.Volume.0 + avd.Zone.0 [ i ] ; //<1653> } //<1654> arv.Z [ ari.Z.VolumeChart.1 ] = MathRound ( ald.Volume.1 ) ; //<1655> arv.Z [ ari.Z.VolumeChart.0 ] = MathRound ( ald.Volume.0 ) ; //<1656> arv.Z [ ari.Z.VolumeChartMean.1 ] = MathRound ( ald.Volume.1 / arv.Z [ ari.Z.IndexChartRange ] ) ; //<1657> arv.Z [ ari.Z.VolumeChartMean.0 ] = MathRound ( ald.Volume.0 / arv.Z [ ari.Z.IndexChartRange ] ) ; //<1658> //<1659> arv.Z [ ari.Z.IndexMax.1 ] = ArrayMaximum ( avd.Zone.1 ) ; //<1660> arv.Z [ ari.Z.IndexMax.0 ] = ArrayMaximum ( avd.Zone.0 ) ; //<1661> arv.Z [ ari.Z.VolumeMax.1 ] = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexMax.1 ] ] ) ; //<1662> arv.Z [ ari.Z.VolumeMax.0 ] = MathRound ( avd.Zone.0 [ arv.Z [ ari.Z.IndexMax.0 ] ] ) ; //<1663> //<1664> arv.Z [ ari.Z.IndexChartMax.1 ] = ArrayMaximum ( avd.Zone.1 , arv.Z [ ari.Z.IndexChartRange ] , //<1665> arv.Z [ ari.Z.IndexChartLowest ] ) ; //<1666> arv.Z [ ari.Z.IndexChartMax.0 ] = ArrayMaximum ( avd.Zone.0 , arv.Z [ ari.Z.IndexChartRange ] , //<1667> arv.Z [ ari.Z.IndexChartLowest ] ) ; //<1668> arv.Z [ ari.Z.VolumeChartMax.1 ] = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexChartMax.1 ] ] ) ; //<1669> arv.Z [ ari.Z.VolumeChartMax.0 ] = MathRound ( avd.Zone.0 [ arv.Z [ ari.Z.IndexChartMax.0 ] ] ) ; //<1670> // //<1671> //<1672> //< Run Profile Plotter > //<1703> if ( avi.PlotZoneLevels > 0 ) //<1704> afr.PlotZoneLevels () ; //<1705> //<1706> if ( avi.PlotProfiles > 0 ) //<1707> afr.PlotProfiles () ; //<1708> // //<1709> } //<1710> // //<1711> } //<1712> //`````````````````````````````````````````````````````````//<1713> //<1714> //< A.System.Extra: Processing Module Function 1206 >`````````````````````````````````````````````````````````//<1715> int afr.Processing () // - elements // input - / code - / output - //<1716> { //<1717> avi.ProcessingRunTime = GetTickCount () ; //<1718> avs.ProcessingMessage = "" ; //<1719> //<1720> afr.ResetSetup () ; //<1721> //<1722> if ( arv.Z [ ari.Z.Reset ] > EMPTY ) //<1723> afr.ResetMarketZones () ; //<1724> //<1725> if ( arv.1 [ ari.1.Reset ] > EMPTY ) //<1726> afr.ProcessingInitialization () ; //<1727> else //<1728> { afr.SetRegisterM1 () ; //<1729> afr.SetRegisterStream () ; //<1730> afr.SetRegisterVolume () ; //<1731> afr.SetRegisterFluctuation () ; //<1732> afr.SetMarketProfiles () ; //<1733> afr.SetMarketZones () ; //<1734> } //<1735> //<1736> avi.ProcessingRunTime = GetTickCount () - avi.ProcessingRunTime ; //<1737> } //<1738> //`````````````````````````````````````````````````````````//<1739> //<1740> //< A.System.Extra: Processing Module Function 1207 >`````````````````````````````````````````````````````````//<1741> int afr.TrailingStrategy () // 1 elements // input - / code 1 / output - //<1742> { //<1743> avd.Stop = EMPTY ; //<1744> } //<1745> //`````````````````````````````````````````````````````````//<1746> //<1747> //< A.System.Extra: Processing Module Function 1208 >`````````````````````````````````````````````````````````//<1748> int afr.TradingStrategy () // 4 elements // input - / code 422 / output - //<1749> { //<1750> //< 17.1. First Run Subroutine 27 >```````````````````````````````````````````````````````````````````````````//<1751> //<1752> //< 17.7.1. First Run Subroutine Entry Point 1 > //<1753> static int ali.Trigger ; if ( ali.Trigger == 0 ) { ali.Trigger = 1 ; //<1754> // //<1755> //<1756> //< 17.1.2. Constants Declaration 4 > //<1757> static int aci.Buy = 0 ; //<1758> static int aci.Sell = 1 ; //<1759> static int aci.Modify = 6 ; //<1760> static int aci.Close = 7 ; //<1761> // //<1762> //<1763> //< 17.1.3. Variables Declaration 12 > //<1764> //< 17.1.3.1. Control Interface 4 > //<1765> int ali.Command ; //<1766> double ald.Price ; //<1767> double ald.Take ; //<1768> double ald.Stop ; //<1769> // //<1770> //<1771> //< 17.1.3.2. Open Position Data 4 > //<1772> int ali.OrdersTotal ; //<1773> int ali.OrderType ; //<1774> double ald.OrderOpenPrice ; //<1775> double ald.OrderStop ; //<1776> // //<1777> //<1778> //< 17.1.3.3. Position Management Data 6 > //<1779> int ali.EmptyTake ; //<1780> int ali.EmptyStop ; //<1781> //<1782> double ald.DistanceTake ; //<1783> double ald.DistanceStop ; //<1784> //<1785> double ald.NewTake ; //<1786> double ald.NewStop ; //<1787> // //<1788> // //<1789> //<1790> //< 17.1.4. Control Interface Creation 9 > //<1791> //<1792> avs.SetupCommand = avs.SetupPrefix + "8.1." + "Command" ; //<1793> avs.SetupTake = avs.SetupPrefix + "8.2." + "Take" ; //<1794> avs.SetupStop = avs.SetupPrefix + "8.3." + "Stop" ; //<1795> //<1796> GlobalVariableSet ( avs.SetupCommand , EMPTY ) ; //<1797> GlobalVariableSet ( avs.SetupTake , EMPTY ) ; //<1798> GlobalVariableSet ( avs.SetupStop , EMPTY ) ; //<1799> // //<1800> //<1801> //< 17.7.5. First Run Subroutine Exit Point 1 > //<1802> } //<1803> // //<1804> //<1805> //```````````````````````````````````````````````````````````````````````````//<1806> //<1807> //< 17.2. Control Interface Read 15 >`````````````````````````````````````````````````````````````````````````//<1808> if ( GlobalVariableCheck ( avs.SetupCommand ) ) //<1809> ali.Command = GlobalVariableGet ( avs.SetupCommand ) ; //<1810> else { ali.Command = EMPTY ; //<1811> GlobalVariableSet ( avs.SetupCommand , EMPTY ) ; //<1812> } //<1813> //<1814> if ( GlobalVariableCheck ( avs.SetupTake ) ) //<1815> ald.Take = GlobalVariableGet ( avs.SetupTake ) ; //<1816> else { ald.Take = EMPTY ; //<1817> GlobalVariableSet ( avs.SetupTake , EMPTY ) ; //<1818> } //<1819> //<1820> if ( GlobalVariableCheck ( avs.SetupStop ) ) //<1821> ald.Stop = GlobalVariableGet ( avs.SetupStop ) ; //<1822> else { ald.Stop = EMPTY ; //<1823> GlobalVariableSet ( avs.SetupStop , EMPTY ) ; //<1824> } //<1825> //`````````````````````````````````````````````````````````````````````````//<1826> //<1827> //< 17.3. Open Position Analysis 14 >`````````````````````````````````````````````````````````````````````````//<1828> ali.OrderType = EMPTY ; //<1829> ald.OrderOpenPrice = EMPTY ; //<1830> ald.OrderStop = EMPTY ; //<1831> ali.OrdersTotal = OrdersTotal () ; //<1832> //<1833> if ( ali.OrdersTotal > 0 ) //<1834> { //<1835> int i , N ; N = ali.OrdersTotal - 1 ; //<1836> for ( i = N ; i >= 0 ; i -- ) //<1837> { OrderSelect ( i , SELECT_BY_POS , MODE_TRADES ) ; //<1838> if ( OrderMagicNumber () != aei.OrderID ) continue ; //<1839> else //<1840> { //<1841> ali.OrderType = OrderType () ; //<1842> ald.OrderOpenPrice = OrderOpenPrice () ; //<1843> ald.OrderStop = OrderStopLoss () ; //<1844> } // else //<1845> } // for //<1846> } // if //<1847> //`````````````````````````````````````````````````````````````````````````//<1848> //<1849> //< 17.4. Control Interface Validation 265 >``````````````````````````````````````````````````````````````````//<1850> //<1851> //< 17.4.1. Validation Flag Declaration 1 > ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` //<1852> int ali.Validation ; //<1853> // ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` //<1854> //<1855> //< 17.4.2. Buy Command Validation 52 > ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` //<1856> //<1857> //< 17.4.2.1. Buy Command Validation Entry Point 5 > //<1858> if ( ali.Command == aci.Buy ) //<1859> { //<1860> Alert ( avs.SystemStamp , //<1861> ": Buy command is detected at Ask price = " , //<1862> DoubleToStr ( avd.QuoteAsk , avi.Digits ) ) ; //<1863> // //<1864> //<1865> //< 17.4.2.2. Command Validation 14 > //<1866> if ( ali.OrdersTotal == 0 ) //<1867> { //<1868> ali.Validation = 1 ; //<1869> ald.Price = NormalizeDouble ( avd.QuoteAsk , avi.Digits ) ; //<1870> ald.Take = NormalizeDouble ( ald.Take , avi.Digits ) ; //<1871> ald.Stop = NormalizeDouble ( ald.Stop , avi.Digits ) ; //<1872> ald.DistanceTake = ald.Take - ald.Price ; //<1873> ald.DistanceStop = ald.Price - avd.QuoteSpread - ald.Stop ; //<1874> } //<1875> else { ali.Validation = 0 ; //<1876> Alert ( avs.SystemStamp , //<1877> ": Buy command is disabled due to open orders detected = " , //<1878> ali.OrdersTotal ) ; //<1879> } //<1880> // //<1881> //<1882> //< 17.4.2.3. Take Price Validation 15 > //<1883> if ( ali.Validation == 1 ) //<1884> if ( avd.QuoteStops - ald.DistanceTake > 0 ) //<1885> { ali.Validation = 0 ; //<1886> Alert ( avs.SystemStamp , //<1887> ": Buy command is disabled due to invalid Take distance = " , //<1888> DoubleToStr ( ald.DistanceTake , avi.Digits ) , //<1889> " / " , //<1890> DoubleToStr ( avd.QuoteStops , avi.Digits ) ) ; //<1891> Alert ( avs.SystemStamp , //<1892> ": Buy command current Take price = " , //<1893> DoubleToStr ( ald.Take , avi.Digits ) ) ; //<1894> Alert ( avs.SystemStamp , //<1895> ": Buy command minimal Take price = " , //<1896> DoubleToStr ( ald.Price + avd.QuoteStops , avi.Digits ) ) ; //<1897> } //<1898> // //<1899> //<1900> //< 17.4.2.4. Stop Price Validation 15 > //<1901> if ( ali.Validation == 1 ) //<1902> if ( avd.QuoteStops - ald.DistanceStop > 0 ) //<1903> { ali.Validation = 0 ; //<1904> Alert ( avs.SystemStamp , //<1905> ": Buy command is disabled due to invalid Stop distance = " , //<1906> DoubleToStr ( ald.DistanceStop , avi.Digits ) , //<1907> " / " , //<1908> DoubleToStr ( avd.QuoteStops , avi.Digits ) ) ; //<1909> Alert ( avs.SystemStamp , //<1910> ": Buy command current Stop price = " , //<1911> DoubleToStr ( ald.Stop , avi.Digits ) ) ; //<1912> Alert ( avs.SystemStamp , //<1913> ": Buy command maximal Stop price = " , //<1914> DoubleToStr ( ald.Price - avd.QuoteSpread - avd.QuoteStops , avi.Digits ) ) ; //<1915> } //<1916> // //<1917> //<1918> //< 17.4.2.5. Buy Command Validation Exit Point 3 > //<1919> if ( ali.Validation == 0 ) //<1920> ali.Command = EMPTY ; //<1921> } //<1922> // //<1923> //<1924> // ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` //<1925> //<1926> //< 17.4.3. Sell Command Validation 52 > ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `//<1927> //<1928> //< 17.4.3.1. Sell Command Validation Entry Point 5 > //<1929> else if ( ali.Command == aci.Sell ) //<1930> { //<1931> Alert ( avs.SystemStamp , //<1932> ": Sell command is detected at Bid price = " , //<1933> DoubleToStr ( avd.QuoteBid , avi.Digits ) ) ; //<1934> // //<1935> //<1936> //< 17.4.3.2. Command Validation 14 > //<1937> if ( ali.OrdersTotal == 0 ) //<1938> { //<1939> ali.Validation = 1 ; //<1940> ald.Price = NormalizeDouble ( avd.QuoteBid , avi.Digits ) ; //<1941> ald.Take = NormalizeDouble ( ald.Take , avi.Digits ) ; //<1942> ald.Stop = NormalizeDouble ( ald.Stop , avi.Digits ) ; //<1943> ald.DistanceTake = ald.Price - ald.Take ; //<1944> ald.DistanceStop = ald.Stop - ald.Price - avd.QuoteSpread ; //<1945> } //<1946> else { ali.Validation = 0 ; //<1947> Alert ( avs.SystemStamp , //<1948> ": Sell command is disabled due to open orders detected = " , //<1949> ali.OrdersTotal ) ; //<1950> } //<1951> // //<1952> //<1953> //< 17.4.3.3. Take Price Validation 15 > //<1954> if ( ali.Validation == 1 ) //<1955> if ( avd.QuoteStops - ald.DistanceTake > 0 ) //<1956> { ali.Validation = 0 ; //<1957> Alert ( avs.SystemStamp , //<1958> ": Sell command is disabled due to invalid Take distance = " , //<1959> DoubleToStr ( ald.DistanceTake , avi.Digits ) , //<1960> " / " , //<1961> DoubleToStr ( avd.QuoteStops , avi.Digits ) ) ; //<1962> Alert ( avs.SystemStamp , //<1963> ": Sell command current Take price = " , //<1964> DoubleToStr ( ald.Take , avi.Digits ) ) ; //<1965> Alert ( avs.SystemStamp , //<1966> ": Sell command maximal Take price = " , //<1967> DoubleToStr ( ald.Price - avd.QuoteStops , avi.Digits ) ) ; //<1968> } //<1969> // //<1970> //<1971> //< 17.4.3.4. Stop Price Validation 15 > //<1972> if ( ali.Validation == 1 ) //<1973> if ( avd.QuoteStops - ald.DistanceStop > 0 ) //<1974> { ali.Validation = 0 ; //<1975> Alert ( avs.SystemStamp , //<1976> ": Sell command is disabled due to invalid Stop distance = " , //<1977> DoubleToStr ( ald.DistanceStop , avi.Digits ) , //<1978> " / " , //<1979> DoubleToStr ( avd.QuoteStops , avi.Digits ) ) ; //<1980> Alert ( avs.SystemStamp , //<1981> ": Sell command current Stop price = " , //<1982> DoubleToStr ( ald.Stop , avi.Digits ) ) ; //<1983> Alert ( avs.SystemStamp , //<1984> ": Sell command minimal Stop price = " , //<1985> DoubleToStr ( ald.Price + avd.QuoteSpread + avd.QuoteStops , avi.Digits ) ) ; //<1986> } //<1987> // //<1988> //<1989> //< 17.4.3.5. Sell Command Validation Exit Point 3 > //<1990> if ( ali.Validation == 0 ) //<1991> ali.Command = EMPTY ; //<1992> } //<1993> // //<1994> //<1995> // ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `//<1996> //<1997> //< 17.4.4. Modify Command Validation 137 > ` `` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `//<1998> //<1999> //< 17.4.4.1. Modify Command Validation Entry Point 6 > //<2000> else if ( ali.Command == aci.Modify ) //<2001> { //<2002> if ( ali.OrdersTotal > 0 ) //<2003> avs.LocalStamp = " for " + acs.Operation [ OrderType () ] + " order" ; //<2004> else avs.LocalStamp = "" ; //<2005> //<2006> Alert ( avs.SystemStamp , ": Modify command is detected" , avs.LocalStamp ) ; //<2007> // //<2008> //<2009> //< 17.4.4.2. Modify Command Validation 35 > //<2010> if ( ali.OrdersTotal > 0 ) //<2011> { ali.Validation = 1 ; //<2012> //<2013> if ( avd.QuoteStops - avd.QuoteFreeze > 0 ) double ald.DistanceModify = avd.QuoteStops ; //<2014> else ald.DistanceModify = avd.QuoteFreeze ; //<2015> //<2016> if ( ald.Take < 0 ) //<2017> { ald.Take = NormalizeDouble ( OrderTakeProfit () , avi.Digits ) ; //<2018> ali.EmptyTake = 1 ; //<2019> } //<2020> else //<2021> { ali.EmptyTake = 0 ; //<2022> ald.Take = NormalizeDouble ( ald.Take , avi.Digits ) ; //<2023> } //<2024> //<2025> if ( ald.Stop < 0 ) //<2026> { ald.Stop = NormalizeDouble ( OrderStopLoss () , avi.Digits ) ; //<2027> ali.EmptyStop = 1 ; //<2028> } //<2029> else //<2030> { ali.EmptyStop = 0 ; //<2031> ald.Stop = NormalizeDouble ( ald.Stop , avi.Digits ) ; //<2032> } //<2033> //<2034> if ( ali.OrderType == aci.Buy ) //<2035> { ald.Price = NormalizeDouble ( avd.QuoteBid , avi.Digits ) ; //<2036> ald.DistanceTake = ald.Take - ald.Price ; //<2037> ald.DistanceStop = ald.Price - ald.Stop ; //<2038> } //<2039> //<2040> if ( ali.OrderType == aci.Sell ) //<2041> { ald.Price = NormalizeDouble ( avd.QuoteAsk , avi.Digits ) ; //<2042> ald.DistanceTake = ald.Price - ald.Take ; //<2043> ald.DistanceStop = ald.Stop - ald.Price ; //<2044> } //<2045> } // if //<2046> else { ali.Validation = 0 ; //<2047> Alert ( avs.SystemStamp , //<2048> ": Modify command is ignored due to empty order list" ) ; //<2049> } // else //<2050> // //<2051> //<2052> //< 17.4.4.3. Empty Levels Validation 15 > //<2053> if ( ali.Validation == 1 ) //<2054> if ( ali.EmptyTake == 1 && ali.EmptyStop == 1 ) //<2055> { //<2056> ali.Validation = 0 ; //<2057> Alert ( avs.SystemStamp , //<2058> ": Modify command is ignored due to empty price levels" ) ; //<2059> } //<2060> //<2061> if ( ali.Validation == 1 ) //<2062> if ( MathRound ( ( ald.Take - OrderTakeProfit () ) / avd.QuotePoint ) == 0 //<2063> && MathRound ( ( ald.Stop - OrderStopLoss () ) / avd.QuotePoint ) == 0 ) //<2064> { //<2065> ali.Validation = 0 ; //<2066> Alert ( avs.SystemStamp , //<2067> ": Modify command is ignored due to unchanged price levels" ) ; //<2068> } //<2069> // //<2070> //<2071> //< 17.4.4.4. Buy Order Take Price Validation 18 > //<2072> if ( ali.Validation == 1 ) //<2073> if ( ali.OrderType == aci.Buy ) //<2074> if ( ald.DistanceModify - ald.DistanceTake > 0 && ali.EmptyTake == 0 ) //<2075> { ali.Validation = 0 ; //<2076> Alert ( avs.SystemStamp , //<2077> ": Modify command is disabled due to invalid Take distance = " , //<2078> DoubleToStr ( ald.DistanceTake , avi.Digits ) , //<2079> " / " , //<2080> DoubleToStr ( ald.DistanceModify , avi.Digits ) ) ; //<2081> Alert ( avs.SystemStamp , //<2082> ": Modify command current Take price = " , //<2083> DoubleToStr ( ald.Take , avi.Digits ) , //<2084> " / Bid price = " , //<2085> DoubleToStr ( ald.Price , avi.Digits ) ) ; //<2086> Alert ( avs.SystemStamp , //<2087> ": Buy order minimal Take price = " , //<2088> DoubleToStr ( ald.Price + ald.DistanceModify , avi.Digits ) ) ; //<2089> } //<2090> //< 17.4.4.4. Buy Order Take Price Validation 18 > //<2091> //<2092> //< 17.4.4.5. Buy Order Stop Price Validation 25 > //<2093> if ( ali.Validation == 1 ) //<2094> if ( ali.OrderType == aci.Buy ) //<2095> if ( ald.DistanceModify - ald.DistanceStop > 0 && ali.EmptyStop == 0 ) //<2096> { ali.Validation = 0 ; //<2097> Alert ( avs.SystemStamp , //<2098> ": Modify command is disabled due to invalid Stop distance = " , //<2099> DoubleToStr ( ald.DistanceStop , avi.Digits ) , //<2100> " / " , //<2101> DoubleToStr ( ald.DistanceModify , avi.Digits ) ) ; //<2102> Alert ( avs.SystemStamp , //<2103> ": Modify command current Stop price = " , //<2104> DoubleToStr ( ald.Stop , avi.Digits ) , //<2105> " / Bid price = " , //<2106> DoubleToStr ( ald.Price , avi.Digits ) ) ; //<2107> Alert ( avs.SystemStamp , //<2108> ": Buy order maximal Stop price = " , //<2109> DoubleToStr ( ald.Price - ald.DistanceModify , avi.Digits ) ) ; //<2110> } //<2111> //<2112> if ( ali.Validation == 1 ) //<2113> if ( ali.OrderType == aci.Buy ) //<2114> if ( ald.Stop - OrderStopLoss () < 0 && ali.EmptyStop == 0 ) //<2115> { ali.Validation = 0 ; //<2116> Alert ( avs.SystemStamp , //<2117> ": Modify command is disabled due to Buy order Stop lowering" ) ; //<2118> } //<2119> // //<2120> //<2121> //< 17.4.4.6. Sell Order Take Price Validation 18 > //<2122> if ( ali.Validation == 1 ) //<2123> if ( ali.OrderType == aci.Sell ) //<2124> if ( ald.DistanceModify - ald.DistanceTake > 0 && ali.EmptyTake == 0 ) //<2125> { ali.Validation = 0 ; //<2126> Alert ( avs.SystemStamp , //<2127> ": Modify command is disabled due to invalid Take distance = " , //<2128> DoubleToStr ( ald.DistanceTake , avi.Digits ) , //<2129> " / " , //<2130> DoubleToStr ( ald.DistanceModify , avi.Digits ) ) ; //<2131> Alert ( avs.SystemStamp , //<2132> ": Modify command current Take price = " , //<2133> DoubleToStr ( ald.Take , avi.Digits ) , //<2134> " / Ask price = " , //<2135> DoubleToStr ( ald.Price , avi.Digits ) ) ; //<2136> Alert ( avs.SystemStamp , //<2137> ": Sell order maximal Take price = " , //<2138> DoubleToStr ( ald.Price - ald.DistanceModify , avi.Digits ) ) ; //<2139> } //<2140> //< 17.4.4.6. Sell Order Take Price Validation 18 > //<2141> //<2142> //< 17.4.4.7. Sell Order Stop Price Validation 25 > //<2143> if ( ali.Validation == 1 ) //<2144> if ( ali.OrderType == aci.Sell ) //<2145> if ( ald.DistanceModify - ald.DistanceStop > 0 && ali.EmptyStop == 0 ) //<2146> { ali.Validation = 0 ; //<2147> Alert ( avs.SystemStamp , //<2148> ": Modify command is disabled due to invalid Stop distance = " , //<2149> DoubleToStr ( ald.DistanceStop , avi.Digits ) , //<2150> " / " , //<2151> DoubleToStr ( ald.DistanceModify , avi.Digits ) ) ; //<2152> Alert ( avs.SystemStamp , //<2153> ": Modify command current Stop price = " , //<2154> DoubleToStr ( ald.Stop , avi.Digits ) , //<2155> " / Ask price = " , //<2156> DoubleToStr ( ald.Price , avi.Digits ) ) ; //<2157> Alert ( avs.SystemStamp , //<2158> ": Sell order minimal Stop price = " , //<2159> DoubleToStr ( ald.Price + ald.DistanceModify , avi.Digits ) ) ; //<2160> } //<2161> //<2162> if ( ali.Validation == 1 ) //<2163> if ( ali.OrderType == aci.Sell ) //<2164> if ( ald.Stop - OrderStopLoss () > 0 && ali.EmptyStop == 0 ) //<2165> { ali.Validation = 0 ; //<2166> Alert ( avs.SystemStamp , //<2167> ": Modify command is disabled due to Sell order Stop heightening" ) ; //<2168> } //<2169> // //<2170> //<2171> //< 17.4.4.8. Modify Command Validation Exit Point 3 > //<2172> if ( ali.Validation == 0 ) //<2173> ali.Command = EMPTY ; //<2174> } //<2175> // //<2176> // ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` `//<2177> //<2178> //< 17.4.5. Close Command Validation 11 > ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` //<2179> else if ( ali.Command == aci.Close ) //<2180> { //<2181> Alert ( avs.SystemStamp , ": Close command is detected" ) ; //<2182> //<2183> if ( ali.OrdersTotal > 0 ) //<2184> ali.Validation = 1 ; //<2185> else { ali.Validation = 0 ; //<2186> Alert ( avs.SystemStamp , ": Close command is ignored due to empty order list" ) ; //<2187> } //<2188> //<2189> if ( ali.Validation == 0 ) //<2190> ali.Command = EMPTY ; //<2191> } //<2192> // ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` //<2193> //<2194> //< 17.4.6. Empty Command Detection 3 > ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` //<2195> else if ( ali.Command == EMPTY ) //<2196> { //<2197> } //<2198> // ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` //<2199> //<2200> //< 17.4.7. Invalid Command Detection 1 > ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` //<2201> else Alert ( avs.SystemStamp , ": Invalid Command " , ali.Command ) ; //<2202> // ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` ` //<2203> //<2204> //``````````````````````````````````````````````````````````````````//<2205> //<2206> //< 17.5. Attempt To Modify 34 >``````````````````````````````````````````````````````````````````````````````//<2207> if ( ali.Command == aci.Modify ) //<2208> { ali.Command = EMPTY ; //<2209> //<2210> //< Trading Function Execution Sequence > //<2211> //< Step 1 > //<2212> avs.LocalStamp = avs.SystemStamp + ": Attempt to Modify " + //<2213> aes.Symbol + " " + //<2214> acs.Operation [ OrderType () ] + " #" + //<2215> OrderMagicNumber () + "/" + //<2216> OrderTicket () ; //<2217> //< Step 2 > //<2218> if ( OrderType () == aci.Buy ) string als.Price = " Bid = " ; //<2219> else als.Price = " Ask = " ; //<2220> //<2221> Alert ( avs.LocalStamp , als.Price , //<2222> DoubleToStr ( ald.Price , avi.Digits ) , " / Take = " , //<2223> DoubleToStr ( ald.Take , avi.Digits ) , " / Stop = " , //<2224> DoubleToStr ( ald.Stop , avi.Digits ) ) ; //<2225> //< Step 3 > //<2226> OrderModify ( OrderTicket () , //<2227> OrderOpenPrice () , //<2228> ald.Stop , //<2229> ald.Take , 0 , 0 ) ; //<2230> //< Step 4 > //<2231> avi.TimeStamp = TimeLocal () ; //<2232> //<2233> //< Step 5 > //<2234> avi.Exception = GetLastError () ; //<2235> //<2236> //< Step 6 > //<2237> if ( avi.Exception == 0 ) avs.LocalMessage = " Success " ; //<2238> else avs.LocalMessage = " Failure " + avi.Exception ; //<2239> //<2240> //< Step 7 > //<2241> static int ali.ModifyAttempts , ali.ModifySuccesses , ali.ModifyExceptions ; //<2242> ali.ModifyAttempts ++ ; //<2243> if ( avi.Exception == 0 ) ali.ModifySuccesses ++ ; //<2244> else ali.ModifyExceptions ++ ; //<2245> //<2246> //< Step 8 > //<2247> Alert ( avs.LocalStamp , avs.LocalMessage , " " , //<2248> ali.ModifyAttempts , "/" , //<2249> ali.ModifySuccesses , "/" , //<2250> ali.ModifyExceptions ) ; //<2251> //<2252> //< Step 9 > //<2253> avs.SystemMessage = "Modification" + avs.LocalMessage + " " + //<2254> ali.ModifyAttempts + "/" + //<2255> ali.ModifySuccesses + "/" + //<2256> ali.ModifyExceptions ; //<2257> //<2258> // //<2259> } //<2260> //``````````````````````````````````````````````````````````````````````````````//<2261> //<2262> //< 17.6. Attempt To Close 27 >```````````````````````````````````````````````````````````````````````````````//<2263> if ( ali.Command == aci.Close ) //<2264> { ali.Command = EMPTY ; //<2265> //<2266> //< Trading Function Execution Sequence > //<2267> //< Step 1 > //<2268> avs.LocalStamp = avs.SystemStamp + ": Attempt to Close " + //<2269> aes.Symbol + " " + //<2270> acs.Operation [ OrderType () ] + " #" + //<2271> OrderMagicNumber () + "/" + //<2272> OrderTicket () ; //<2273> //< Step 2 > //<2274> Alert ( avs.LocalStamp , " at " , //<2275> DoubleToStr ( OrderClosePrice () , avi.Digits ) ) ; //<2276> //< Step 3 > //<2277> OrderClose ( OrderTicket () , OrderLots () , OrderClosePrice () , 0 , 0 ) ; //<2278> //<2279> //< Step 4 > //<2280> avi.TimeStamp = TimeLocal () ; //<2281> //<2282> //< Step 5 > //<2283> avi.Exception = GetLastError () ; //<2284> //<2285> //< Step 6 > //<2286> if ( avi.Exception == 0 ) avs.LocalMessage = " Success " ; //<2287> else avs.LocalMessage = " Failure " + avi.Exception ; //<2288> //<2289> //< Step 7 > //<2290> static int ali.CloseAttempts , ali.CloseSuccesses , ali.CloseExceptions ; //<2291> ali.CloseAttempts ++ ; //<2292> if ( avi.Exception == 0 ) ali.CloseSuccesses ++ ; //<2293> else ali.CloseExceptions ++ ; //<2294> //<2295> //< Step 8 > //<2296> Alert ( avs.LocalStamp , avs.LocalMessage , " " , //<2297> ali.CloseAttempts , "/" , //<2298> ali.CloseSuccesses , "/" , //<2299> ali.CloseExceptions ) ; //<2300> //< Step 9 > //<2301> avs.SystemMessage = "Close command" + avs.LocalMessage + " " + //<2302> ali.CloseAttempts + "/" + //<2303> ali.CloseSuccesses + "/" + //<2304> ali.CloseExceptions ; //<2305> // //<2306> } //<2307> //```````````````````````````````````````````````````````````````````````````````//<2308> //<2309> //< 17.7. Automatic Risk Management 39 >``````````````````````````````````````````````````````````````````````//<2310> //<2311> //< 17.7.1. Automatic Risk Management Entry Point 7 > //<2312> if ( ali.Command == aci.Buy //<2313> || ali.Command == aci.Sell ) //<2314> { //<2315> avi.Command = ali.Command ; //<2316> avd.Price = ald.Price ; //<2317> avd.Stop = ald.Stop ; //<2318> avd.Take = ald.Take ; //<2319> // //<2320> //<2321> //< 17.7.2. Operation Size Limit Computing 9 > //<2322> avd.QuoteTarget = MathAbs ( avd.Price - avd.Take ) ; //<2323> avd.QuoteRisk = MathAbs ( avd.Price - avd.Stop ) ; //<2324> avd.NominalPoint = avd.NominalTick * avd.QuotePoint / avd.QuoteTick ; //<2325> avi.MarginPoints = MathRound ( avd.NominalMargin / avd.NominalPoint ) ; //<2326> avi.RiskPoints = MathRound ( avd.QuoteRisk / avd.QuotePoint ) ; //<2327> avd.VARLimit = AccountEquity () * avd.OrderReserve ; //<2328> avd.RiskPoint = avd.VARLimit / avi.RiskPoints ; //<2329> avd.MarginLimit = avd.RiskPoint * avi.MarginPoints ; //<2330> avd.SizeLimit = avd.MarginLimit / avd.NominalMargin ; //<2331> // //<2332> //<2333> //< 17.7.3. Operation Size Control 22 > //<2334> if ( avd.SizeLimit - avd.MinimumLots >= 0 ) //<2335> { int ali.Steps = MathFloor ( ( avd.SizeLimit - avd.MinimumLots ) //<2336> / avd.LotStep ) ; //<2337> double ald.Size = avd.MinimumLots + avd.LotStep * ali.Steps ; } //<2338> else ald.Size = 0 ; //<2339> //<2340> if ( ald.Size - avd.MaximumLots > 0 ) //<2341> ald.Size = avd.MaximumLots ; //<2342> //<2343> if ( ald.Size - avd.MinimumLots >= 0 ) //<2344> double ald.MarginCheck = AccountFreeMarginCheck ( aes.Symbol , avi.Command , ald.Size ) ; //<2345> else { //<2346> avi.Command = EMPTY ; //<2347> Alert ( avs.SystemStamp , ": " , acs.Operation [ ali.Command ] , //<2348> " command is disabled due to low order size limit = " , //<2349> DoubleToStr ( avd.SizeLimit , 2 ) , " / " , DoubleToStr ( avd.MinimumLots , 2 ) ) ; //<2350> } //<2351> //<2352> if ( ald.MarginCheck <= 0 //<2353> || GetLastError () == 134 ) //<2354> { //<2355> avi.Command = EMPTY ; //<2356> Alert ( avs.SystemStamp , ": " , acs.Operation [ ali.Command ] , //<2357> " command is disabled due to insufficient margin" ) ; //<2358> } //<2359> // //<2360> //<2361> //< 17.7.4. Automatic Risk Management Exit Point 1 > //<2362> } // if 17.7.1 //<2363> // //<2364> //<2365> //< 17.7. Automatic Risk Management 39 >``````````````````````````````````````````````````````````````````````//<2366> //<2367> //< 17.8. Control Interface Reset On Exit 1 >`````````````````````````````````````````````````````````````````//<2368> GlobalVariableSet ( avs.SetupCommand , EMPTY ) ; //<2369> //`````````````````````````````````````````````````````````````````//<2370> } //<2371> //`````````````````````````````````````````````````````````//<2372> //<2373> //-----------------------------------------------------------------------//<2374> ////////////////////////////////////////////////////////////////////////////////////////////////////////////////<2375> //< A.System.Extra: Control Module >--------------------------------------------------------------------------//<2376> //<2377> //< A.System.Extra: Control Module Function 2201 >````````````````````````````````````````````````````````````//<2378> int afr.ControlInitialization () // 5 elements // input - / code 5 / output - //<2379> { //<2380> afr.CreateSetup () ; //<2381> //<2382> afr.CreatePanel.1 () ; //<2383> afr.CreatePanel.2 () ; //<2384> //<2385> afr.PreparePlotObjects () ; //<2386> //<2387> afr.ResetChartMetrics () ; //<2388> } //<2389> //````````````````````````````````````````````````````````````//<2390> //<2391> //< A.System.Extra: Control Module Function 2202 >````````````````````````````````````````````````````````````//<2392> int afr.ControlDeinitialization () // 3 elements // input - / code 3 / output - //<2393> { //<2394> afr.DeleteSetup () ; //<2395> } //<2401> //````````````````````````````````````````````````````````````//<2402> //<2403> //< A.System.Extra: Control Module Function 2202 >````````````````````````````````````````````````````````````//<2392> int afr.MonitorDeinitialization () // 3 elements // input - / code 3 / output - //<2393> { //<2394> afr.DeletePanel.1 () ; //<2397> afr.DeletePanel.2 () ; //<2398> //<2399> afr.DeletePlotObjects () ; //<2400> } //<2401> //````````````````````````````````````````````````````````````//<2402> //<2403> //< A.System.Extra: Control Module Function 2203 >````````````````````````````````````````````````````````````//<2404> int afr.PreparePlotObjects () // - elements // input - / code - / output - //<2405> { //<2406> avs.PlotPrefix = A.Property.Series + A.Property.Release + ".Plot." ; //<2407> //<2408> avs.OrderPrice = avs.PlotPrefix + acs.OrderPrice ; //<2409> avs.OrderTake = avs.PlotPrefix + acs.OrderTake ; //<2410> avs.OrderStop = avs.PlotPrefix + acs.OrderStop ; //<2411> avs.OrderPriceID = avs.PlotPrefix + acs.OrderPriceID ; //<2412> avs.OrderTakeID = avs.PlotPrefix + acs.OrderTakeID ; //<2413> avs.OrderStopID = avs.PlotPrefix + acs.OrderStopID ; //<2414> //<2415> avs.TimeBegin.2 = avs.PlotPrefix + acs.TimeBegin.2 ; //<2416> avs.TimeBegin.3 = avs.PlotPrefix + acs.TimeBegin.3 ; //<2417> //<2418> avs.ZoneLevels = avs.PlotPrefix + acs.ZoneLevels ; //<2419> avs.Profile.1 = avs.PlotPrefix + acs.Profile.1 ; //<2420> avs.Profile.0 = avs.PlotPrefix + acs.Profile.0 ; //<2421> avs.Line.1 = avs.PlotPrefix + acs.Line.1 ; //<2422> avs.Line.0 = avs.PlotPrefix + acs.Line.0 ; //<2423> avs.Line.Central = avs.PlotPrefix + acs.Line.Central ; //<2424> avs.Line.Average.1 = avs.PlotPrefix + acs.Line.Average.1 ; //<2425> avs.Line.Average.0 = avs.PlotPrefix + acs.Line.Average.0 ; //<2426> //<2427> avi.FlagOrderLevelsExist = 0 ; //<2428> avi.FlagTimeBordersExist = 0 ; //<2429> avi.FlagZoneLevelsExist = 0 ; //<2430> avi.FlagProfilesExist = 0 ; //<2431> //<2432> afr.DeletePlotObjects () ; //<2433> } //<2434> //````````````````````````````````````````````````````````````//<2435> //<2436> //< A.System.Extra: Control Module Function 2203 >````````````````````````````````````````````````````````````//<2437> int afr.DeletePlotObjects () // - elements // input - / code - / output - //<2438> { //<2439> int ali.PrefixDigits = StringLen ( avs.PlotPrefix ) ; //<2440> //<2441> int i , N ; N = ObjectsTotal () - 1 ; //<2442> for ( i = N ; i >= 0 ; i -- ) //<2443> { if ( StringLen ( ObjectName ( i ) ) >= ali.PrefixDigits ) //<2444> if ( StringSubstr ( ObjectName ( i ) , 0 , ali.PrefixDigits ) == avs.PlotPrefix ) //<2445> ObjectDelete ( ObjectName ( i ) ) ; //<2446> } //<2447> } //<2448> //````````````````````````````````````````````````````````````//<2449> //<2450> //< A.System.Extra: Control Module Function 2203 >````````````````````````````````````````````````````````````//<2451> int afr.CreateSetup () // 47 elements // input - / code 47 / output - //<2452> { //<2453> avs.SetupPrefix = A.Property.Series + A.Property.Release + ".Setup." ; //<2454> avs.SetupBegin = avs.SetupPrefix + "0.Begin.=============================" ; //<2455> avs.SetupAccountReserve = avs.SetupPrefix + "1.1." + "AccountReserve" ; //<2456> avs.SetupOrderReserve = avs.SetupPrefix + "1.2." + "OrderReserve" ; //<2457> avs.SetupTrading = avs.SetupPrefix + "2.1." + "Trading" ; //<2458> avs.SetupTimeframe.1 = avs.SetupPrefix + "2.2." + "Timeframe.1" ; //<2459> avs.SetupTimeframe.2 = avs.SetupPrefix + "2.3." + "Timeframe.2" ; //<2460> avs.SetupParameter.1 = avs.SetupPrefix + "2.4." + "Parameter.1" ; //<2461> avs.SetupParameter.2 = avs.SetupPrefix + "2.5." + "Parameter.2" ; //<2462> avs.SetupParameter.3 = avs.SetupPrefix + "2.6." + "Parameter.3" ; //<2463> avs.SetupMonitor.1 = avs.SetupPrefix + "3.1." + arn.Panel [ 0 ] + "1" ; //<2464> avs.SetupFontSize.1 = avs.SetupPrefix + "3.2." + arn.Panel [ ari.FontSize ] ; //<2465> avs.SetupFontColor.1 = avs.SetupPrefix + "3.3." + arn.Panel [ ari.FontColor ] ; //<2466> avs.SetupLineSpace.1 = avs.SetupPrefix + "3.4." + arn.Panel [ ari.LineSpace ] ; //<2467> avs.SetupPositionX.1 = avs.SetupPrefix + "3.5." + arn.Panel [ ari.PositionX ] ; //<2468> avs.SetupPositionY.1 = avs.SetupPrefix + "3.6." + arn.Panel [ ari.PositionY ] ; //<2469> avs.SetupMonitor.2 = avs.SetupPrefix + "4.1." + arn.Panel [ 0 ] + "2" ; //<2470> avs.SetupFontSize.2 = avs.SetupPrefix + "4.2." + arn.Panel [ ari.FontSize ] ; //<2471> avs.SetupFontColor.2 = avs.SetupPrefix + "4.3." + arn.Panel [ ari.FontColor ] ; //<2472> avs.SetupLineSpace.2 = avs.SetupPrefix + "4.4." + arn.Panel [ ari.LineSpace ] ; //<2473> avs.SetupPositionX.2 = avs.SetupPrefix + "4.5." + arn.Panel [ ari.PositionX ] ; //<2474> avs.SetupPositionY.2 = avs.SetupPrefix + "4.6." + arn.Panel [ ari.PositionY ] ; //<2475> avs.SetupOrderSelect = avs.SetupPrefix + "5.1." + "OrderSelect" ; //<2476> avs.SetupPlotOrderLevels = avs.SetupPrefix + "5.2." + "PlotOrderLevels" ; //<2477> avs.SetupPlotTimeBorders = avs.SetupPrefix + "5.3." + "PlotTimeBorders" ; //<2478> avs.SetupPlotZoneLevels = avs.SetupPrefix + "5.4." + "PlotZoneLevels" ; //<2479> avs.SetupPlotProfiles = avs.SetupPrefix + "5.5." + "PlotProfiles" ; //<2480> avs.SetupProfileReset = avs.SetupPrefix + "6.1." + "ProfileReset" ; //<2481> avs.SetupZoneReset = avs.SetupPrefix + "6.2." + "ZoneReset" ; //<2482> avs.SetupZoneBasePoints = avs.SetupPrefix + "7.1." + "ZoneBasePoints" ; //<2483> avs.SetupZoneStepPoints = avs.SetupPrefix + "7.2." + "ZoneStepPoints" ; //<2484> avs.SetupEnd = avs.SetupPrefix + "9.End.===============================" ; //<2485> //<2486> GlobalVariableSet ( avs.SetupBegin , aci.ReleaseNumber ) ; //<2487> GlobalVariableSet ( avs.SetupAccountReserve , avd.AccountReserve ) ; //<2488> GlobalVariableSet ( avs.SetupOrderReserve , avd.OrderReserve ) ; //<2489> GlobalVariableSet ( avs.SetupTrading , avi.TradingFlag ) ; //<2490> GlobalVariableSet ( avs.SetupTimeframe.1 , avi.Timeframe.1 ) ; //<2491> GlobalVariableSet ( avs.SetupTimeframe.2 , avi.Timeframe.2 ) ; //<2492> GlobalVariableSet ( avs.SetupParameter.1 , avd.Parameter.1 ) ; //<2493> GlobalVariableSet ( avs.SetupParameter.2 , avd.Parameter.2 ) ; //<2494> GlobalVariableSet ( avs.SetupParameter.3 , avd.Parameter.3 ) ; //<2495> GlobalVariableSet ( avs.SetupMonitor.1 , avi.MonitorFlag.1 ) ; //<2496> GlobalVariableSet ( avs.SetupFontSize.1 , arv.Panel.1 [ ari.FontSize ] ) ; //<2497> GlobalVariableSet ( avs.SetupFontColor.1 , arv.Panel.1 [ ari.FontColor ] ) ; //<2498> GlobalVariableSet ( avs.SetupLineSpace.1 , arv.Panel.1 [ ari.LineSpace ] ) ; //<2499> GlobalVariableSet ( avs.SetupPositionX.1 , arv.Panel.1 [ ari.PositionX ] ) ; //<2500> GlobalVariableSet ( avs.SetupPositionY.1 , arv.Panel.1 [ ari.PositionY ] ) ; //<2501> GlobalVariableSet ( avs.SetupMonitor.2 , avi.MonitorFlag.2 ) ; //<2502> GlobalVariableSet ( avs.SetupFontSize.2 , arv.Panel.2 [ ari.FontSize ] ) ; //<2503> GlobalVariableSet ( avs.SetupFontColor.2 , arv.Panel.2 [ ari.FontColor ] ) ; //<2504> GlobalVariableSet ( avs.SetupLineSpace.2 , arv.Panel.2 [ ari.LineSpace ] ) ; //<2505> GlobalVariableSet ( avs.SetupPositionX.2 , arv.Panel.2 [ ari.PositionX ] ) ; //<2506> GlobalVariableSet ( avs.SetupPositionY.2 , arv.Panel.2 [ ari.PositionY ] ) ; //<2507> GlobalVariableSet ( avs.SetupOrderSelect , avi.OrderSelect ) ; //<2508> GlobalVariableSet ( avs.SetupPlotOrderLevels , avi.PlotOrderLevels ) ; //<2509> GlobalVariableSet ( avs.SetupPlotTimeBorders , avi.PlotTimeBorders ) ; //<2510> GlobalVariableSet ( avs.SetupPlotZoneLevels , avi.PlotZoneLevels ) ; //<2511> GlobalVariableSet ( avs.SetupPlotProfiles , avi.PlotProfiles ) ; //<2512> GlobalVariableSet ( avs.SetupProfileReset , arv.1 [ ari.1.Reset ] ) ; //<2513> GlobalVariableSet ( avs.SetupZoneReset , arv.Z [ ari.Z.Reset ] ) ; //<2514> GlobalVariableSet ( avs.SetupZoneBasePoints , avi.ZoneBasePoints ) ; //<2515> GlobalVariableSet ( avs.SetupZoneStepPoints , avi.ZoneStepPoints ) ; //<2516> GlobalVariableSet ( avs.SetupEnd , aci.ReleaseNumber ) ; //<2517> } //<2518> //````````````````````````````````````````````````````````````//<2519> //<2520> //< A.System.Extra: Control Module Function 2204 >````````````````````````````````````````````````````````````//<2521> int afr.DeleteSetup () // 1 elements // input - / code 1 / output - //<2522> { //<2523> GlobalVariablesDeleteAll ( avs.SetupPrefix ) ; //<2524> } //<2525> //````````````````````````````````````````````````````````````//<2526> //<2527> //< A.System.Extra: Control Module Function 2205 >````````````````````````````````````````````````````````````//<2528> int afr.ResetSetup () // 33 elements // input - / code 33 / output - //<2529> { //<2530> if ( ! GlobalVariableCheck ( avs.SetupFontSize.1 ) ) //<2531> GlobalVariableSet ( avs.SetupFontSize.1 , arv.Panel.1 [ ari.FontSize ] ) ; //<2532> else arv.Panel.1 [ ari.FontSize ] = GlobalVariableGet( avs.SetupFontSize.1 ) ; //<2533> //<2534> if ( ! GlobalVariableCheck ( avs.SetupFontColor.1 ) ) //<2535> GlobalVariableSet ( avs.SetupFontColor.1 , arv.Panel.1 [ ari.FontColor ] ) ; //<2536> else arv.Panel.1 [ ari.FontColor ] = GlobalVariableGet( avs.SetupFontColor.1 ) ; //<2537> //<2538> if ( ! GlobalVariableCheck ( avs.SetupLineSpace.1 ) ) //<2539> GlobalVariableSet ( avs.SetupLineSpace.1 , arv.Panel.1 [ ari.LineSpace ] ) ; //<2540> else arv.Panel.1 [ ari.LineSpace ] = GlobalVariableGet( avs.SetupLineSpace.1 ) ; //<2541> //<2542> if ( ! GlobalVariableCheck ( avs.SetupPositionX.1 ) ) //<2543> GlobalVariableSet ( avs.SetupPositionX.1 , arv.Panel.1 [ ari.PositionX ] ) ; //<2544> else arv.Panel.1 [ ari.PositionX ] = GlobalVariableGet( avs.SetupPositionX.1 ) ; //<2545> //<2546> if ( ! GlobalVariableCheck ( avs.SetupPositionY.1 ) ) //<2547> GlobalVariableSet ( avs.SetupPositionY.1 , arv.Panel.1 [ ari.PositionY ] ) ; //<2548> else arv.Panel.1 [ ari.PositionY ] = GlobalVariableGet( avs.SetupPositionY.1 ) ; //<2549> //<2550> if ( ! GlobalVariableCheck ( avs.SetupFontSize.2 ) ) //<2551> GlobalVariableSet ( avs.SetupFontSize.2 , arv.Panel.2 [ ari.FontSize ] ) ; //<2552> else arv.Panel.2 [ ari.FontSize ] = GlobalVariableGet( avs.SetupFontSize.2 ) ; //<2553> //<2554> if ( ! GlobalVariableCheck ( avs.SetupFontColor.2 ) ) //<2555> GlobalVariableSet ( avs.SetupFontColor.2 , arv.Panel.2 [ ari.FontColor ] ) ; //<2556> else arv.Panel.2 [ ari.FontColor ] = GlobalVariableGet( avs.SetupFontColor.2 ) ; //<2557> //<2558> if ( ! GlobalVariableCheck ( avs.SetupLineSpace.2 ) ) //<2559> GlobalVariableSet ( avs.SetupLineSpace.2 , arv.Panel.2 [ ari.LineSpace ] ) ; //<2560> else arv.Panel.2 [ ari.LineSpace ] = GlobalVariableGet( avs.SetupLineSpace.2 ) ; //<2561> //<2562> if ( ! GlobalVariableCheck ( avs.SetupPositionX.2 ) ) //<2563> GlobalVariableSet ( avs.SetupPositionX.2 , arv.Panel.2 [ ari.PositionX ] ) ; //<2564> else arv.Panel.2 [ ari.PositionX ] = GlobalVariableGet( avs.SetupPositionX.2 ) ; //<2565> //<2566> if ( ! GlobalVariableCheck ( avs.SetupPositionY.2 ) ) //<2567> GlobalVariableSet ( avs.SetupPositionY.2 , arv.Panel.2 [ ari.PositionY ] ) ; //<2568> else arv.Panel.2 [ ari.PositionY ] = GlobalVariableGet( avs.SetupPositionY.2 ) ; //<2569> //<2570> if ( ! GlobalVariableCheck ( avs.SetupOrderSelect ) ) //<2571> GlobalVariableSet ( avs.SetupOrderSelect , avi.OrderSelect ) ; //<2572> else avi.OrderSelect = GlobalVariableGet( avs.SetupOrderSelect ) ; //<2573> //<2574> if ( ! GlobalVariableCheck ( avs.SetupPlotOrderLevels ) ) //<2575> GlobalVariableSet ( avs.SetupPlotOrderLevels , avi.PlotOrderLevels ) ; //<2576> else avi.PlotOrderLevels = GlobalVariableGet( avs.SetupPlotOrderLevels ) ; //<2577> //<2578> if ( ! GlobalVariableCheck ( avs.SetupPlotTimeBorders ) ) //<2579> GlobalVariableSet ( avs.SetupPlotTimeBorders , avi.PlotTimeBorders ) ; //<2580> else avi.PlotTimeBorders = GlobalVariableGet( avs.SetupPlotTimeBorders ) ; //<2581> //<2582> if ( ! GlobalVariableCheck ( avs.SetupPlotZoneLevels ) ) //<2583> GlobalVariableSet ( avs.SetupPlotZoneLevels , avi.PlotZoneLevels ) ; //<2584> else avi.PlotZoneLevels = GlobalVariableGet( avs.SetupPlotZoneLevels ) ; //<2585> //<2586> if ( ! GlobalVariableCheck ( avs.SetupPlotProfiles ) ) //<2587> GlobalVariableSet ( avs.SetupPlotProfiles , avi.PlotProfiles ) ; //<2588> else avi.PlotProfiles = GlobalVariableGet( avs.SetupPlotProfiles ) ; //<2589> //<2590> if ( ! GlobalVariableCheck ( avs.SetupProfileReset ) ) //<2591> GlobalVariableSet ( avs.SetupProfileReset , arv.1 [ ari.1.Reset ] ) ; //<2592> else arv.1 [ ari.1.Reset ] = GlobalVariableGet( avs.SetupProfileReset ) ; //<2593> //<2594> if ( ! GlobalVariableCheck ( avs.SetupZoneReset ) ) //<2595> GlobalVariableSet ( avs.SetupZoneReset , arv.Z [ ari.Z.Reset ] ) ; //<2596> else arv.Z [ ari.Z.Reset ] = GlobalVariableGet( avs.SetupZoneReset ) ; //<2597> //<2598> if ( ! GlobalVariableCheck ( avs.SetupZoneBasePoints ) ) //<2599> GlobalVariableSet ( avs.SetupZoneBasePoints , avi.ZoneBasePoints ) ; //<2600> else avi.ZoneBasePoints = GlobalVariableGet( avs.SetupZoneBasePoints ) ; //<2601> //<2602> if ( ! GlobalVariableCheck ( avs.SetupZoneStepPoints ) ) //<2603> GlobalVariableSet ( avs.SetupZoneStepPoints , avi.ZoneBasePoints ) ; //<2604> else avi.ZoneStepPoints = GlobalVariableGet( avs.SetupZoneStepPoints ) ; //<2605> } //<2606> //````````````````````````````````````````````````````````````//<2607> //<2608> //< A.System.Extra: Control Module Function 2203 >````````````````````````````````````````````````````````````//<2609> int afr.ResetChartMetrics () // - elements // input - / code - / output - //<2610> { //<2611> arv.Chart [ ari.TimeZero ] = EMPTY ; //<2612> arv.Chart [ ari.TimeRight ] = EMPTY ; //<2613> arv.Chart [ ari.TimeLeft ] = EMPTY ; //<2614> arv.Chart [ ari.BarRight ] = EMPTY ; //<2615> arv.Chart [ ari.BarLeft ] = EMPTY ; //<2616> arv.Chart [ ari.BarsShift ] = EMPTY ; //<2617> arv.Chart [ ari.BarsTotal ] = EMPTY ; //<2618> arv.Chart [ ari.Resolution.H ] = EMPTY ; //<2619> arv.Chart [ ari.PriceMax ] = EMPTY ; //<2620> arv.Chart [ ari.PriceMin ] = EMPTY ; //<2621> arv.Chart [ ari.PriceRange ] = EMPTY ; //<2622> arv.Chart [ ari.Resolution.V ] = EMPTY ; //<2623> } //<2624> //````````````````````````````````````````````````````````````//<2625> //<2626> //< A.System.Extra: Control Module Function 2206 >````````````````````````````````````````````````````````````//<2627> int afr.MeasureChart () // - elements // input - / code - / output - //<2628> { //<2629> arv.Chart [ ari.Resolution.H ] = WindowBarsPerChart () ; //<2630> arv.Chart [ ari.BarLeft ] = WindowFirstVisibleBar () ; //<2631> //<2632> if ( arv.Chart [ ari.BarLeft ] < arv.Chart [ ari.Resolution.H ] ) //<2633> arv.Chart [ ari.BarRight ] = 0 ; //<2634> else arv.Chart [ ari.BarRight ] = arv.Chart [ ari.BarLeft ] - arv.Chart [ ari.Resolution.H ] ; //<2635> //<2636> arv.Chart [ ari.BarsTotal ] = arv.Chart [ ari.BarLeft ] - arv.Chart [ ari.BarRight ] + 1 ; //<2637> arv.Chart [ ari.BarsShift ] = arv.Chart [ ari.Resolution.H ] - arv.Chart [ ari.BarsTotal ] ; //<2638> //<2639> arv.Chart [ ari.TimeZero ] = iTime ( aes.Symbol , PERIOD_M1 , 0 ) ; //<2640> int ali.IndexRight = arv.Chart [ ari.BarRight ] ; //<2641> int ali.IndexLeft = arv.Chart [ ari.BarLeft ] ; //<2642> arv.Chart [ ari.TimeRight ] = Time [ ali.IndexRight ] ; //<2643> arv.Chart [ ari.TimeLeft ] = Time [ ali.IndexLeft ] ; //<2644> //<2645> arv.Chart [ ari.PriceMax ] = WindowPriceMax () ; //<2646> arv.Chart [ ari.PriceMin ] = WindowPriceMin () ; //<2647> arv.Chart [ ari.PriceRange ] = arv.Chart [ ari.PriceMax ] - arv.Chart [ ari.PriceMin ] ; //<2648> if ( Point > 0 ) //<2649> arv.Chart [ ari.Resolution.V ] = arv.Chart [ ari.PriceRange ] / Point ; //<2650> else arv.Chart [ ari.Resolution.V ] = 2 ; //<2651> } //<2652> //````````````````````````````````````````````````````````````//<2653> //<2654> //< A.System.Extra: Control Module Function 2206 >````````````````````````````````````````````````````````````//<2655> int afr.Monitoring () // 22 elements // input - / code 22 / output - //<2656> { //<2657> avi.MonitoringRunTime = GetTickCount () ; //<1718> //< 2206.2. Monitoring Panel.1 Control 10 > //<2658> if ( ! GlobalVariableCheck ( avs.SetupMonitor.1 ) ) //<2659> GlobalVariableSet ( avs.SetupMonitor.1 , avi.MonitorFlag.1 ) ; //<2660> //<2661> if ( GlobalVariableGet ( avs.SetupMonitor.1 ) == 1 ) //<2662> { if ( avi.MonitorFlag.1 == 0 ) //<2663> { avi.MonitorFlag.1 = 1 ; //<2664> afr.CreatePanel.1 () ; } //<2665> afr.ResetPanel.1 () ; } //<2666> //<2667> else if ( avi.MonitorFlag.1 == 1 ) //<2668> { avi.MonitorFlag.1 = 0 ; //<2669> afr.DeletePanel.1 () ; } //<2670> // //<2671> //<2672> //< 2206.3. Monitoring Panel.2 Control 10 > //<2673> if ( ! GlobalVariableCheck ( avs.SetupMonitor.2 ) ) //<2674> GlobalVariableSet ( avs.SetupMonitor.2 , avi.MonitorFlag.2 ) ; //<2675> //<2676> if ( GlobalVariableGet ( avs.SetupMonitor.2 ) == 1 ) //<2677> { if ( avi.MonitorFlag.2 == 0 ) //<2678> { avi.MonitorFlag.2 = 1 ; //<2679> afr.CreatePanel.2 () ; } //<2680> afr.ResetPanel.2 () ; } //<2681> //<2682> else if ( avi.MonitorFlag.2 == 1 ) //<2683> { avi.MonitorFlag.2 = 0 ; //<2684> afr.DeletePanel.2 () ; } //<2685> // //<2686> //<2687> //< 2206.4. Reset Plotter > //<2688> afr.ResetPlotter () ; //<2689> //< 2206.4. Reset Plotter > //<2690> } //<2691> //````````````````````````````````````````````````````````````//<2692> //<2693> //< A.System.Extra: Control Module Function 2207 >````````````````````````````````````````````````````````````//<2694> int afr.CreatePanel.1 () // 5 elements // input - / code 5 / output - //<2695> { //<2696> static int i , N = aci.TextLines ; //<2697> for ( i = 0 ; i < N ; i ++ ) //<2698> { avs.TextBuffer.1 [ i ] = "" ; //<2699> avs.BufferName.1 [ i ] = A.Property.Series + A.Property.Release + ".TextBuffer.1." + i ; //<2700> afr.ResetTextLine.1 ( i ) ; } //<2701> } //<2702> //````````````````````````````````````````````````````````````//<2703> //<2704> //< A.System.Extra: Control Module Function 2208 >````````````````````````````````````````````````````````````//<2705> int afr.CreatePanel.2 () // 5 elements // input - / code 5 / output - //<2706> { //<2707> static int i , N = aci.TextLines ; //<2708> for ( i = 0 ; i < N ; i ++ ) //<2709> { avs.TextBuffer.2 [ i ] = "" ; //<2710> avs.BufferName.2 [ i ] = A.Property.Series + A.Property.Release + ".TextBuffer.2." + i ; //<2711> afr.ResetTextLine.2 ( i ) ; } //<2712> } //<2713> //````````````````````````````````````````````````````````````//<2714> //<2715> //< A.System.Extra: Control Module Function 2209 >````````````````````````````````````````````````````````````//<2716> int afr.DeletePanel.1 () // 3 elements // input - / code 3 / output - //<2717> { //<2718> static int i , N = aci.TextLines ; //<2719> for ( i = 0 ; i < N ; i ++ ) //<2720> { ObjectDelete ( avs.BufferName.1 [ i ] ) ; } //<2721> } //<2722> //````````````````````````````````````````````````````````````//<2723> //<2724> //< A.System.Extra: Control Module Function 2210 >````````````````````````````````````````````````````````````//<2725> int afr.DeletePanel.2 () // 3 elements // input - / code 3 / output - //<2726> { //<2727> static int i , N = aci.TextLines ; //<2728> for ( i = 0 ; i < N ; i ++ ) //<2729> { ObjectDelete ( avs.BufferName.2 [ i ] ) ; } //<2730> } //<2731> //````````````````````````````````````````````````````````````//<2732> //<2733> //< A.System.Extra: Control Module Function 2211 >````````````````````````````````````````````````````````````//<2734> int afr.ResetPanel.1 () // 7 elements // input - / code 7 / output - //<2735> { //<2736> static int i , N = aci.TextLines ; //<2737> //<2738> for ( i = 0 ; i < N ; i ++ ) //<2739> { avs.TextBuffer.1 [ i ] = "" ; //<2740> afr.SetTextLine.1 ( i ) ; } //<2741> //<2742> afr.Report.1 () ; //<2743> //<2744> for ( i = 0 ; i < N ; i ++ ) //<2745> afr.SetTextLine.1 ( i ) ; //<2746> } //<2747> //````````````````````````````````````````````````````````````//<2748> //<2749> //< A.System.Extra: Control Module Function 2212 >````````````````````````````````````````````````````````````//<2750> int afr.ResetPanel.2 () // 7 elements // input - / code 7 / output - //<2751> { //<2752> static int i , N = aci.TextLines ; //<2753> //<2754> for ( i = 0 ; i < N ; i ++ ) //<2755> { avs.TextBuffer.2 [ i ] = "" ; //<2756> afr.SetTextLine.2 ( i ) ; } //<2757> //<2758> afr.Report.2 () ; //<2759> //<2760> for ( i = 0 ; i < N ; i ++ ) //<2761> afr.SetTextLine.2 ( i ) ; //<2762> } //<2763> //````````````````````````````````````````````````````````````//<2764> //<2765> //< A.System.Extra: 4.2. Monitoring Module Function 4213 >````````````````````````````````````````````````````//<2766> //int afr.Reserved () // 0 elements // input - / code - / output - //<2767> //````````````````````````````````````````````````````//<2768> //<2769> //< A.System.Extra: Control Module Function 2214 >````````````````````````````````````````````````````````````//<2770> int afr.ResetTextLine.1 ( // 9 elements // input 1 / code 8 / output - //<2771> int aai.Line ) //<2772> { //<2773> static string als.Name ; als.Name = avs.BufferName.1 [ aai.Line ] ; //<2774> //<2775> ObjectCreate ( als.Name , OBJ_LABEL , 0 , 0 , 0 ) ; //<2776> ObjectSet ( als.Name , OBJPROP_XDISTANCE , arv.Panel.1 [ ari.FontSize ] //<2777> * arv.Panel.1 [ ari.PositionX ] ) ; //<2778> ObjectSet ( als.Name , OBJPROP_YDISTANCE , arv.Panel.1 [ ari.FontSize ] * //<2779> ( arv.Panel.1 [ ari.PositionY ] + aai.Line * arv.Panel.1 [ ari.LineSpace ] ) ) ; //<2780> //<2781> ObjectSetText ( als.Name , avs.TextBuffer.1 [ aai.Line ] , //<2782> arv.Panel.1 [ ari.FontSize ] , acs.FontName , arv.Panel.1 [ ari.FontColor ] ) ; //<2783> } //<2784> //````````````````````````````````````````````````````````````//<2785> //<2786> //< A.System.Extra: Control Module Function 2215 >````````````````````````````````````````````````````````````//<2787> int afr.ResetTextLine.2 ( // 9 elements // input 1 / code 8 / output - //<2788> int aai.Line ) //<2789> { //<2790> static string als.Name ; als.Name = avs.BufferName.2 [ aai.Line ] ; //<2791> //<2792> ObjectCreate ( als.Name , OBJ_LABEL , 0 , 0 , 0 ) ; //<2793> ObjectSet ( als.Name , OBJPROP_XDISTANCE , arv.Panel.2 [ ari.FontSize ] //<2794> * arv.Panel.2 [ ari.PositionX ] ) ; //<2795> ObjectSet ( als.Name , OBJPROP_YDISTANCE , arv.Panel.2 [ ari.FontSize ] * //<2796> ( arv.Panel.2 [ ari.PositionY ] + aai.Line * arv.Panel.2 [ ari.LineSpace ] ) ) ; //<2797> //<2798> ObjectSetText ( als.Name , avs.TextBuffer.2 [ aai.Line ] , //<2799> arv.Panel.2 [ ari.FontSize ] , acs.FontName , arv.Panel.2 [ ari.FontColor ] ) ; //<2800> } //<2801> //````````````````````````````````````````````````````````````//<2802> //<2803> //< A.System.Extra: Control Module Function 2216 >````````````````````````````````````````````````````````````//<2804> int afr.SetTextLine.1 ( // 4 elements // input 1 / code 3 / output - //<2805> int aai.Line ) //<2806> { //<2807> static string als.Name ; als.Name = avs.BufferName.1 [ aai.Line ] ; //<2808> //<2809> ObjectSetText ( als.Name , avs.TextBuffer.1 [ aai.Line ] , //<2810> arv.Panel.1 [ ari.FontSize ] , acs.FontName , arv.Panel.1 [ ari.FontColor ] ) ; //<2811> } //<2812> //````````````````````````````````````````````````````````````//<2813> //<2814> //< A.System.Extra: Control Module Function 2217 >````````````````````````````````````````````````````````````//<2815> int afr.SetTextLine.2 ( // 4 elements // input 1 / code 3 / output - //<2816> int aai.Line ) //<2817> { //<2818> static string als.Name ; als.Name = avs.BufferName.2 [ aai.Line ] ; //<2819> //<2820> ObjectSetText ( als.Name , avs.TextBuffer.2 [ aai.Line ] , //<2821> arv.Panel.2 [ ari.FontSize ] , acs.FontName , arv.Panel.2 [ ari.FontColor ] ) ; //<2822> } //<2823> //````````````````````````````````````````````````````````````//<2824> //<2825> //< A.System.Extra: Control Module Function 2218 >````````````````````````````````````````````````````````````//<2826> int afr.SetText.1 ( // 14 elements // input 4 / code 10 / output - //<2827> int aai.Line , //<2828> int aai.Position , //<2829> int aai.Indent , //<2830> string aas.Text ) //<2831> { //<2832> static int ali.Begin ; ali.Begin = aai.Position - StringLen ( aas.Text ) * aai.Indent ; //<2833> //<2834> if ( aai.Indent == 0 ) ali.Begin -- ; //<2835> //<2836> if ( ali.Begin <= 0 ) avs.TextBuffer.1 [ aai.Line ] = aas.Text ; //<2837> //<2838> else { int ali.BufferLength = StringLen ( avs.TextBuffer.1 [ aai.Line ] ) ; //<2839> if ( ali.Begin > ali.BufferLength ) //<2840> avs.TextBuffer.1 [ aai.Line ] = avs.TextBuffer.1 [ aai.Line ] + //<2841> StringSubstr ( acs.Blank , 0 , ali.Begin - ali.BufferLength ) + aas.Text ; //<2842> else avs.TextBuffer.1 [ aai.Line ] = //<2843> StringSubstr ( avs.TextBuffer.1 [ aai.Line ] , 0 , ali.Begin ) + aas.Text ; //<2844> } //<2845> } //<2846> //````````````````````````````````````````````````````````````//<2847> //<2848> //< A.System.Extra: Control Module Function 2219 >````````````````````````````````````````````````````````````//<2849> int afr.SetText.2 ( // 14 elements // input 4 / code 10 / output - //<2850> int aai.Line , //<2851> int aai.Position , //<2852> int aai.Indent , //<2853> string aas.Text ) //<2854> { //<2855> static int ali.Begin ; ali.Begin = aai.Position - StringLen ( aas.Text ) * aai.Indent ; //<2856> //<2857> if ( aai.Indent == 0 ) ali.Begin -- ; //<2858> //<2859> if ( ali.Begin <= 0 ) avs.TextBuffer.2 [ aai.Line ] = aas.Text ; //<2860> //<2861> else { int ali.BufferLength = StringLen ( avs.TextBuffer.2 [ aai.Line ] ) ; //<2862> if ( ali.Begin > ali.BufferLength ) //<2863> avs.TextBuffer.2 [ aai.Line ] = avs.TextBuffer.2 [ aai.Line ] + //<2864> StringSubstr ( acs.Blank , 0 , ali.Begin - ali.BufferLength ) + aas.Text ; //<2865> else avs.TextBuffer.2 [ aai.Line ] = //<2866> StringSubstr ( avs.TextBuffer.2 [ aai.Line ] , 0 , ali.Begin ) + aas.Text ; //<2867> } //<2868> } //<2869> //````````````````````````````````````````````````````````````//<2870> //<2871> //< A.System.Extra: Control Module Function 2220 >````````````````````````````````````````````````````````````//<2872> int afr.Report.1 () // 198 elements // input - / code 198 / output - //<2873> { //<2874> //< 4216.1. Header 3 > //<2875> static int ali.Trigger ; if ( ! ali.Trigger ) { ali.Trigger = 1 ; static string als.Header ; //<2876> als.Header = A.Property.Series + A.Property.Release + " " + A.Property.Program ; } //<2877> //<2878> afr.SetText.1 ( 0 , 1 , 0 , als.Header + ": " + avs.SystemMessage ) ; //<2879> // //<2880> //<2881> //< 4216.2. Currency Set Initialization 1 > //<2882> afr.CurrencyDetector ( aes.Symbol , arn.Currency ) ; //<2883> // //<2884> //<2885> //< 4216.3. First Cluster: System Report 11 > //<2886> afr.SetText.1 ( 2 , 1 , 0 , "Client Time: " + afs.Time ( TimeLocal () , 1 ) ) ; //<2887> afr.SetText.1 ( 3 , 1 , 0 , "Client Name: " + AccountName () ) ; //<2888> afr.SetText.1 ( 4 , 1 , 0 , "Server Name: " + AccountServer () ) ; //<2889> afr.SetText.1 ( 5 , 1 , 0 , "Server Time: " + afs.Time ( TimeCurrent () , 1 ) ) ; //<2890> //<2891> afr.SetText.1 ( 2 , 48 , 1 , afs.Interval ( TimeLocal () - avi.TimeStart , 1 ) + " / " ) ; //<2892> afr.SetText.1 ( 5 , 48 , 1 , afs.Interval ( TimeLocal () - avi.TimeLastRun , 1 ) + " / " ) ; //<2893> //<2894> afr.SetText.1 ( 2 , 49 , 0 , avi.BuyTrades + "+" + //<2895> avi.SellTrades + "=" + //<2896> avi.TotalTrades + "/" + avi.Trailes ) ; //<2897> //<2898> afr.SetText.1 ( 5 , 49 , 0 , avi.Runs + "/" + //<2899> avi.AttemptsTrade + "/" + avi.AttemptsTrail ) ; //<2900> // //<2901> //<2902> //< 4216.4. Second Cluster: Capital Management Report 51 > //<2903> double ald.DrawdownAbs = AccountEquity () - avd.PeakEquity ; //<2904> double ald.DrawdownRel = ald.DrawdownAbs / avd.PeakEquity ; //<2905> double ald.CapitalAbs = avd.PeakEquity * ( 1 - avd.AccountReserve ) ; //<2906> double ald.CapitalRel = 1 - avd.AccountReserve ; //<2907> double ald.CapitalGainAbs = avd.Capital - avd.InitialCapital ; //<2908> double ald.CapitalGainRel = ald.CapitalGainAbs / avd.InitialCapital * 100 ; //<2909> double ald.EquityGainAbs = AccountEquity () - avd.InitialEquity ; //<2910> double ald.EquityGainRel = ald.EquityGainAbs / avd.InitialEquity * 100 ; //<2911> double ald.EquityReserveAbs = AccountEquity () - ald.CapitalAbs ; //<2912> double ald.EquityReserveRel = ald.EquityReserveAbs / avd.PeakEquity ; //<2913> double ald.AccountEquityAbs = AccountEquity () ; //<2914> double ald.AccountEquityRel = AccountEquity () / avd.PeakEquity ; //<2915> double ald.AccountFreeMargin = AccountFreeMargin () ; //<2916> double ald.MarginLevel ; //<2917> string als.StopoutLevelAbs ; //<2918> string als.StopoutLevelRel ; //<2919> //<2920> if ( AccountMargin () > 0 ) ald.MarginLevel = AccountEquity () / AccountMargin () ; //<2921> else ald.MarginLevel = 0 ; //<2922> //<2923> if ( AccountStopoutMode () == 0 ) //<2924> { als.StopoutLevelAbs = DoubleToStr ( AccountStopoutLevel () * AccountEquity () / 100 , 2 ) ; //<2925> als.StopoutLevelRel = + AccountStopoutLevel () + ".00%" ; } //<2926> else //<2927> { als.StopoutLevelAbs = AccountStopoutLevel () + ".00" ; //<2928> als.StopoutLevelRel = DoubleToStr ( AccountStopoutLevel () / AccountEquity () * 100 , 2 ) + "%" ; } //<2929> //<2930> if ( ald.EquityGainAbs > 0 ) string als.GainSign = "+" ; //<2931> else als.GainSign = "" ; //<2932> //<2933> afr.SetText.1 ( 7 , 1 , 0 , "Capital " + arn.Currency [ ari.Account ] + ":" ) ; //<2934> afr.SetText.1 ( 8 , 1 , 0 , "Reserve:" ) ; //<2935> afr.SetText.1 ( 9 , 1 , 0 , "Peak Equity:" ) ; //<2936> afr.SetText.1 ( 10 , 1 , 0 , "Drawdown:" ) ; //<2937> afr.SetText.1 ( 11 , 1 , 0 , "Acc. Equity:" ) ; //<2938> afr.SetText.1 ( 12 , 1 , 0 , "Free Margin:" ) ; //<2939> //<2940> afr.SetText.1 ( 7 , 23 , 1 , DoubleToStr ( ald.CapitalAbs , 2 ) ) ; //<2941> afr.SetText.1 ( 8 , 23 , 1 , DoubleToStr ( ald.EquityReserveAbs , 2 ) ) ; //<2942> afr.SetText.1 ( 9 , 23 , 1 , DoubleToStr ( avd.PeakEquity , 2 ) ) ; //<2943> afr.SetText.1 ( 10 , 23 , 1 , DoubleToStr ( ald.DrawdownAbs , 2 ) ) ; //<2944> afr.SetText.1 ( 11 , 23 , 1 , DoubleToStr ( ald.AccountEquityAbs , 2 ) ) ; //<2945> afr.SetText.1 ( 12 , 23 , 1 , DoubleToStr ( ald.AccountFreeMargin , 2 ) ) ; //<2946> //<2947> afr.SetText.1 ( 7 , 32 , 1 , DoubleToStr ( ald.CapitalRel * 100 , 2 ) + "%" ) ; //<2948> afr.SetText.1 ( 7 , 45 , 1 , "+" + DoubleToStr ( ald.CapitalGainAbs , 2 ) ) ; //<2949> afr.SetText.1 ( 7 , 55 , 1 , "+" + DoubleToStr ( ald.CapitalGainRel , 2 ) + "%" ) ; //<2950> afr.SetText.1 ( 8 , 32 , 1 , DoubleToStr ( ald.EquityReserveRel * 100 , 2 ) + "%" ) ; //<2951> afr.SetText.1 ( 9 , 32 , 1 , DoubleToStr ( 100 , 2 ) + "%" ) ; //<2952> afr.SetText.1 ( 9 , 45 , 1 , afs.Interval ( TimeLocal () - avd.PeakTime , 1 ) ) ; //<2953> afr.SetText.1 ( 10 , 32 , 1 , DoubleToStr ( ald.DrawdownRel * 100 , 2 ) + "%" ) ; //<2954> afr.SetText.1 ( 11 , 32 , 1 , DoubleToStr ( ald.AccountEquityRel * 100 , 2 ) + "%" ) ; //<2955> afr.SetText.1 ( 11 , 45 , 1 , als.GainSign + DoubleToStr ( ald.EquityGainAbs , 2 ) ) ; //<2956> afr.SetText.1 ( 11 , 55 , 1 , als.GainSign + DoubleToStr ( ald.EquityGainRel , 2 ) + "%" ) ; //<2957> afr.SetText.1 ( 12 , 32 , 1 , DoubleToStr ( ald.MarginLevel * 100 , 2 ) + "%" ) ; //<2958> afr.SetText.1 ( 12 , 45 , 1 , als.StopoutLevelAbs ) ; //<2959> afr.SetText.1 ( 12 , 55 , 1 , als.StopoutLevelRel ) ; //<2960> // //<2961> //<2962> //< 4216.5. Third Cluster: Position Management Report 93 > //<2963> double ald.VARLimit = AccountEquity () * avd.OrderReserve ; //<2964> int ali.LotSize = MarketInfo ( aes.Symbol , MODE_LOTSIZE ) ; //<2965> double ald.NominalPoint = avd.NominalTick * avd.QuotePoint / avd.QuoteTick ; //<2966> int ali.MarginPoints ; //<2967> if ( ald.NominalPoint > 0 ) //<2968> ali.MarginPoints = MathRound ( avd.NominalMargin / ald.NominalPoint ) ; //<2969> else ali.MarginPoints = 0 ; //<2970> //<2971> string als.OrderCurrency [] = { "" , "" , "" , "" } ; //<2972> //<2973> string als.OrderData = "" ; //<2974> double ald.ContractSize = 0 ; //<2975> double ald.ContractValue = 0 ; //<2976> double ald.OrderPoint = 0 ; //<2977> int ali.OrderLifetime = 0 ; //<2978> //<2979> double ald.QuotePrice = 0 ; //<2980> double ald.QuoteTake = 0 ; //<2981> double ald.QuoteStop = 0 ; //<2982> double ald.QuoteTarget = 0 ; //<2983> double ald.QuoteVAR = 0 ; //<2984> //<2985> int ali.OrderProfit = 0 ; //<2986> int ali.OrderTarget = 0 ; //<2987> int ali.OrderVAR = 0 ; //<2988> int ali.OrderLimit = 0 ; //<2989> //<2990> double ald.OrderProfit = 0 ; //<2991> double ald.OrderTarget = 0 ; //<2992> double ald.OrderVAR = 0 ; //<2993> double ald.OrderLimit = 0 ; //<2994> //<2995> int ali.OrderTotal = OrdersTotal () ; //<2996> //<2997> if ( avi.OrderSelect > ali.OrderTotal ) //<2998> { avi.OrderSelect = 0 ; //<2999> GlobalVariableSet ( avs.SetupOrderSelect , avi.OrderSelect ) ; } //<3000> //<3001> if ( ali.OrderTotal > 0 ) //<3002> { int i , N ; N = ali.OrderTotal - 1 ; //<3003> for ( i = N ; i >= 0 ; i -- ) //<3004> { OrderSelect ( i , SELECT_BY_POS , MODE_TRADES ) ; //<3005> //<3006> if ( avi.OrderSelect == 0 ) //<3007> { if ( OrderMagicNumber () != aei.OrderID ) continue ; } //<3008> else //<3009> { if ( avi.OrderSelect != i + 1 ) continue ; } //<3010> //<3011> afr.PlotOrderLevels () ; //<3012> //<3013> afr.CurrencyDetector ( OrderSymbol () , als.OrderCurrency ) ; //<3014> //<3015> ald.ContractSize = OrderLots () ; //<3016> ald.ContractValue = ald.ContractSize / avd.QuotePoint * ald.NominalPoint ; //<3017> ald.OrderPoint = ald.NominalPoint * ald.ContractSize ; //<3018> ali.OrderLifetime = TimeCurrent () - OrderOpenTime () ; //<3019> //<3020> ald.QuotePrice = OrderOpenPrice () ; //<3021> ald.QuoteTake = OrderTakeProfit () ; //<3022> ald.QuoteStop = OrderStopLoss () ; //<3023> //<3024> ald.QuoteTarget = MathAbs ( ald.QuotePrice - ald.QuoteTake ) ; //<3025> //<3026> if ( OrderType () == OP_BUY ) //<3027> ald.QuoteVAR = ald.QuoteStop - ald.QuotePrice ; //<3028> else ald.QuoteVAR = ald.QuotePrice - ald.QuoteStop ; //<3029> //<3030> ald.OrderProfit = OrderProfit () ; //<3031> ald.OrderTarget = ald.QuoteTarget * ald.ContractValue ; //<3032> ald.OrderVAR = ald.QuoteVAR * ald.ContractValue ; //<3033> ald.OrderLimit = ald.VARLimit ; //<3034> //<3035> ali.OrderProfit = MathRound ( ald.OrderProfit / ald.OrderPoint ) ; //<3036> ali.OrderTarget = MathRound ( ald.QuoteTarget / avd.QuotePoint ) ; //<3037> ali.OrderVAR = MathRound ( ald.QuoteVAR / avd.QuotePoint ) ; //<3038> ali.OrderLimit = MathRound ( ald.OrderLimit / ald.OrderPoint ) ; //<3039> //<3040> als.OrderData = "#" + OrderTicket () + " " + //<3041> acs.Operation [ OrderType () ] + " " + //<3042> DoubleToStr ( ald.ContractSize , 2 ) + " x " + //<3043> DoubleToStr ( ali.LotSize , 0 ) + " " + //<3044> als.OrderCurrency [ ari.Margin ] + " / " + //<3045> ali.MarginPoints + " x " + //<3046> DoubleToStr ( ald.OrderPoint , 2 ) + " / " + //<3047> afs.Interval ( ali.OrderLifetime , 1 ) ; //<3048> } // for //<3049> } // if //<3050> else afr.DeleteOrderLevels () ; //<3051> //<3052> if ( ald.OrderProfit > 0 ) string als.OPSign = "+" ; //<3053> else als.OPSign = "" ; //<3054> //<3055> if ( ald.OrderTarget > 0 ) string als.OTSign = "+" ; //<3056> else als.OTSign = "" ; //<3057> //<3058> if ( ald.OrderVAR > 0 ) string als.OVSign = "+" ; //<3059> else als.OVSign = "" ; //<3060> //<3061> if ( ald.QuotePrice > 0 ) string als.OrderPrice = DoubleToStr ( ald.QuotePrice , avi.Digits ) ; //<3062> else als.OrderPrice = "" ; //<3063> //<3064> if ( ald.QuoteTake > 0 ) string als.OrderTake = DoubleToStr ( ald.QuoteTake , avi.Digits ) ; //<3065> else als.OrderTake = "" ; //<3066> //<3067> if ( ald.QuoteStop > 0 ) string als.OrderStop = DoubleToStr ( ald.QuoteStop , avi.Digits ) ; //<3068> else als.OrderStop = "" ; //<3069> //<3070> afr.SetText.1 ( 14 , 1 , 0 , als.OrderData ) ; //<3071> afr.SetText.1 ( 15 , 1 , 0 , "Profit:" ) ; //<3072> afr.SetText.1 ( 15 , 23 , 1 , als.OPSign + DoubleToStr ( ald.OrderProfit , 2 ) ) ; //<3073> afr.SetText.1 ( 15 , 32 , 1 , als.OPSign + ali.OrderProfit ) ; //<3074> afr.SetText.1 ( 15 , 45 , 1 , als.OPSign + DoubleToStr ( ald.OrderProfit / AccountEquity () * 100 , 2 ) //<3075> + "%" ) ; //<3076> afr.SetText.1 ( 15 , 55 , 1 , als.OrderPrice ) ; //<3077> afr.SetText.1 ( 16 , 1 , 0 , "Target:" ) ; //<3078> afr.SetText.1 ( 16 , 23 , 1 , als.OTSign + DoubleToStr ( ald.OrderTarget , 2 ) ) ; //<3079> afr.SetText.1 ( 16 , 32 , 1 , als.OTSign + ali.OrderTarget ) ; //<3080> afr.SetText.1 ( 16 , 45 , 1 , als.OTSign + DoubleToStr ( ald.OrderTarget / AccountEquity () * 100 , 2 ) //<3081> + "%" ) ; //<3082> afr.SetText.1 ( 16 , 55 , 1 , als.OrderTake ) ; //<3083> afr.SetText.1 ( 17 , 1 , 0 , "VAR:" ) ; //<3084> afr.SetText.1 ( 17 , 23 , 1 , als.OVSign + DoubleToStr ( ald.OrderVAR , 2 ) ) ; //<3085> afr.SetText.1 ( 17 , 32 , 1 , als.OVSign + ali.OrderVAR ) ; //<3086> afr.SetText.1 ( 17 , 45 , 1 , als.OVSign + DoubleToStr ( ald.OrderVAR / AccountEquity () * 100 , 2 ) //<3087> + "%" ) ; //<3088> afr.SetText.1 ( 17 , 55 , 1 , als.OrderStop ) ; //<3089> afr.SetText.1 ( 18 , 1 , 0 , "Limit:" ) ; //<3090> afr.SetText.1 ( 18 , 23 , 1 , DoubleToStr ( - ald.VARLimit , 2 ) ) ; //<3091> afr.SetText.1 ( 18 , 32 , 1 , "-" + ali.OrderLimit ) ; //<3092> afr.SetText.1 ( 18 , 45 , 1 , "-" + DoubleToStr ( avd.OrderReserve * 100 , 2 ) + "%" ) ; //<3093> // //<3094> //<3095> //< 4216.6. Leverage/Contract Specification Indicator 14 > //<3096> string als.Leverage = "1:" + //<3097> AccountLeverage () + " / " + //<3098> DoubleToStr ( avd.NominalMargin , 2 ) + " " + //<3099> arn.Currency [ ari.Account ] + " = " + //<3100> ali.MarginPoints + " points x " + //<3101> DoubleToStr ( ald.NominalPoint , 2 ) + " " + //<3102> arn.Currency [ ari.Account ] ; //<3103> //<3104> string als.Contract = DoubleToStr ( MarketInfo ( aes.Symbol , MODE_LOTSIZE ) , 2 ) + " " + //<3105> arn.Currency [ ari.Margin ] + " / " + //<3106> DoubleToStr ( MarketInfo ( aes.Symbol , MODE_MINLOT ) , 2 ) + " / " + //<3107> DoubleToStr ( MarketInfo ( aes.Symbol , MODE_LOTSTEP ) , 2 ) + " / " + //<3108> DoubleToStr ( MarketInfo ( aes.Symbol , MODE_MAXLOT ) , 2 ) + " / " + //<3109> DoubleToStr ( avd.RealSpread / avd.QuotePoint , 0 ) + "/" + //<3110> DoubleToStr ( avd.RealSpread / avd.QuotePoint , 0 ) ; //<3111> //<3112> afr.SetText.1 ( 20 , 1 , 0 , "Leverage: " + als.Leverage ) ; //<3113> afr.SetText.1 ( 21 , 1 , 0 , "Contract: " + als.Contract ) ; //<3114> // //<3115> //<3116> //< 4216.7. Reserved 25 > //<3117> afr.SetText.1 ( 23 , 1 , 0 , 23 ) ; //<3118> afr.SetText.1 ( 24 , 1 , 0 , 24 ) ; //<3119> afr.SetText.1 ( 25 , 1 , 0 , 25 ) ; //<3120> afr.SetText.1 ( 26 , 1 , 0 , 26 ) ; //<3121> afr.SetText.1 ( 27 , 1 , 0 , 27 ) ; //<3122> afr.SetText.1 ( 28 , 1 , 0 , 28 ) ; //<3123> afr.SetText.1 ( 29 , 1 , 0 , 29 ) ; //<3124> afr.SetText.1 ( 30 , 1 , 0 , 30 ) ; //<3125> afr.SetText.1 ( 31 , 1 , 0 , 31 ) ; //<3126> afr.SetText.1 ( 32 , 1 , 0 , 32 ) ; //<3127> afr.SetText.1 ( 33 , 1 , 0 , 33 ) ; //<3128> afr.SetText.1 ( 34 , 1 , 0 , 34 ) ; //<3129> afr.SetText.1 ( 35 , 1 , 0 , 35 ) ; //<3130> afr.SetText.1 ( 36 , 1 , 0 , 36 ) ; //<3131> afr.SetText.1 ( 37 , 1 , 0 , 37 ) ; //<3132> afr.SetText.1 ( 38 , 1 , 0 , 38 ) ; //<3133> afr.SetText.1 ( 39 , 1 , 0 , 39 ) ; //<3134> afr.SetText.1 ( 40 , 1 , 0 , 40 ) ; //<3135> afr.SetText.1 ( 41 , 1 , 0 , 41 ) ; //<3136> afr.SetText.1 ( 42 , 1 , 0 , 42 ) ; //<3137> afr.SetText.1 ( 43 , 1 , 0 , 43 ) ; //<3138> afr.SetText.1 ( 44 , 1 , 0 , 44 ) ; //<3139> afr.SetText.1 ( 45 , 1 , 0 , 45 ) ; //<3140> afr.SetText.1 ( 46 , 1 , 0 , 46 ) ; //<3141> afr.SetText.1 ( 47 , 1 , 0 , 47 ) ; //<3142> // //<3143> } //<3144> //````````````````````````````````````````````````````````````//<3145> //<3146> //< A.System.Extra: Control Module Function 2221 >````````````````````````````````````````````````````````````//<3147> int afr.Report.2 () // - elements // input - / code - / output - //<3148> { //<3149> //< 4217.1. Preparation > //<3150> static int ali.Trigger ; if ( ! ali.Trigger ) { ali.Trigger = 1 ; //<3151> static string avs.StreamLine.1 ; avs.StreamLine.1 = StringSubstr ( acs.Blank , 1 ) ; //<3152> static string avs.StreamLine.2 ; avs.StreamLine.2 = StringSubstr ( acs.Blank , 1 ) ; //<3153> static string avs.StreamLine.3 ; avs.StreamLine.3 = StringSubstr ( acs.Blank , 1 ) ; //<3154> static string avs.StreamLine.4 ; avs.StreamLine.4 = StringSubstr ( acs.Blank , 1 ) ; //<3155> static string avs.StreamLine.5 ; avs.StreamLine.5 = StringSubstr ( acs.Blank , 1 ) ; //<3156> static string avs.StreamLine.6 ; avs.StreamLine.6 = StringSubstr ( acs.Blank , 1 ) ; //<3157> } //<3158> // //<3159> //<3160> //< 4217.4. Processing Log Report > //<3189> if ( arv.1 [ ari.1.NewFrames ] > 0 ) //<3190> { //<3188> static int ali.Reports ; ali.Reports ++ ; //<1674> //<1675> int ali.VolumeProfile = arv.P.1 [ ari.P.Volume ] //<1675> + arv.P.2 [ ari.P.Volume ] //<1675> + arv.P.3 [ ari.P.Volume ] ; //<1675> //<1675> int ali.VolumeZones = arv.Z [ ari.Z.Volume.1 ] ; //<1680> //<1675> Print ( avs.SystemStamp , ": Processing Report " , ali.Reports , " " , //<1676> " Profile Volume = " , ali.VolumeProfile , //<1676> " Zones Volume = " , ali.VolumeZones , //<1680> " Miscount = " , ali.VolumeProfile - ali.VolumeZones ) ; //<1680> //<1675> //<1675> Print ( avs.SystemStamp , ": Total Zone Report " , ali.Reports , " " , //<1676> arv.Z [ ari.Z.IndexShift ] , "/" , //<1677> arv.Z [ ari.Z.IndexRange ] , "/" , //<1678> arv.Z [ ari.Z.IndexCurrent ] , " " , //<1679> arv.Z [ ari.Z.Volume.1 ] , "/" , //<1680> arv.Z [ ari.Z.Volume.0 ] , " " , //<1681> arv.Z [ ari.Z.VolumeMean.1 ] , "/" , //<1682> arv.Z [ ari.Z.VolumeMean.0 ] , " " , //<1683> arv.Z [ ari.Z.IndexMax.1 ] , "/" , //<1684> arv.Z [ ari.Z.IndexMax.0 ] , " " , //<1685> arv.Z [ ari.Z.VolumeMax.1 ] , "/" , //<1686> arv.Z [ ari.Z.VolumeMax.0 ] ) ; //<1687> //<1688> Print ( avs.SystemStamp , ": Chart Zone Report " , ali.Reports , " " , //<1689> arv.Z [ ari.Z.IndexChartHighest ] , "/" , //<1690> arv.Z [ ari.Z.IndexChartLowest ] , "/" , //<1691> arv.Z [ ari.Z.IndexChartRange ] , " " , //<1692> arv.Z [ ari.Z.VolumeChart.1 ] , "/" , //<1693> arv.Z [ ari.Z.VolumeChart.0 ] , " " , //<1694> arv.Z [ ari.Z.VolumeChartMean.1 ] , "/" , //<1695> arv.Z [ ari.Z.VolumeChartMean.0 ] , " " , //<1696> arv.Z [ ari.Z.IndexChartMax.1 ] , "/" , //<1697> arv.Z [ ari.Z.IndexChartMax.0 ] , " " , //<1698> arv.Z [ ari.Z.VolumeChartMax.1 ] , "/" , //<1699> arv.Z [ ari.Z.VolumeChartMax.0 ] ) ; //<1700> } //<3196> // //<3189> //<1702> //< 4217.3. Market Profiles > //<3165> afr.SetText.2 ( 2 , 16 , 1 , arv.P.1 [ ari.P.Frames ] ) ; //<3166> afr.SetText.2 ( 3 , 16 , 1 , arv.P.1 [ ari.P.Volume ] ) ; //<3167> afr.SetText.2 ( 4 , 16 , 1 , afs.Time ( arv.P.1 [ ari.P.TimeBegin ] ) ) ; //<3168> afr.SetText.2 ( 5 , 16 , 1 , afs.Time ( arv.P.1 [ ari.P.TimeEnd ] ) ) ; //<3169> //<3170> afr.SetText.2 ( 2 , 34 , 1 , arv.P.2 [ ari.P.Frames ] ) ; //<3171> afr.SetText.2 ( 3 , 34 , 1 , arv.P.2 [ ari.P.Volume ] ) ; //<3172> afr.SetText.2 ( 4 , 34 , 1 , afs.Time ( arv.P.2 [ ari.P.TimeBegin ] ) ) ; //<3173> afr.SetText.2 ( 5 , 34 , 1 , afs.Time ( arv.P.2 [ ari.P.TimeEnd ] ) ) ; //<3174> //<3175> afr.SetText.2 ( 2 , 37 , 0 , arv.P.3 [ ari.P.Frames ] ) ; //<3176> afr.SetText.2 ( 3 , 37 , 0 , arv.P.3 [ ari.P.Volume ] ) ; //<3177> afr.SetText.2 ( 4 , 52 , 1 , afs.Time ( arv.P.3 [ ari.P.TimeBegin ] ) ) ; //<3178> afr.SetText.2 ( 5 , 52 , 1 , afs.Time ( arv.P.3 [ ari.P.TimeEnd ] ) ) ; //<3179> // //<3180> //<3181> //< 4217.4. M1 Series > //<3182> if ( arv.1 [ ari.1.Series ] > 0 ) int ali.Sign = '+' ; //<3183> else ali.Sign = ' ' ; //<3184> //<3185> afr.SetText.2 ( 2 , 45 , 1 , CharToStr ( ali.Sign ) + arv.1 [ ari.1.Series ] ) ; //<3186> // //<3187> //<3188> //< 4217.4. Data Integrity Check > //<3189> if ( arv.1 [ ari.1.NewFrames ] > 0 ) //<3190> { //<3188> int ali.IndexBegin = iBarShift ( aes.Symbol , PERIOD_M1 , arv.P.3 [ ari.P.TimeBegin ] ) ; //<3191> static int ali.CheckFrames ; ali.CheckFrames = ali.IndexBegin ; //<3192> static int ali.CheckVolume ; ali.CheckVolume = 0 ; //<3193> for ( int i = 1 ; i <= ali.CheckFrames ; i ++ ) //<3194> ali.CheckVolume = ali.CheckVolume + iVolume ( aes.Symbol , PERIOD_M1 , i ) ; //<3195> } //<3196> //<3197> afr.SetText.2 ( 2 , 52 , 1 , ali.CheckFrames ) ; //<3198> afr.SetText.2 ( 3 , 52 , 1 , ali.CheckVolume ) ; //<3199> // //<3200> //<3188> //< 4217.5. Market Profile Range > //<3202> afr.SetText.2 ( 2 , 63 , 1 , arv.P.3 [ ari.P.PriceHighest ] ) ; //<3203> afr.SetText.2 ( 3 , 63 , 1 , arv.P.3 [ ari.P.PriceRange ] ) ; //<3205> afr.SetText.2 ( 4 , 63 , 1 , arv.P.3 [ ari.P.PriceLowest ] ) ; //<3204> //<3206> afr.SetText.2 ( 5 , 63 , 1 , arv.1 [ ari.1.Length.0 ] + "/" + //<3207> arv.1 [ ari.1.Length ] + "=" + //<3208> arv.1 [ ari.1.Completeness.0 ] + "%" ) ; //<3209> // //<3210> //<3211> //< 4217.6. Timeframe Register > //<3212> if ( arv.1 [ ari.1.Volume.1 ] > 0 ) //<3213> int ali.VolumesRatio.0 = MathRound ( 100.0 * arv.1 [ ari.1.Volume.0 ] / arv.1 [ ari.1.Volume.1 ] ) ; //<3214> else ali.VolumesRatio.0 = 0 ; //<3215> //<3216> int ali.VolumesRatio.1 = MathRound ( arv.1 [ ari.1.Volume.0 ] / arv.P.1 [ ari.P.MaxVolume ] * 100 ) ; //<3217> int ali.VolumesRatio.2 = MathRound ( arv.1 [ ari.1.Volume.0 ] / arv.P.2 [ ari.P.MaxVolume ] * 100 ) ; //<3218> int ali.VolumesRatio.3 = MathRound ( arv.1 [ ari.1.Volume.0 ] / arv.P.3 [ ari.P.MaxVolume ] * 100 ) ; //<3219> //<3220> if ( arv.1 [ ari.1.Range.1 ] > 0 ) //<3221> int ali.RangeRatio.0 = MathRound ( 100.0 * arv.1 [ ari.1.Range.0 ] / arv.1 [ ari.1.Range.1 ] ) ; //<3222> else ali.RangeRatio.0 = 0 ; //<3223> //<3224> int ali.RangeRatio.1 = MathRound ( arv.1 [ ari.1.Range.0 ] / arv.P.1 [ ari.P.MaxRange ] * 100 ) ; //<3225> int ali.RangeRatio.2 = MathRound ( arv.1 [ ari.1.Range.0 ] / arv.P.2 [ ari.P.MaxRange ] * 100 ) ; //<3226> int ali.RangeRatio.3 = MathRound ( arv.1 [ ari.1.Range.0 ] / arv.P.3 [ ari.P.MaxRange ] * 100 ) ; //<3227> //<3228> afr.SetText.2 ( 7 , 16 , 1 , arv.1 [ ari.1.Range.0 ] + "/" + //<3229> arv.P.1 [ ari.P.MaxRange ] + "=" + //<3230> ali.RangeRatio.1 + "%" ) ; //<3231> afr.SetText.2 ( 8 , 16 , 1 , arv.1 [ ari.1.Volume.0 ] + "/" + //<3232> arv.P.1 [ ari.P.MaxVolume ] + "=" + //<3233> ali.VolumesRatio.1 + "%" ) ; //<3234> //<3235> afr.SetText.2 ( 7 , 34 , 1 , arv.1 [ ari.1.Range.0 ] + "/" + //<3236> arv.P.2 [ ari.P.MaxRange ] + "=" + //<3237> ali.RangeRatio.2 + "%" ) ; //<3238> afr.SetText.2 ( 8 , 34 , 1 , arv.1 [ ari.1.Volume.0 ] + "/" + //<3239> arv.P.2 [ ari.P.MaxVolume ] + "=" + //<3240> ali.VolumesRatio.2 + "%" ) ; //<3241> //<3242> afr.SetText.2 ( 7 , 52 , 1 , arv.1 [ ari.1.Range.0 ] + "/" + //<3243> arv.P.3 [ ari.P.MaxRange ] + "=" + //<3244> ali.RangeRatio.3 + "%" ) ; //<3245> afr.SetText.2 ( 8 , 52 , 1 , arv.1 [ ari.1.Volume.0 ] + "/" + //<3246> arv.P.3 [ ari.P.MaxVolume ] + "=" + //<3247> ali.VolumesRatio.3 + "%" ) ; //<3248> //<3249> afr.SetText.2 ( 7 , 63 , 1 , arv.1 [ ari.1.Range.0 ] + "/" + //<3250> arv.1 [ ari.1.Range.1 ] + "=" + //<3251> ali.RangeRatio.0 + "%" ) ; //<3252> afr.SetText.2 ( 8 , 63 , 1 , arv.1 [ ari.1.Volume.0 ] + "/" + //<3253> arv.1 [ ari.1.Volume.1 ] + "=" + //<3254> ali.VolumesRatio.0 + "%" ) ; //<3255> // //<3256> //<3257> //< 4217.7. Stream Lines > //<3258> string als.BufferBlank = " " ; //<3259> string als.BufferSign ; //<3260> string als.Buffer ; //<3261> //<3262> als.Buffer = arv.S.Volume [ 1 ] ; //<3263> als.Buffer = StringSubstr ( als.BufferBlank + als.Buffer , StringLen ( als.Buffer ) ) ; //<3264> avs.StreamLine.1 = StringSubstr ( avs.StreamLine.1 + als.Buffer , 7 ) ; //<3265> //<3266> als.Buffer = DoubleToStr ( arv.S.Latency [ 1 ] / 1000.0 , 3 ) ; //<3267> als.Buffer = StringSubstr ( als.BufferBlank + als.Buffer , StringLen ( als.Buffer ) ) ; //<3268> avs.StreamLine.2 = StringSubstr ( avs.StreamLine.2 + als.Buffer , 7 ) ; //<3269> //<3270> if ( arv.S.Fluctuation [ 1 ] > 0 ) als.BufferSign = "+" ; //<3271> else als.BufferSign = "" ; //<3272> als.Buffer = als.BufferSign + arv.S.Fluctuation [ 1 ] ; //<3273> als.Buffer = StringSubstr ( als.BufferBlank + als.Buffer , StringLen ( als.Buffer ) ) ; //<3274> avs.StreamLine.3 = StringSubstr ( avs.StreamLine.3 + als.Buffer , 7 ) ; //<3275> als.Buffer = als.BufferSign + arv.S.Fluctuation [ 0 ] ; //<3276> avs.StreamLine.3 = als.Buffer + StringSubstr ( avs.StreamLine.3 , StringLen ( als.Buffer ) ) ; //<3277> //<3278> if ( arv.S.TotalFluctuation [ 1 ] > 0 ) als.BufferSign = "+" ; //<3279> else als.BufferSign = "" ; //<3280> als.Buffer = als.BufferSign + arv.S.TotalFluctuation [ 1 ] ; //<3281> als.Buffer = StringSubstr ( als.BufferBlank + als.Buffer , StringLen ( als.Buffer ) ) ; //<3282> avs.StreamLine.4 = StringSubstr ( avs.StreamLine.4 + als.Buffer , 7 ) ; //<3283> als.Buffer = als.BufferSign + arv.S.TotalFluctuation [ 0 ] ; //<3284> avs.StreamLine.4 = als.Buffer + StringSubstr ( avs.StreamLine.4 , StringLen ( als.Buffer ) ) ; //<3285> //<3286> als.Buffer = DoubleToStr ( arv.S.TotalLatency [ 1 ] / 1000.0 , 3 ) ; //<3287> als.Buffer = StringSubstr ( als.BufferBlank + als.Buffer , StringLen ( als.Buffer ) ) ; //<3288> avs.StreamLine.5 = StringSubstr ( avs.StreamLine.5 + als.Buffer , 7 ) ; //<3289> //<3290> als.Buffer = arv.S.TotalVolume [ 1 ] ; //<3291> als.Buffer = StringSubstr ( als.BufferBlank + als.Buffer , StringLen ( als.Buffer ) ) ; //<3292> avs.StreamLine.6 = StringSubstr ( avs.StreamLine.6 + als.Buffer , 7 ) ; //<3293> //<3294> afr.SetText.2 ( 9 , 63 , 1 , avs.StreamLine.1 ) ; //<3295> afr.SetText.2 ( 10 , 63 , 1 , avs.StreamLine.2 ) ; //<3296> afr.SetText.2 ( 11 , 63 , 1 , avs.StreamLine.3 ) ; //<3297> afr.SetText.2 ( 12 , 63 , 1 , avs.StreamLine.4 ) ; //<3298> afr.SetText.2 ( 13 , 63 , 1 , avs.StreamLine.5 ) ; //<3299> afr.SetText.2 ( 14 , 63 , 1 , avs.StreamLine.6 ) ; //<3300> // //<3301> //<3302> //< 4217.8. Volume Monitoring > //<3303> afr.SetText.2 ( 16 , 28 , 1 , "Total:" ) ; //<3304> afr.SetText.2 ( 17 , 28 , 1 , "1 x" ) ; //<3305> afr.SetText.2 ( 18 , 28 , 1 , "2 x" ) ; //<3306> afr.SetText.2 ( 19 , 28 , 1 , "3 x" ) ; //<3307> afr.SetText.2 ( 20 , 28 , 1 , "4 x" ) ; //<3308> afr.SetText.2 ( 21 , 28 , 1 , "5 x" ) ; //<3309> afr.SetText.2 ( 22 , 28 , 1 , "6 x" ) ; //<3310> afr.SetText.2 ( 23 , 28 , 1 , "7 x" ) ; //<3311> afr.SetText.2 ( 24 , 28 , 1 , "8 x" ) ; //<3312> afr.SetText.2 ( 25 , 28 , 1 , "9 x" ) ; //<3313> afr.SetText.2 ( 26 , 28 , 1 , "10 x" ) ; //<3314> afr.SetText.2 ( 27 , 28 , 1 , "Lost:" ) ; //<3315> //<3316> afr.SetText.2 ( 16 , 37 , 1 , arv.V.Volume [ ari.V.Total ] ) ; //<3317> afr.SetText.2 ( 16 , 63 , 1 , "+" + arv.F.Volume [ ari.F.Up ] //<3318> + "/-" + arv.F.Volume [ ari.F.Down ] //<3319> + "/" + arv.F.Volume [ ari.F.Zero ] //<3320> + "/" + arv.V.Volume [ ari.V.Lost ] ) ; //<3321> //<3322> for ( i = 1 ; i < ari.V.RegisterDimension ; i ++ ) //<3323> if ( arv.V.Volume [ i ] == 0 ) //<3324> afr.SetText.2 ( 16 + i , 63 , 1 , "" ) ; //<3325> else //<3326> { afr.SetText.2 ( 16 + i , 37 , 1 , arv.V.Volume [ i ] ) ; //<3327> afr.SetText.2 ( 16 + i , 63 , 1 , DoubleToStr ( arv.V.Latency [ i ] / 1000.0 , 3 ) + " " + //<3328> afs.Interval ( TimeCurrent () - arv.V.Time [ i ] , 1 ) + " " + //<3329> afs.Time ( arv.V.Time [ i ] , 2 ) ) ; //<3330> } //<3331> // //<3332> //<3333> //< 4217.9. Zone Monitoring > //<3348> //< Computing Optimization > //<3349> static int ali.FlagResetZones ; //<3350> static int ali.IndexCurrent ; //<3351> //<3352> if ( arv.1 [ ari.1.NewFrames ] > 0 //<3353> || arv.Z [ ari.Z.IndexCurrent ] != ali.IndexCurrent ) //<3354> { //<3355> ali.IndexCurrent = arv.Z [ ari.Z.IndexCurrent ] ; //<3356> ali.FlagResetZones = 1 ; //<3357> } //<3358> else ali.FlagResetZones = 0 ; //<3359> //< Computing Optimization > //<3360> //<3361> //< Zone Levels Indication > //<3362> if ( ali.FlagResetZones == 1 ) //<3363> { //<3364> static int ali.Level.Down.1 ; ali.Level.Down.1 = arv.Z [ ari.Z.BasePoints ] //<3365> + arv.Z [ ari.Z.StepPoints ] //<3366> * ( arv.Z [ ari.Z.IndexCurrent ] //<3367> + arv.Z [ ari.Z.IndexShift ] ) ; //<3368> //<3369> static int ali.Level.Down.2 ; ali.Level.Down.2 = ali.Level.Down.1 - arv.Z [ ari.Z.StepPoints ] ; //<3370> static int ali.Level.Down.3 ; ali.Level.Down.3 = ali.Level.Down.2 - arv.Z [ ari.Z.StepPoints ] ; //<3371> static int ali.Level.Down.4 ; ali.Level.Down.4 = ali.Level.Down.3 - arv.Z [ ari.Z.StepPoints ] ; //<3372> static int ali.Level.Up.1 ; ali.Level.Up.1 = ali.Level.Down.1 + arv.Z [ ari.Z.StepPoints ] ; //<3373> static int ali.Level.Up.2 ; ali.Level.Up.2 = ali.Level.Up.1 + arv.Z [ ari.Z.StepPoints ] ; //<3374> static int ali.Level.Up.3 ; ali.Level.Up.3 = ali.Level.Up.2 + arv.Z [ ari.Z.StepPoints ] ; //<3375> static int ali.Level.Up.4 ; ali.Level.Up.4 = ali.Level.Up.3 + arv.Z [ ari.Z.StepPoints ] ; //<3376> } //<3377> //<3378> afr.SetText.2 ( 31 , 1 , 0 , "+4: " + DoubleToStr ( ali.Level.Up.4 * avd.QuotePoint , avi.Digits ) ) ; //<3379> afr.SetText.2 ( 32 , 1 , 0 , "+3: " + DoubleToStr ( ali.Level.Up.3 * avd.QuotePoint , avi.Digits ) ) ; //<3380> afr.SetText.2 ( 33 , 1 , 0 , "+2: " + DoubleToStr ( ali.Level.Up.2 * avd.QuotePoint , avi.Digits ) ) ; //<3381> afr.SetText.2 ( 34 , 1 , 0 , "+1: " + DoubleToStr ( ali.Level.Up.1 * avd.QuotePoint , avi.Digits ) ) ; //<3382> afr.SetText.2 ( 35 , 1 , 0 , " 0: " + DoubleToStr ( avd.QuoteBid , avi.Digits ) ) ; //<3383> afr.SetText.2 ( 36 , 1 , 0 , "-1: " + DoubleToStr ( ali.Level.Down.1 * avd.QuotePoint , avi.Digits ) ) ; //<3384> afr.SetText.2 ( 37 , 1 , 0 , "-2: " + DoubleToStr ( ali.Level.Down.2 * avd.QuotePoint , avi.Digits ) ) ; //<3385> afr.SetText.2 ( 38 , 1 , 0 , "-3: " + DoubleToStr ( ali.Level.Down.3 * avd.QuotePoint , avi.Digits ) ) ; //<3386> afr.SetText.2 ( 39 , 1 , 0 , "-4: " + DoubleToStr ( ali.Level.Down.4 * avd.QuotePoint , avi.Digits ) ) ; //<3387> // //<3388> //<3389> // //<3390> if ( ali.FlagResetZones == 1 ) //<3391> { //<3392> static int ali.Volume.1.Up.4 ; //<3393> static int ali.Volume.1.Up.3 ; //<3394> static int ali.Volume.1.Up.2 ; //<3395> static int ali.Volume.1.Up.1 ; //<3396> static int ali.Volume.1.Current ; //<3397> static int ali.Volume.1.Down.1 ; //<3398> static int ali.Volume.1.Down.2 ; //<3399> static int ali.Volume.1.Down.3 ; //<3400> static int ali.Volume.1.Down.4 ; //<3401> //<3402> ali.Volume.1.Up.4 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] + 4 ] ) ; //<3403> ali.Volume.1.Up.3 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] + 3 ] ) ; //<3404> ali.Volume.1.Up.2 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] + 2 ] ) ; //<3405> ali.Volume.1.Up.1 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] + 1 ] ) ; //<3406> ali.Volume.1.Current = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] ] ) ; //<3407> ali.Volume.1.Down.1 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] - 1 ] ) ; //<3408> ali.Volume.1.Down.2 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] - 2 ] ) ; //<3409> ali.Volume.1.Down.3 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] - 3 ] ) ; //<3410> ali.Volume.1.Down.4 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] - 4 ] ) ; //<3411> //<3412> static int ali.RelToMax.1.Up.4 ; //<3393> static int ali.RelToMax.1.Up.3 ; //<3394> static int ali.RelToMax.1.Up.2 ; //<3395> static int ali.RelToMax.1.Up.1 ; //<3396> static int ali.RelToMax.1.Current ; //<3397> static int ali.RelToMax.1.Down.1 ; //<3398> static int ali.RelToMax.1.Down.2 ; //<3399> static int ali.RelToMax.1.Down.3 ; //<3400> static int ali.RelToMax.1.Down.4 ; //<3401> //<3402> double ald.Max = arv.Z [ ari.Z.VolumeMax.1 ] / 100.0 ; //<3412> //<3402> ali.RelToMax.1.Up.4 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] + 4 ] / ald.Max ) ; //<3403> ali.RelToMax.1.Up.3 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] + 3 ] / ald.Max ) ; //<3403> ali.RelToMax.1.Up.2 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] + 2 ] / ald.Max ) ; //<3403> ali.RelToMax.1.Up.1 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] + 1 ] / ald.Max ) ; //<3403> ali.RelToMax.1.Current = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] ] / ald.Max ) ; //<3403> ali.RelToMax.1.Down.1 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] - 1 ] / ald.Max ) ; //<3403> ali.RelToMax.1.Down.2 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] - 2 ] / ald.Max ) ; //<3403> ali.RelToMax.1.Down.3 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] - 3 ] / ald.Max ) ; //<3403> ali.RelToMax.1.Down.4 = MathRound ( avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] - 4 ] / ald.Max ) ; //<3403> //<3412> static double ald.RelToAver.1.Up.4 ; //<3393> static double ald.RelToAver.1.Up.3 ; //<3394> static double ald.RelToAver.1.Up.2 ; //<3395> static double ald.RelToAver.1.Up.1 ; //<3396> static double ald.RelToAver.1.Current ; //<3397> static double ald.RelToAver.1.Down.1 ; //<3398> static double ald.RelToAver.1.Down.2 ; //<3399> static double ald.RelToAver.1.Down.3 ; //<3400> static double ald.RelToAver.1.Down.4 ; //<3401> //<3402> double ald.Mean = arv.Z [ ari.Z.VolumeMean.1 ] ; //<3412> //<3402> ald.RelToAver.1.Up.4 = avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] + 4 ] / ald.Mean ; //<3403> ald.RelToAver.1.Up.3 = avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] + 3 ] / ald.Mean ; //<3403> ald.RelToAver.1.Up.2 = avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] + 2 ] / ald.Mean ; //<3403> ald.RelToAver.1.Up.1 = avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] + 1 ] / ald.Mean ; //<3403> ald.RelToAver.1.Current = avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] ] / ald.Mean ; //<3403> ald.RelToAver.1.Down.1 = avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] - 1 ] / ald.Mean ; //<3403> ald.RelToAver.1.Down.2 = avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] - 2 ] / ald.Mean ; //<3403> ald.RelToAver.1.Down.3 = avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] - 3 ] / ald.Mean ; //<3403> ald.RelToAver.1.Down.4 = avd.Zone.1 [ arv.Z [ ari.Z.IndexCurrent ] - 4 ] / ald.Mean ; //<3403> //<3412> static int ali.Volume.1.Up.04 ; //<3413> static int ali.Volume.1.Up.03 ; //<3414> static int ali.Volume.1.Up.02 ; //<3415> static int ali.Volume.1.Difference ; //<3416> static int ali.Volume.1.Down.02 ; //<3417> static int ali.Volume.1.Down.03 ; //<3418> static int ali.Volume.1.Down.04 ; //<3419> //<3420> ali.Volume.1.Up.02 = ali.Volume.1.Up.1 + ali.Volume.1.Up.2 ; //<3421> ali.Volume.1.Up.03 = ali.Volume.1.Up.02 + ali.Volume.1.Up.3 ; //<3422> ali.Volume.1.Up.04 = ali.Volume.1.Up.03 + ali.Volume.1.Up.4 ; //<3423> //<3424> ali.Volume.1.Down.02 = ali.Volume.1.Down.1 + ali.Volume.1.Down.2 ; //<3425> ali.Volume.1.Down.03 = ali.Volume.1.Down.02 + ali.Volume.1.Down.3 ; //<3426> ali.Volume.1.Down.04 = ali.Volume.1.Down.03 + ali.Volume.1.Down.4 ; //<3427> //<3428> ali.Volume.1.Difference = ali.Volume.1.Up.04 - ali.Volume.1.Down.04 ; //<3429> //<3430> static string als.Sign.1.Difference ; //<3431> if ( ali.Volume.1.Difference > 0 ) als.Sign.1.Difference = "+" ; //<3432> else als.Sign.1.Difference = "" ; //<3433> } // if //<3438> //<3434> afr.SetText.2 ( 29 , 18 , 1 , arv.Z [ ari.Z.VolumeMax.1 ] ) ; //<3513> afr.SetText.2 ( 29 , 34 , 1 , arv.Z [ ari.Z.VolumeMean.1 ] ) ; //<3513> afr.SetText.2 ( 29 , 43 , 1 , arv.Z [ ari.Z.Volume.1 ] ) ; //<3440> //<3441> afr.SetText.2 ( 31 , 18 , 1 , ali.RelToMax.1.Up.4 ) ; //<3442> afr.SetText.2 ( 32 , 18 , 1 , ali.RelToMax.1.Up.3 ) ; //<3443> afr.SetText.2 ( 33 , 18 , 1 , ali.RelToMax.1.Up.2 ) ; //<3444> afr.SetText.2 ( 34 , 18 , 1 , ali.RelToMax.1.Up.1 ) ; //<3445> afr.SetText.2 ( 35 , 18 , 1 , ali.RelToMax.1.Current ) ; //<3446> afr.SetText.2 ( 36 , 18 , 1 , ali.RelToMax.1.Down.1 ) ; //<3447> afr.SetText.2 ( 37 , 18 , 1 , ali.RelToMax.1.Down.2 ) ; //<3448> afr.SetText.2 ( 38 , 18 , 1 , ali.RelToMax.1.Down.3 ) ; //<3449> afr.SetText.2 ( 39 , 18 , 1 , ali.RelToMax.1.Down.4 ) ; //<3450> //<3451> afr.SetText.2 ( 31 , 34 , 1 , ali.Volume.1.Up.4 ) ; //<3442> afr.SetText.2 ( 32 , 34 , 1 , ali.Volume.1.Up.3 ) ; //<3443> afr.SetText.2 ( 33 , 34 , 1 , ali.Volume.1.Up.2 ) ; //<3444> afr.SetText.2 ( 34 , 34 , 1 , ali.Volume.1.Up.1 ) ; //<3445> afr.SetText.2 ( 35 , 34 , 1 , ali.Volume.1.Current ) ; //<3446> afr.SetText.2 ( 36 , 34 , 1 , ali.Volume.1.Down.1 ) ; //<3447> afr.SetText.2 ( 37 , 34 , 1 , ali.Volume.1.Down.2 ) ; //<3448> afr.SetText.2 ( 38 , 34 , 1 , ali.Volume.1.Down.3 ) ; //<3449> afr.SetText.2 ( 39 , 34 , 1 , ali.Volume.1.Down.4 ) ; //<3450> //<3451> afr.SetText.2 ( 31 , 43 , 1 , ali.Volume.1.Up.04 ) ; //<3452> afr.SetText.2 ( 32 , 43 , 1 , ali.Volume.1.Up.03 ) ; //<3453> afr.SetText.2 ( 33 , 43 , 1 , ali.Volume.1.Up.02 ) ; //<3454> afr.SetText.2 ( 34 , 43 , 1 , ali.Volume.1.Up.1 ) ; //<3455> afr.SetText.2 ( 35 , 43 , 1 , als.Sign.1.Difference + ali.Volume.1.Difference ) ; //<3456> afr.SetText.2 ( 36 , 43 , 1 , ali.Volume.1.Down.1 ) ; //<3457> afr.SetText.2 ( 37 , 43 , 1 , ali.Volume.1.Down.02 ) ; //<3458> afr.SetText.2 ( 38 , 43 , 1 , ali.Volume.1.Down.03 ) ; //<3459> afr.SetText.2 ( 39 , 43 , 1 , ali.Volume.1.Down.04 ) ; //<3460> // //<3461> //<3462> // //<3463> if ( ali.FlagResetZones == 1 ) //<3464> { //<3465> static int ali.Volume.0.Up.4 ; //<3466> static int ali.Volume.0.Up.3 ; //<3467> static int ali.Volume.0.Up.2 ; //<3468> static int ali.Volume.0.Up.1 ; //<3469> static int ali.Volume.0.Current ; //<3470> static int ali.Volume.0.Down.1 ; //<3471> static int ali.Volume.0.Down.2 ; //<3472> static int ali.Volume.0.Down.3 ; //<3473> static int ali.Volume.0.Down.4 ; //<3474> //<3475> ali.Volume.0.Up.4 = MathRound ( avd.Zone.0 [ arv.Z [ ari.Z.IndexCurrent ] + 4 ] ) ; //<3476> ali.Volume.0.Up.3 = MathRound ( avd.Zone.0 [ arv.Z [ ari.Z.IndexCurrent ] + 3 ] ) ; //<3477> ali.Volume.0.Up.2 = MathRound ( avd.Zone.0 [ arv.Z [ ari.Z.IndexCurrent ] + 2 ] ) ; //<3478> ali.Volume.0.Up.1 = MathRound ( avd.Zone.0 [ arv.Z [ ari.Z.IndexCurrent ] + 1 ] ) ; //<3479> ali.Volume.0.Current = MathRound ( avd.Zone.0 [ arv.Z [ ari.Z.IndexCurrent ] ] ) ; //<3480> ali.Volume.0.Down.1 = MathRound ( avd.Zone.0 [ arv.Z [ ari.Z.IndexCurrent ] - 1 ] ) ; //<3481> ali.Volume.0.Down.2 = MathRound ( avd.Zone.0 [ arv.Z [ ari.Z.IndexCurrent ] - 2 ] ) ; //<3482> ali.Volume.0.Down.3 = MathRound ( avd.Zone.0 [ arv.Z [ ari.Z.IndexCurrent ] - 3 ] ) ; //<3483> ali.Volume.0.Down.4 = MathRound ( avd.Zone.0 [ arv.Z [ ari.Z.IndexCurrent ] - 4 ] ) ; //<3484> //<3485> static int ali.Volume.0.Up.04 ; //<3486> static int ali.Volume.0.Up.03 ; //<3487> static int ali.Volume.0.Up.02 ; //<3488> static int ali.Volume.0.Difference ; //<3489> static int ali.Volume.0.Down.02 ; //<3490> static int ali.Volume.0.Down.03 ; //<3491> static int ali.Volume.0.Down.04 ; //<3492> //<3493> ali.Volume.0.Up.02 = ali.Volume.0.Up.1 + ali.Volume.0.Up.2 ; //<3494> ali.Volume.0.Up.03 = ali.Volume.0.Up.02 + ali.Volume.0.Up.3 ; //<3495> ali.Volume.0.Up.04 = ali.Volume.0.Up.03 + ali.Volume.0.Up.4 ; //<3496> //<3497> ali.Volume.0.Down.02 = ali.Volume.0.Down.1 + ali.Volume.0.Down.2 ; //<3498> ali.Volume.0.Down.03 = ali.Volume.0.Down.02 + ali.Volume.0.Down.3 ; //<3499> ali.Volume.0.Down.04 = ali.Volume.0.Down.03 + ali.Volume.0.Down.4 ; //<3500> //<3501> ali.Volume.0.Difference = ali.Volume.0.Up.04 - ali.Volume.0.Down.04 ; //<3502> //<3503> static string als.Sign.0.Difference ; //<3504> if ( ali.Volume.0.Difference > 0 ) als.Sign.0.Difference = "+" ; //<3505> else als.Sign.0.Difference = "" ; //<3506> } // if //<3511> //<3512> afr.SetText.2 ( 29 , 54 , 1 , arv.Z [ ari.Z.VolumeChartMean.0 ] ) ; //<3513> afr.SetText.2 ( 29 , 63 , 1 , arv.Z [ ari.Z.Volume.0 ] ) ; //<3440> //<3514> afr.SetText.2 ( 31 , 54 , 1 , ali.Volume.0.Up.4 ) ; //<3515> afr.SetText.2 ( 32 , 54 , 1 , ali.Volume.0.Up.3 ) ; //<3516> afr.SetText.2 ( 33 , 54 , 1 , ali.Volume.0.Up.2 ) ; //<3517> afr.SetText.2 ( 34 , 54 , 1 , ali.Volume.0.Up.1 ) ; //<3518> afr.SetText.2 ( 35 , 54 , 1 , ali.Volume.0.Current ) ; //<3519> afr.SetText.2 ( 36 , 54 , 1 , ali.Volume.0.Down.1 ) ; //<3520> afr.SetText.2 ( 37 , 54 , 1 , ali.Volume.0.Down.2 ) ; //<3521> afr.SetText.2 ( 38 , 54 , 1 , ali.Volume.0.Down.3 ) ; //<3522> afr.SetText.2 ( 39 , 54 , 1 , ali.Volume.0.Down.4 ) ; //<3523> //<3524> afr.SetText.2 ( 31 , 63 , 1 , ali.Volume.0.Up.04 ) ; //<3525> afr.SetText.2 ( 32 , 63 , 1 , ali.Volume.0.Up.03 ) ; //<3526> afr.SetText.2 ( 33 , 63 , 1 , ali.Volume.0.Up.02 ) ; //<3527> afr.SetText.2 ( 34 , 63 , 1 , ali.Volume.0.Up.1 ) ; //<3528> afr.SetText.2 ( 35 , 63 , 1 , als.Sign.0.Difference + ali.Volume.0.Difference ) ; //<3529> afr.SetText.2 ( 36 , 63 , 1 , ali.Volume.0.Down.1 ) ; //<3530> afr.SetText.2 ( 37 , 63 , 1 , ali.Volume.0.Down.02 ) ; //<3531> afr.SetText.2 ( 38 , 63 , 1 , ali.Volume.0.Down.03 ) ; //<3532> afr.SetText.2 ( 39 , 63 , 1 , ali.Volume.0.Down.04 ) ; //<3533> // //<3534> // //<3535> //<3164> //< 4217.2. Header 1 > //<3161> avi.MonitoringRunTime = GetTickCount () - avi.MonitoringRunTime ; //<1737> //<3164> afr.SetText.2 ( 0 , 1 , 0 , "Run Time " + avi.ProcessingRunTime + "/" + avi.MonitoringRunTime + " ms: " //<3162> + avs.ProcessingMessage ) ; //<3162> // //<3163> } //<3536> //````````````````````````````````````````````````````````````//<3537> //<3538> //< A.System.Indicator: Function 5 >`````````````````````````````````````````````````````````````````````````//<3539> int afr.CreateText ( // - elements // input - / code - / output - //<3540> string aas.Name , //<3541> int aai.Color , //<3542> int aai.Size , //<3543> int aai.Time , //<3544> double aad.Price , //<3545> string aas.Text ) //<3546> { //<3547> ObjectCreate ( aas.Name , OBJ_TEXT , 0 , aai.Time , aad.Price ) ; //<3548> ObjectSetText( aas.Name , aas.Text , aai.Size , "Courier New" , aai.Color ) ; //<3549> ObjectSet ( aas.Name , OBJPROP_BACK , avi.FlagBackground ) ; //<3550> } //<3551> //`````````````````````````````````````````````````````````````````````````//<3552> //<3553> //< A.System.Indicator: Function 6 >`````````````````````````````````````````````````````````````````````````//<3554> int afr.ResetText ( // - elements // input - / code - / output - //<3555> string aas.Name , //<3556> int aai.Color , //<3557> int aai.Size , //<3558> int aai.Time , //<3559> double aad.Price , //<3560> string aas.Text ) //<3561> { //<3562> ObjectSet ( aas.Name , OBJPROP_TIME1 , aai.Time ) ; //<3563> ObjectSet ( aas.Name , OBJPROP_PRICE1 , aad.Price ) ; //<3564> ObjectSetText( aas.Name , aas.Text , aai.Size , "Courier New" , aai.Color ) ; //<3565> } //<3566> //`````````````````````````````````````````````````````````````````````````//<3567> //<3568> //< A.System.Indicator: Function 11 >`````````````````````````````````````````````````````````````````````````//<3569> int afr.CreateLineH ( // - elements // input - / code - / output - //<3570> string aas.Name , //<3571> int aai.Color , //<3572> int aai.Width , //<3573> int aai.Style , //<3574> double aad.Price ) //<3575> { //<3576> ObjectCreate ( aas.Name , OBJ_HLINE , 0 , 0 , aad.Price ) ; //<3577> ObjectSet ( aas.Name , OBJPROP_COLOR , aai.Color ) ; //<3578> ObjectSet ( aas.Name , OBJPROP_WIDTH , aai.Width ) ; //<3579> ObjectSet ( aas.Name , OBJPROP_STYLE , aai.Style ) ; //<3580> ObjectSet ( aas.Name , OBJPROP_BACK , avi.FlagBackground ) ; //<3581> } //<3582> //`````````````````````````````````````````````````````````````````````````//<3583> //<3584> //< A.System.Indicator: Function 12 >`````````````````````````````````````````````````````````````````````````//<3585> int afr.ResetLineH ( // - elements // input - / code - / output - //<3586> string aas.Name , //<3587> double aad.Price ) //<3588> { //<3589> ObjectSet ( aas.Name , OBJPROP_PRICE1 , aad.Price ) ; //<3590> } //<3591> //`````````````````````````````````````````````````````````````````````````//<3592> //<3593> //< A.System.Indicator: Function 9 >`````````````````````````````````````````````````````````````````````````//<3594> int afr.CreateLineV ( // - elements // input - / code - / output - //<3595> string aas.Name , //<3596> int aai.Color , //<3597> int aai.Width , //<3598> int aai.Style , //<3599> int aai.Time ) //<3600> { //<3601> ObjectCreate ( aas.Name , OBJ_VLINE , 0 , aai.Time , 0 ) ; //<3602> ObjectSet ( aas.Name , OBJPROP_COLOR , aai.Color ) ; //<3603> ObjectSet ( aas.Name , OBJPROP_WIDTH , aai.Width ) ; //<3604> ObjectSet ( aas.Name , OBJPROP_STYLE , aai.Style ) ; //<3605> ObjectSet ( aas.Name , OBJPROP_BACK , avi.FlagBackground ) ; //<3606> } //<3607> //`````````````````````````````````````````````````````````````````````````//<3608> //<3609> //< A.System.Indicator: Function 10 >`````````````````````````````````````````````````````````````````````````//<3610> int afr.ResetLineV ( // 1 //<3611> string aas.Name , //<3612> int aai.Time ) //<3613> { //<3614> ObjectSet ( aas.Name , OBJPROP_TIME1 , aai.Time ) ; //<3615> } //<3616> //`````````````````````````````````````````````````````````````````````````//<3617> //<3618> //< A.System.Indicator: Function 14 >`````````````````````````````````````````````````````````````````````````//<3619> int afr.CreateFrame ( // 3 //<3620> string aas.Name , //<3621> int aai.Color , //<3622> int aai.BackGround , //<3623> int aai.Time1 , //<3624> double aad.Price1 , //<3625> int aai.Time2 , //<3626> double aad.Price2 ) //<3627> { //<3628> ObjectCreate ( aas.Name , OBJ_RECTANGLE , 0 , aai.Time1 , aad.Price1 , aai.Time2 , aad.Price2 ) ; //<3629> ObjectSet ( aas.Name , OBJPROP_COLOR , aai.Color ) ; //<3630> ObjectSet ( aas.Name , OBJPROP_BACK , aai.BackGround ) ; //<3631> } //<3632> //`````````````````````````````````````````````````````````````````````````//<3633> //<3634> //< A.System.Indicator: Function 20 >`````````````````````````````````````````````````````````````````````````//<3635> int afr.PlotOrderLevels () // - elements // input - / code - / output - //<3636> { //<3637> if ( avi.PlotOrderLevels > 0 ) //<3638> { //<3639> static string als.OrderID ; als.OrderID = OrderMagicNumber () + "/" + OrderTicket () ; //<3640> //<3641> int ali.PlotTime = iTime ( aes.Symbol , Period () , WindowFirstVisibleBar () / 2 ) ; //<3642> //<3643> if ( avi.FlagOrderLevelsExist == 0 ) //<3644> { avi.FlagOrderLevelsExist = 1 ; //<3645> //<3646> afr.CreateLineH ( avs.OrderPrice , White , 1 , STYLE_DASH , OrderOpenPrice () ) ; //<3647> afr.CreateLineH ( avs.OrderTake , Green , 1 , STYLE_DASH , OrderTakeProfit () ) ; //<3648> afr.CreateLineH ( avs.OrderStop , Red , 1 , STYLE_DASH , OrderStopLoss () ) ; //<3649> //<3650> afr.CreateText ( avs.OrderPriceID , White , 7 , //<3651> ali.PlotTime , OrderOpenPrice () , als.OrderID ) ; //<3652> afr.CreateText ( avs.OrderTakeID , Green , 7 , //<3653> ali.PlotTime , OrderTakeProfit () , als.OrderID ) ; //<3654> afr.CreateText ( avs.OrderStopID , Red , 7 , //<3655> ali.PlotTime , OrderStopLoss () , als.OrderID ) ; //<3656> } // if //<3657> else //<3658> { //<3659> afr.ResetLineH ( avs.OrderPrice , OrderOpenPrice () ) ; //<3660> afr.ResetLineH ( avs.OrderTake , OrderTakeProfit () ) ; //<3661> afr.ResetLineH ( avs.OrderStop , OrderStopLoss () ) ; //<3662> //<3663> afr.ResetText ( avs.OrderPriceID , White , 7 , //<3664> ali.PlotTime , OrderOpenPrice () , als.OrderID ) ; //<3665> afr.ResetText ( avs.OrderTakeID , Green , 7 , //<3666> ali.PlotTime , OrderTakeProfit () , als.OrderID ) ; //<3667> afr.ResetText ( avs.OrderStopID , Red , 7 , //<3668> ali.PlotTime , OrderStopLoss () , als.OrderID ) ; //<3669> } // else //<3670> } // if //<3671> else if ( avi.FlagOrderLevelsExist == 1 ) //<3672> { avi.FlagOrderLevelsExist = 0 ; //<3673> afr.DeleteOrderLevels () ; //<3674> } //<3675> } //<3676> //`````````````````````````````````````````````````````````````````````````//<3677> //<3678> //< A.System.Indicator: Function 19 >`````````````````````````````````````````````````````````````````````````//<3679> int afr.DeleteOrderLevels () // - elements // input - / code - / output - //<3680> { //<3681> if ( avi.FlagOrderLevelsExist == 1 ) //<3682> { avi.FlagOrderLevelsExist = 0 ; //<3683> afr.DeleteOrderLevels () ; //<3684> ObjectDelete ( avs.OrderPrice ) ; //<3685> ObjectDelete ( avs.OrderTake ) ; //<3686> ObjectDelete ( avs.OrderStop ) ; //<3687> ObjectDelete ( avs.OrderPriceID ) ; //<3688> ObjectDelete ( avs.OrderTakeID ) ; //<3689> ObjectDelete ( avs.OrderStopID ) ; //<3690> } //<3691> } //<3692> //`````````````````````````````````````````````````````````````````````````//<3693> //<3694> //< A.System.Indicator: Function 20 >`````````````````````````````````````````````````````````````````````````//<3695> int afr.PlotTimeBorders () // - elements // input - / code - / output - //<3696> { //<3697> if ( avi.FlagTimeBordersExist == 0 ) //<3698> { avi.FlagTimeBordersExist = 1 ; //<3699> //<3700> afr.CreateLineV ( avs.TimeBegin.2 , Green , 1 , STYLE_DOT , arv.P.2 [ ari.P.TimeBegin ] ) ; //<3701> afr.CreateLineV ( avs.TimeBegin.3 , Green , 1 , STYLE_DOT , arv.P.3 [ ari.P.TimeBegin ] ) ; //<3702> } //<3703> else //<3704> { afr.ResetLineV ( avs.TimeBegin.2 , arv.P.2 [ ari.P.TimeBegin ] ) ; //<3705> afr.ResetLineV ( avs.TimeBegin.3 , arv.P.3 [ ari.P.TimeBegin ] ) ; //<3706> } //<3707> } //<3708> //`````````````````````````````````````````````````````````````````````````//<3709> //<3710> //< A.System.Indicator: Function 19 >`````````````````````````````````````````````````````````````````````````//<3711> int afr.DeleteTimeBorders () // - elements // input - / code - / output - //<3712> { //<3713> if ( avi.FlagTimeBordersExist == 1 ) //<3714> { avi.FlagTimeBordersExist = 0 ; //<3715> //<3716> ObjectDelete ( avs.TimeBegin.2 ) ; //<3717> ObjectDelete ( avs.TimeBegin.3 ) ; //<3718> } //<3719> } //<3720> //`````````````````````````````````````````````````````````````````````````//<3721> //<3722> //< A.System.Indicator: Function 20 >`````````````````````````````````````````````````````````````````````````//<3723> int afr.PlotProfiles () // - elements // input - / code - / output - //<3724> { //<3725> //< Entry Point > //<3726> if ( avi.FlagProfilesExist == 0 ) //<3727> { avi.FlagProfilesExist = 1 ; //<3728> // //<3729> //<3730> //< Vertical Markers > //<3731> static int ali.Time.1 ; //<3732> static int ali.Time.0 ; //<3733> //<3734> static int ali.Time.Central ; //<3735> //<3736> static int ali.Time.Average.1 ; //<3737> static int ali.Time.Average.0 ; //<3738> //<3739> if ( arv.Chart [ ari.BarsShift ] > 0 ) //<3740> int ali.WidthMax = arv.Chart [ ari.BarsShift ] * Period () * 60 / 4 ; //<3741> else ali.WidthMax = arv.Chart [ ari.BarsTotal ] * Period () * 60 / ( - 20 ) ; //<3742> //<3743> ali.Time.1 = iTime ( aes.Symbol , Period () , arv.Chart [ ari.BarRight ] ) //<3744> + ali.WidthMax ; //<3745> ali.Time.Central = ali.Time.1 + ali.WidthMax ; //<3746> ali.Time.0 = ali.Time.Central + ali.WidthMax ; //<3747> //<3748> ali.Time.Average.1 = ali.Time.Central //<3749> - MathRound ( 1.0 * ali.WidthMax * arv.Z [ ari.Z.VolumeMean.1 ] //<3750> / arv.Z [ ari.Z.VolumeMax.1 ] ) ; //<3751> ali.Time.Average.0 = ali.Time.Central //<3752> + MathRound ( 1.0 * ali.WidthMax * arv.Z [ ari.Z.VolumeChartMean.0 ] //<3753> / arv.Z [ ari.Z.VolumeChartMax.0 ] ) ; //<3754> //<3755> afr.CreateLineV ( avs.Line.1 , DarkGray , 1 , STYLE_DOT , ali.Time.1 ) ; //<3756> afr.CreateLineV ( avs.Line.0 , DarkGray , 1 , STYLE_DOT , ali.Time.0 ) ; //<3757> afr.CreateLineV ( avs.Line.Central , Gray , 1 , STYLE_SOLID , ali.Time.Central ) ; //<3758> afr.CreateLineV ( avs.Line.Average.1 , DarkGray , 1 , STYLE_DOT , ali.Time.Average.1 ) ; //<3759> afr.CreateLineV ( avs.Line.Average.0 , DarkGray , 1 , STYLE_DOT , ali.Time.Average.0 ) ; //<3760> // //<3761> //<3762> //< Zones > //<3763> static double ald.PriceStep ; ald.PriceStep = avd.QuotePoint * arv.Z [ ari.Z.StepPoints ] ; //<3764> //<3765> for ( int i = 0 ; i < arv.Z [ ari.Z.IndexChartRange ] ; i ++ ) //<3766> { //<3767> int ali.Index = i + arv.Z [ ari.Z.IndexChartLowest ] ; //<3768> //<3769> double ald.Width.1 = avd.Zone.1 [ ali.Index ] / arv.Z [ ari.Z.VolumeMax.1 ] ; //<3770> double ald.Width.0 = avd.Zone.0 [ ali.Index ] / arv.Z [ ari.Z.VolumeMax.0 ] ; //<3771> //<3772> double ald.PriceBottom = avd.QuotePoint * ( arv.Z [ ari.Z.BasePoints ] //<3773> + arv.Z [ ari.Z.StepPoints ] //<3774> * ( arv.Z [ ari.Z.IndexShift ] + ali.Index ) ) ; //<3775> //<3776> double ald.PriceTop = ald.PriceBottom + ald.PriceStep ; //<3777> //<3778> afr.CreateFrame ( avs.Profile.1 + i , Gray , 1 , //<3779> ali.Time.Central - ald.Width.1 * ali.WidthMax , ald.PriceTop , //<3780> ali.Time.Central , ald.PriceBottom ) ; //<3781> //<3782> afr.CreateFrame ( avs.Profile.0 + i , Gray , 1 , //<3783> ali.Time.Central + ald.Width.0 * ali.WidthMax , ald.PriceTop , //<3784> ali.Time.Central , ald.PriceBottom ) ; //<3785> } // for //<3786> // //<3787> //<3788> //< Exit Point > //<3789> } // if //<3790> // //<3791> } //<3792> //`````````````````````````````````````````````````````````````````````````//<3793> //<3794> //< A.System.Indicator: Function 19 >`````````````````````````````````````````````````````````````````````````//<3795> int afr.DeleteProfiles () // - elements // input - / code - / output - //<3796> { //<3797> if ( avi.FlagProfilesExist == 1 ) //<3798> { avi.FlagProfilesExist = 0 ; //<3799> //<3800> for ( int i = 0 ; i < arv.Z [ ari.Z.IndexChartRange ] ; i ++ ) //<3801> { ObjectDelete ( avs.Profile.1 + i ) ; //<3802> ObjectDelete ( avs.Profile.0 + i ) ; //<3803> } //<3804> //<3805> ObjectDelete ( avs.Line.1 ) ; //<3806> ObjectDelete ( avs.Line.0 ) ; //<3807> ObjectDelete ( avs.Line.Central ) ; //<3808> ObjectDelete ( avs.Line.Average.1 ) ; //<3809> ObjectDelete ( avs.Line.Average.0 ) ; //<3810> } //<3811> } //<3812> //`````````````````````````````````````````````````````````````````````````//<3813> //<3814> //< A.System.Indicator: Function 20 >`````````````````````````````````````````````````````````````````````````//<3815> int afr.PlotZoneLevels () // - elements // input - / code - / output - //<3816> { //<3817> if ( avi.FlagZoneLevelsExist == 0 ) //<3818> { avi.FlagZoneLevelsExist = 1 ; //<3819> //<3820> static double ald.PriceStep ; ald.PriceStep = avd.QuotePoint * arv.Z [ ari.Z.StepPoints ] ; //<3821> //<3822> for ( int i = 0 ; i < arv.Z [ ari.Z.IndexChartRange ] ; i ++ ) //<3823> { //<3824> int ali.Index = i + arv.Z [ ari.Z.IndexChartLowest ] ; //<3825> //<3826> double ald.PriceBottom = avd.QuotePoint * ( arv.Z [ ari.Z.BasePoints ] //<3827> + arv.Z [ ari.Z.StepPoints ] //<3828> * ( arv.Z [ ari.Z.IndexShift ] + ali.Index ) ) ; //<3829> //<3830> afr.CreateLineH ( avs.ZoneLevels + i , Gray , 1 , STYLE_DOT , ald.PriceBottom ) ; //<3831> //<3832> } // for //<3833> } // if //<3834> } //<3835> //`````````````````````````````````````````````````````````````````````````//<3836> //<3837> //< A.System.Indicator: Function 19 >`````````````````````````````````````````````````````````````````````````//<3838> int afr.DeleteZoneLevels () // - elements // input - / code - / output - //<3839> { //<3840> if ( avi.FlagZoneLevelsExist == 1 ) //<3841> { avi.FlagZoneLevelsExist = 0 ; //<3842> //<3843> for ( int i = 0 ; i < arv.Z [ ari.Z.IndexChartRange ] ; i ++ ) //<3844> ObjectDelete ( avs.ZoneLevels + i ) ; //<3845> } //<3846> } //<3847> //`````````````````````````````````````````````````````````````````````````//<3848> //<3849> //< A.System.Extra: Control Module Function 2222 >````````````````````````````````````````````````````````````//<3850> string afr.ResetPlotter () // - elements // input - / code - / output - //<3851> { //<3852> if ( arv.Chart [ ari.BarLeft ] != WindowFirstVisibleBar () //<3853> || arv.Chart [ ari.Resolution.H ] != WindowBarsPerChart () //<3854> || arv.Chart [ ari.PriceMax ] != WindowPriceMax () //<3855> || arv.Chart [ ari.PriceMin ] != WindowPriceMin () ) //<3856> { //<3857> afr.MeasureChart () ; //<3858> //<3859> afr.DeleteTimeBorders () ; //<3860> if ( avi.PlotTimeBorders > 0 ) //<3861> afr.PlotTimeBorders () ; //<3862> //<3863> arv.Z [ ari.Z.Set ] = 1 ; //<3864> afr.SetMarketZones () ; //<3865> } //<3866> else if ( arv.1 [ ari.1.NewFrames ] > 0 //<3867> || arv.Z [ ari.Z.Set ] > 0 ) //<3868> { //<3869> if ( avi.PlotTimeBorders > 0 ) //<3870> afr.PlotTimeBorders () ; //<3871> else afr.DeleteTimeBorders () ; //<3872> } //<3873> } //<3874> //````````````````````````````````````````````````````````````//<3875> //<3876> //--------------------------------------------------------------------------//<3938> //<3939> //===========================================================================================//<3940>