Example of A System: Championship 2008 Final Edit adjustment for trading symbol "GOLD" Content Part 1. Basic information Chapter 1. Specification Chapter 2. Code structure Chapter 3. Trading strategy Chapter 4. System preparations Chapter 5. History data review Chapter 6. System adjustment review Chapter 7. Common rules of system adjustment Chapter 8. Special rules of system adjustment Part 2. First trading thread adjustment Chapter 9. Step one: initial values of input patameters setting Chapter 10. Step two: "avd.InputParameter.1" and "avd.InputParameter.2" computing Chapter 11. Step three: "avd.avd.InputFallLimit" and "avd.InputFallFactor" computing Chapter 12. Step four: "avd.InputLockSize" and "avd.InputLockFactor" computing Chapter 13. Step five: "avd.InputTimeFactor.1" computing Chapter 14. Step six: "avd.InputTimeFactor.2" computing Chapter 15. Step seven: "avd.InputRiskLimit" computing Chapter 16. Step eight: input patameters set final selection Chapter 17. Step nine: input patameters set storage Part 3. Continuing adjustment Chapter 18. Second trading thread adjustment Chapter 19. Third trading thread adjustment Chapter 20. Fourth trading thread adjustment Part 4. Completing adjustment Chapter 21. Completing system optimization mode Chapter 22. Risk level adjustment Chapter 23. Code changes Part 1. Basic information Chapter 1. Specification 1.1. Basic information about the example: 1.1.1. history data of MetaQuotes Software Corporation history center was used; 1.1.2. demo account of MetaQuotes Software Corporation demo server was used with following parameters: 1.1.2.1. "Account Currency = USD", 1.1.2.2. "Account Leverage = 100"; 1.1.3. history period used in the example is from 01.01.2008 to 28.12.2008; 1.1.4. all computations were made when internet connection was off. 1.2. Contract specification for trading symbol "GOLD" used in the example: 1.2.1. "Spread = 100", 1.2.2. "Digits = 2", 1.2.3. "Stops Level = 400", 1.2.4. "Contract size = 250", 1.2.5. "Margin hedge = 400", 1.2.6. "Margin calculation mode = CFD", 1.2.7. "Profit calculation mode = CFD", 1.2.8. "Swap long = -3.5%", 1.2.9. "Swap short = +1.5%", 1.2.10. "Lot step = 0.1", 1.2.11. "Minimum lot size = 0.1", 1.2.12. "Maximum lot size = 100000". Chapter 2. Code structure 2.1. Code has page structure. 2.2. Adjust MetaEditor window size to 45 lines and 122 columns. 2.3. Use keys and to scroll code. 2.4. Tags //< ... > and // must remain their screen positions. 2.5. The code contains 36 pages. 2.6. The program was developed using object oriented concept. 2.7. There is only one object - "A.System". 2.8. Object "A.System" has: 2.8.1. external 2 methods interface; 2.8.2. internal 24 methods interface. 2.9. Properties of object "A.System" are in substructure "A.Memory". 2.10. Structure description of object "A.System" is in code page 2 "//< A System: Structure >". 2.11. The program body is in code page 1. 2.12. Lines "#define" contain identification data. 2.13. Line "int init () { Alert ( "A System: Reloaded" ) ; }" alerts that program has been started. 2.14. Line "int start () ..." contains two interface calls of object "A.System": 2.14.1. "aib.System.IsOK ()" returns system check result, see code page "//< A System: Interface 1 >"; 2.14.2. "air.System.Run ()" contains internal methods calls, see code page "//< A System: Interface 2 >". 2.15. So the program works in standard mode: 2.15.1. passes initialization as fast as possible; 2.15.2. then works in waiting mode; 2.15.2.1. starts on new tick; 2.15.2.2. acts and then ends; 2.15.2.3. waits for new tick. Chapter 3. Trading strategy 3.1. Heart of trading strategy are functions "afr.System.ComputeStrategy ()" and "afi.System.SignalToOpen ()". 3.2. The strategy uses only one data frame, also called "bar" and "candle", number "1", that is latest of completed ones. 3.3. Dimension of data frame, also called "timeframe", in default settings is 1440. 3.4. Possibility to change working timeframe after program start is unavailable. 3.5. Basic rule for "buy" operation: closing price of bar number "1" greater than average price of bar number "1" and current "ask" price greater than highest price of bar number "1". 3.6. Basic rule for "sell" operation: closing price of bar number "1" less than average price of bar number "1" and current "bid" price less than lowest price of bar number "1". 3.7. Target is in a distance that is equal to height of bar number "1" multiplied by "avd.TakeFactor". 3.8. Stop is at lowest price of bar number "1" when buying and at highest price of bar number "1" when selling. 3.9. The following position management procedures are used after successful trading operation: 3.9.1. variable size trailing stop in methods "afr.System.AttemptToTrail" and "afd.System.TrailAdjustment"; 3.9.2. forced position closing in methods "afr.System.AttemptToClose" and "afi.System.SignalToClose"; 3.9.3. partial "locking" in methods "afr.System.LockPosition" and "afr.System.AttemptToLock". 3.10. The trading strategy parameters are adjusted using strategy tester. Chapter 4. System preparations 4.1. Load history data for "GOLD" in menu "Tools/History Center". 4.2. Open file that contains code of A System: Championship 2008 Final Edit. 4.3. In page "//< A System: Parameters 1 >": 4.3.1. assign to fourth element of array "ac.Symbol []" name "GOLD"; 4.3.2. assign to fourth element of array "ac.RiskFactor []" value "1.0"; 4.3.3. change in first column of array "ac.Parameter []" each "1" for "0" to forbid corresponding trading thread; 4.3.4. change in fourth part of array "ac.Parameter []" header "// Reserved" for "// GOLD"; 4.3.5. assign "avd.SystemStop = 0.0". 4.4. Depending on value of "avb.IsOptimizing" variable in method "afr.System.Reset" selection one of two parameter set, "//< A System: Parameters 1 >" and "//< A System: Parameters 2 >", is performed. 4.5. Set "avb.IsOptimizing = 1" to select "//< A System: Parameters 2 >" parameter set. 4.6. Go to code page "//< A System: Parameters 2 >". 4.7. Compile code with default settings. 4.8. Go to "Settings" tab of strategy tester and set: 4.8.1. "Expert Advisor" - name of compiled file; 4.8.2. "Symbol" - "GOLD"; 4.8.3. "Mode" - "Every tick"; 4.8.4. "Use date" - "From: 2008.01.01 To: 2008.12.28" ; 4.8.5. "Period" - "any". 4.8.6. "Optimization" - "Off". 4.9. In dialog box "Expert Properties" of "Testing" tab set: 4.9.1. "Initial deposit = 1000000 USD", 4.9.2. "Position = Long & Short". 4.10. Start probe test. 4.11. Go to "Results" tab of strategy tester. 4.12. Check that: 4.12.1. all trades have size much greater than minimum allowed size, 4.12.2. all trades have size much less than maximum allowed size, 4.12.3. all trades have margin requirements much less than deposit size. 4.13. Go to "Report" tab of strategy tester. 4.14. Find output results: 4.14.1. "Total net profit = 324253.62", 4.14.2. "Relative return = 32.43%", 4.14.3. "Relative drawdown = 11.17%", 4.14.4. "Return on drawdown = 32.43%/11.17%=2.90", 4.14.5. "Profit factor = 1.41", 4.14.6. "Loss trades = 61", 4.14.7. "Total trades = 126". 4.15. Synthetic aggregate "Return on drawdown = Relative return / Relative drawdown" measures rate of return on risk. 4.16. Brief notation of output results is "Output:32.43%/11.17%=2.90/1.41/61/126". 4.17. Conclusion: 4.17.1. hystory data are loaded successfully; 4.17.2. preparations are completed successfully; 4.17.3. system is ready for adjustment. Chapter 5. History data review 5.1. There are four specific regions that have length more than 10% of test period length, from 01.01.2008 to 28.12.2008: 5.1.1. region "À", 2.5 month from 01.01.2008 to 18.03.2008 with annual rate of return +70% and changes +- 5%; 5.1.2. region "B", 4 month from 18.03.2008 to 15.07.2008 with annual rate of return 0% and changes +- 9%; 5.1.3. region "C", 2 month from 15.07.2008 to 17.09.2008 with annual rate of return -120% and changes +- 7%; 5.1.4. region "D", 3.5 month from 17.09.2008 to 28.12.2008 with annual rate of return 0% and changes +-15%. 5.2. Conclusion: 5.2.1. test period from 01.01.2008 to 28.12.2008 contains all basic market states with significant length; 5.2.2. test period from 01.01.2008 to 28.12.2008 conforms to the aims of the adjustment. Chapter 6. System adjustment review 6.1. Open file that contains code of A System: Championship 2008 Final Edit. 6.2. Study functions: 6.2.1. "afr.System.Reset", 6.2.2. "afr.System.LoadOptimization", 6.2.3. "afr.System.SelectParameters". 6.3. Go to code page "//< A System: Parameters 2 >". 6.4. There will be four pair of parameters "avi.InputIndex.1" and "avi.InputIndex.2" values, each pair will define one of four possible threads and will be adjusted separately: 6.4.1. "avi.InputIndex.1 = 7 ;" è "avi.InputIndex.2 = 7 ;"; 6.4.2. "avi.InputIndex.1 = 7 ;" è "avi.InputIndex.2 = 6 ;"; 6.4.3. "avi.InputIndex.1 = 6 ;" è "avi.InputIndex.2 = 7 ;"; 6.4.4. "avi.InputIndex.1 = 6 ;" è "avi.InputIndex.2 = 6 ;". 6.5. Variable "avi.InputIndex.1" defines index of main timeframe in array "ac.Timeframe []". 6.6. Main timeframe is used in initial "take-profit" and "stop-loss" computations. 6.7. Variable "avi.InputIndex.2" defines index of auxiliary timeframe in array "ac.Timeframe []". 6.8. Auxiliary timeframe is used in "trailing-stop" computations. 6.9. Timeframes with indexes less than 6 are being excluded from system adjustment because they require additional researchof trading system stability. 6.10. Timeframes with indexes greater than 7 are being excluded from system adjustment because they require additional research of trading system profitability. 6.11. Other 9 input parameters are adjusted by using optimization mode of strategy tester with declaration these parameters as "extern". 6.12. Variables "avd.InputParameter.1" and "avd.InputParameter.2" are adjusted simultaneously, they define values of multipliers "avd.TakeFactor" and "avd.TrailFactor" in method "afr.System.ComputeFactors" for initial target and trailing-stop computation respectively. 6.13. Variables "avd.InputFallLimit" and "avd.InputFallFactor" are adjusted simultaneously, they define values of multipliers "avd.FallLimit" and "avd.FallFactor" in method "afi.System.SignalToClose" for forced position closing. 6.14. Variables "avd.InputLockSize" and "avd.InputLockFactor" are adjusted simultaneously, they define values of multipliers "avd.LockSize" and "avd.LockFactor" in method "afr.System.AttemptToLock" for "locking" orders opening. 6.15. Variable "avd.InputTimeFactor.1" is adjusted separately, it decreases trailing-stop size in method "afd.System.TrailAdjustment" depending on difference between current time and order opening time. 6.16. Variable "avd.InputTimeFactor.2" is adjusted separately, in method "afd.System.RiskAdjustment" it adjusts order risk limit depending on current values of measures "Loss trades" and "Total trades"; test values of these measures are stored in auxiliary variables "avi.InputLE" and "avi.InputTE" respectively to be compared with current ones. 6.17. Variable "avd.InputRiskLimit" is adjusted separately, it defines order risk limit in method "afr.System.ComputeOrderSize". Chapter 7. Common rules of system adjustment 7.1. Measure "Return on drawdown" is main appraisal of trading system profitability. 7.2. Measure "Profit factor" is main appraisal of trading system reliability. 7.3. Measure "Total trades" appraises confidence of trading system valuations. 7.4. Acceptable confidence level of trading system valuations is approximately 100 or more trades in test period. 7.5. Number of loss trades must be less than 1/2 of total trades. 7.6. Acceptable level of "Profit factor" measure is "2.00" or greater. 7.7. If output results have equal values for different input parameter values then "mean" value of input parameter is preferable, that is lying between utmost ones with equal outputs. 7.8. If output results are close comparable then ones with more even balance growth are preferable. 7.9. Relative inaccuracy of measure value 10-20% is acceptable. Chapter 8. Special rules of system adjustment 8.1. Variables "avd.InputIndex.1" and "avd.InputIndex.2" define basic properties of the trading strategy. 8.2. Variables "avd.InputParameter.1" and "avd.InputParameter.2" are major parameters of the adjustment. 8.3. With value "avd.InputIndex.1 = 7" that is selecting "daily" timeframes for target computations, more stable results of the trading strategy are expected if variable "avd.InputParameter.1" has values close to "1.0". Part 2. First trading thread adjustment Chapter 9. Step one: initial values of input patameters setting 9.1. Set following values of the basic variables: 9.1.1. "int avi.InputIndex.1 = 7 ;", 9.1.2. "int avi.InputIndex.2 = 7 ;". 9.2. Set initial values of main input variables: 9.2.1. "double avd.InputParameter.1 = 1.0 ;", 9.2.2. "double avd.InputParameter.2 = 1.0 ;", 9.2.3. "double avd.InputFallLimit = 0.00 ;", 9.2.4. "double avd.InputFallFactor = 0.00 ;", 9.2.5. "double avd.InputLockSize = 0.00 ;", 9.2.6. "double avd.InputLockFactor = 0.00 ;", 9.2.7. "double avd.InputTimeFactor.1 = 0.00 ;", 9.2.8. "double avd.InputTimeFactor.2 = 0.00 ;", 9.2.9. "double avd.InputRiskLimit = 0.025 ;", 9.3. Set initial values of auxiliary variables: 9.3.1. "int avi.InputLE = 1 ;", 9.3.2. "int avi.InputTE = 1 ;". 9.3. Brief notation of input parameters set is "Input:7/7/1.0/1.0/0.00/0.00/0.00/0.00/0.00/0.00/0.025/1/1". 9.4. In intermediate computation records initial values will be skipped, for example "Input:7/7/1.8/0.5". 9.5. Input parameters set will be also called "tuning thread". 9.6. First step of the adjustment - initial values of input patameters setting - is completed. Chapter 10. Step two: "avd.InputParameter.1" and "avd.InputParameter.2" computing 10.1. Declare variables "avd.InputParameter.1" and "avd.InputParameter.2" as "extern": 10.1.1. "extern double avd.InputParameter.1 = 1.0 ;"; 10.1.2. "extern double avd.InputParameter.2 = 1.0 ;". 10.2. Compile code. 10.3. Go to "Settings" tab of strategy tester and set "Optimization = On". 10.4. Go to dialog box "Expert Properties" and: 10.4.1. ser in "Testing" tab: 10.4.1.1. "Optimized parameter = Balance", 10.4.1.2. "Genetic algorithm = Off"; 10.4.2. ser in "Inputs" tab: 10.4.2.1. "avd.InputParameter.1" - "Variable = On", "Value = 0", "Start = 0", "Step = 1", "Stop = 20"; 10.4.2.2. "avd.InputParameter.2" - "Variable = On", "Value = 0", "Start = 0", "Step = 1", "Stop = 20"; 10.4.3. uncheck all options in "Optimization" tab. 10.5. Run optimization. 10.6. After completion of the computations go to tabs "Optimization Results" and "Optimization Graph" in "2D Surface" mode. 10.7. Study results and find area of best results grouping: "avd.InputParameter.1" from 1 to 20 and "avd.InputParameter.2" from 0 to 3. 10.8. To reduce searching area and to decrease step of values scanning set in tab "Inputs": 10.8.1. "avd.InputParameter.1" - "Variable = On", "Value = 0", "Start = 0", "Step = 0.2", "Stop = 10"; 10.8.2. "avd.InputParameter.2" - "Variable = On", "Value = 0", "Start = 0", "Step = 0.2", "Stop = 4"; 10.9. Run optimization, study results, and select following area of "avd.InputParameter.1" and "avd.InputParameter.2" values: 10.9.1. "avd.InputParameter.1" îò 0.6 äî 8.0; 10.9.2. "avd.InputParameter.2" îò 0.6 äî 2.4. 10.10. To study that area more thoroughly: 10.10.1. Set in tab "Expert Properties/Inputs" of strategy tester for "avd.InputParameter.1": "Variable = On", "Value = 0", "Start = 0", "Step = 0.1", "Stop = 10.0"; 10.10.2. delete "extern" declaration for "avd.InputParameter.2"; 10.10.3. assign to "avd.InputParameter.2" manually step by step all possible values from 0.5 to 2.5 with step 0.1, 21 values total; 10.10.4. for every step of "avd.InputParameter.2" value: 10.10.4.1. compile code, 10.10.4.2. set in tab "Settings" of strategy tester "Optimization = On", 10.10.4.3. run optimization, 10.10.4.4. after completion of computations select "avd.InputParameter.1" value with best "ROD/PF/-/TT" values set, 10.10.4.5. verify that nearest values of "avd.InputParameter.1" are acceptable without any deterioration, otherwise select another value of "avd.InputParameter.1", 10.10.4.6. for selected value in tab "Optimization Results" run command "Set Input Parameters", 10.10.4.7. run strategy tester, 10.10.4.8. find in tab "Report" of strategy tester complete "ROD/PF/LT/TT" values set, 10.10.4.9. study in tab "Graph" of strategy tester balance chart; 10.10.5. there are following series of tuning threads corresponding to selected pairs of "avd.InputParameter.1" è "avd.InputParameter.2" values: 10.10.5.1. "Input:7/7/1.8/0.5//Output:27.51%/12.67%=2.17/1.27/128/212", 10.10.5.2. "Input:7/7/3.0/0.6//Output:42.03%/12.04%=3.49/1.43/ 99/165", 10.10.5.3. "Input:7/7/4.0/0.7//Output:25.47%/12.06%=2.11/1.30/ 85/142", 10.10.5.4. "Input:7/7/4.2/0.8//Output:54.77%/ 9.57%=5.72/1.67/ 61/113", 10.10.5.5. "Input:7/7/3.6/0.9//Output:70.14%/ 9.40%=7.46/1.99/ 51/ 99", 10.10.5.6. "Input:7/7/3.4/1.0//Output:64.43%/10.23%=6.30/1.95/ 46/ 92", 10.10.5.7. "Input:7/7/3.4/1.1//Output:57.22%/ 9.12%=6.27/1.96/ 39/ 84", 10.10.5.8. "Input:7/7/3.4/1.2//Output:70.29%/ 8.95%=7.85/2.44/ 35/ 74", 10.10.5.9. "Input:7/7/3.4/1.3//Output:62.40%/ 9.54%=6.54/2.31/ 35/ 69", 10.10.5.10. "Input:7/7/1.7/1.4//Output:56.37%/ 8.93%=6.31/1.96/ 39/ 78", 10.10.5.11. "Input:7/7/1.1/1.5//Output:42.45%/ 9.54%=4.45/1.68/ 43/ 90", 10.10.5.12. "Input:7/7/1.5/1.6//Output:49.79%/ 9.46%=5.26/1.77/ 36/ 78", 10.10.5.13. "Input:7/7/1.4/1.7//Output:41.40%/ 9.30%=4.45/1.69/ 38/ 76", 10.10.5.14. "Input:7/7/1.4/1.8//Output:42.83%/ 8.73%=4.91/1.76/ 33/ 70", 10.10.5.15. "Input:7/7/1.4/1.9//Output:27.22%/12.81%=2.12/1.45/ 34/ 69", 10.10.5.16. "Input:7/7/4.5/2.0//Output:43.15%/11.93%=3.62/1.87/ 27/ 46", 10.10.5.17. "Input:7/7/2.2/2.1//Output:26.27%/13.28%=1.98/1.57/ 25/ 47", 10.10.5.18. "Input:7/7/3.6/2.2//Output:28.35%/15.80%=1.79/1.66/ 24/ 41", 10.10.5.19. "Input:7/7/3.8/2.3//Output:31.11%/14.14%=2.20/1.63/ 24/ 42", 10.10.5.20. "Input:7/7/3.6/2.4//Output:22.49%/15.04%=1.50/1.43/ 25/ 43", 10.10.5.21. "Input:7/7/1.3/2.5//Output:23.81%/ 8.45%=2.82/1.42/ 37/ 60", 10.11. According to adjustment rules select following tuning threads: 10.11.1. "Input:7/7/3.6/0.9//Output:70.14%/ 9.40%=7.46/1.99/ 51/ 99", 10.11.2. "Input:7/7/3.4/1.2//Output:70.29%/ 8.95%=7.85/2.44/ 35/ 74". 10.12. Delete all "extern" declarations. 10.13. Second step of the adjustment - "avd.InputParameter.1" and "avd.InputParameter.2" computing - is completed. Chapter 11. Step three: "avd.avd.InputFallLimit" and "avd.InputFallFactor" computing 11.1. Declare variables "avd.InputFallLimit" è "avd.InputFallFactor" as "extern": 11.1.1. "extern double avd.InputFallLimit = 0.0 ;"; 11.1.2. "extern double avd.InputFallFactor = 0.0 ;". 11.2. Compile code. 11.3. Go to "Settings" tab of strategy tester and set "Optimization = On". 11.4. Go to dialog box "Expert Properties" and: 11.4.1. ser in "Inputs" tab: 11.4.1.1. "avd.InputFallLimit" - "Variable = On", "Value = 0", "Start = 0", "Step = 0.05", "Stop = 1"; 11.4.1.2. "avd.InputFallFactor" - "Variable = On", "Value = 0", "Start = 0", "Step = 0.05", "Stop = 1". 11.5. For each tuning thread of p.10.11: 11.5.1. set corresponding values of "avd.InputParameter.1" and "avd.InputParameter.2"; 11.5.2. compile code; 11.5.3. run optimization; 11.5.4. after completion of computations go to tabs "Optimization Results" and "Optimization Graph"; 11.5.5. study results and make draft selection of "avd.InputFallLimit" and "avd.InputFallFactor" value pairs; 11.5.6. for each selected pair: 11.5.6.1. in tab "Optimization Results" run command "Set Input Parameters", 11.5.6.2. run strategy tester, 11.5.6.3. find in tab "Report" of strategy tester complete "ROD/PF/LT/TT" values set, 11.5.6.4. study in tab "Graph" of strategy tester balance chart. 11.6. According to adjustment rules select following tuning threads: 11.6.1. "Input:7/7/3.6/0.9/0.45/0.20//Output:73.04%/ 9.39%= 7.78/2.02/ 51/ 99", 11.6.2. "Input:7/7/3.6/0.9/0.50/0.10//Output:68.17%/ 8.53%= 7.99/1.73/ 59/122", 11.6.3. "Input:7/7/3.4/1.2/0.50/0.15//Output:83.35%/ 8.17%=10.20/2.40/ 37/ 84", 11.6.4. "Input:7/7/3.4/1.2/0.35/0.15//Output:81.41%/ 8.95%= 9.10/2.61/ 35/ 75". 11.7. Delete all "extern" declarations. 11.8. Third step of the adjustment - "avd.InputFallLimit" and "avd.InputFallFactor" computing - is completed. Chapter 12. Step four: "avd.InputLockSize" and "avd.InputLockFactor" computing 12.1. Declare variables "avd.InputLockSize" and "avd.InputLockFactor" as "extern": 12.1.1. "extern double avd.InputLockSize = 0.0 ;"; 12.1.2. "extern double avd.InputLockFactor = 0.0 ;". 12.2. Compile code. 12.3. Go to "Settings" tab of strategy tester and set "Optimization = On". 12.4. Go to dialog box "Expert Properties" and: 12.4.1. ser in "Inputs" tab: 12.4.1.1. "avd.InputLockSize" - "Variable = On", "Value = 0", "Start = 0", "Step = 0.05", "Stop = 1"; 12.4.1.2. "avd.InputLockFactor" - "Variable = On", "Value = 0", "Start = 0", "Step = 0.05", "Stop = 1". 12.5. For each tuning thread of p.11.6: 12.5.1. set corresponding values of input variables; 12.5.2. compile code; 12.5.3. run optimization; 12.5.4. after completion of computations go to tabs "Optimization Results" and "Optimization Graph"; 12.5.5. study results and make draft selection of "avd.InputLockSize" and "avd.InputLockFactor" value pairs; 12.5.6. for each selected pair: 12.5.6.1. in tab "Optimization Results" run command "Set Input Parameters", 12.5.6.2. run strategy tester, 12.5.6.3. find in tab "Report" of strategy tester complete "ROD/PF/LT/TT" values set, 12.5.6.4. study in tab "Graph" of strategy tester balance chart. 12.6. According to adjustment rules select following tuning threads: 12.6.1. "Input:7/7/3.6/0.9/0.45/0.20/0.35/0.35//Output:72.56%/ 9.23%= 7.86/2.00/ 56/118", 12.6.2. "Input:7/7/3.6/0.9/0.50/0.10/1.00/0.90//Output:68.82%/ 8.19%= 8.40/1.76/ 59/119", 12.6.3. "Input:7/7/3.4/1.2/0.50/0.15/1.00/0.90//Output:83.47%/ 8.17%=10.22/2.41/ 37/ 86", 12.6.4. "Input:7/7/3.4/1.2/0.35/0.15/1.00/0.90//Output:81.96%/ 8.95%= 9.16/2.62/ 35/ 76". 12.7. Delete all "extern" declarations. 12.8. Fourth step of the adjustment - "avd.InputLockSize" and "avd.InputLockFactor" computing - is completed. Chapter 13. Step five: "avd.InputTimeFactor.1" computing 13.1. Declare variable "avd.InputTimeFactor.1" as "extern": "extern double avd.InputTimeFactor.1 = 0.0 ;". 13.2. Compile code. 13.3. Go to "Settings" tab of strategy tester and set "Optimization = On". 13.4. Go to dialog box "Expert Properties" and set in "Inputs" tab: 13.4.1. "avd.InputTimeFactor.1" - "Variable = On", "Value = 0", "Start = 0", "Step = 0.1", "Stop = 20". 13.5. For each tuning thread of p.12.6: 13.5.1. set corresponding values of input variables; 13.5.2. compile code; 13.5.3. run optimization; 13.5.4. after completion of computations go to tabs "Optimization Results" and "Optimization Graph"; 13.5.5. study results and make draft selection of "avd.InputTimeFactor.1" values; 13.5.6. for each selected value: 13.5.6.1. in tab "Optimization Results" run command "Set Input Parameters", 13.5.6.2. run strategy tester, 13.5.6.3. find in tab "Report" of strategy tester complete "ROD/PF/LT/TT" values set, 13.5.6.4. study in tab "Graph" of strategy tester balance chart. 13.6. According to adjustment rules select following tuning threads: 13.6.1. "Input:7/7/3.6/0.9/0.45/0.20/0.35/0.35/ 4.6//Output:70.87%/ 7.00%=10.12/1.85/ 72/138", 13.6.2. "Input:7/7/3.6/0.9/0.50/0.10/1.00/0.90/ 0.0//Output:68.82%/ 8.19%= 8.40/1.76/ 59/119", 13.6.3. "Input:7/7/3.4/1.2/0.50/0.15/1.00/0.90/ 0.0//Output:83.47%/ 8.17%=10.22/2.41/ 37/ 86", 13.6.4. "Input:7/7/3.4/1.2/0.50/0.15/1.00/0.90/16.0//Output:86.72%/10.45%= 8.30/2.50/ 35/ 88", 13.6.5. "Input:7/7/3.4/1.2/0.35/0.15/1.00/0.90/ 0.0//Output:81.96%/ 8.95%= 9.16/2.62/ 35/ 76", 13.6.6. "Input:7/7/3.4/1.2/0.35/0.15/1.00/0.90/ 7.2//Output:97.32%/ 9.49%=10.26/2.51/ 38/ 87", 13.6.7. "Input:7/7/3.4/1.2/0.35/0.15/1.00/0.90/ 2.4//Output:89.71%/ 9.21%= 9.74/2.20/ 55/110". 13.7. Delete all "extern" declarations. 13.8. Fifth step of the adjustment - "avd.InputTimeFactor.1" computing - is completed. Chapter 14. Step six: "avd.InputTimeFactor.2" computing 14.1. Declare variable "avd.InputTimeFactor.2" as "extern": "extern double avd.InputTimeFactor.2 = 0.0 ;". 14.2. Compile code. 14.3. Go to "Settings" tab of strategy tester and set "Optimization = On". 14.4. Go to dialog box "Expert Properties" and set in "Inputs" tab: 14.4.1. "avd.InputTimeFactor.2" - "Variable = On", "Value = 0", "Start = 0", "Step = 0.05", "Stop = 20". 14.5. For each tuning thread of p.13.6: 14.5.1. set corresponding values of main input variables; 14.5.2. set corresponding values of auxiliary variables "avi.InputLE" and "avi.InputTE", for example, "int avi.InputLE = 72 ;" and "int avi.InputTE = 138 ;" for tuning thread 13.6.1; 14.5.3. compile code; 14.5.4. run optimization; 14.5.5. after completion of computations go to tabs "Optimization Results" and "Optimization Graph"; 14.5.5. study results and make draft selection of "avd.InputTimeFactor.2" values; 14.5.6. for each selected value: 14.5.6.1. in tab "Optimization Results" run command "Set Input Parameters", 14.5.6.2. run strategy tester, 14.5.6.3. find in tab "Report" of strategy tester complete "ROD/PF/LT/TT" values set, 14.5.6.4. study in tab "Graph" of strategy tester balance chart. 14.6. According to adjustment rules select following tuning threads: 14.6.1. "Input:7/7/3.6/0.9/0.45/0.20/0.35/0.35/ 4.6/0.45//Output:129.69%/ 9.78%=13.26/2.06/ 72/138", 14.6.2. "Input:7/7/3.6/0.9/0.50/0.10/1.00/0.90/ 0.0/0.30//Output:116.93%/10.06%=11.62/1.92/ 59/129", 14.6.3. "Input:7/7/3.4/1.2/0.50/0.15/1.00/0.90/ 0.0/0.30//Output:138.40%/11.33%=12.22/2.79/ 37/ 86", 14.6.4. "Input:7/7/3.4/1.2/0.50/0.15/1.00/0.90/16.0/0.30//Output:139.44%/13.84%=10.08/2.84/ 35/ 88", 14.6.5. "Input:7/7/3.4/1.2/0.35/0.15/1.00/0.90/ 0.0/0.25//Output:143.07%/13.63%=10.50/3.17/ 35/ 76", 14.6.6. "Input:7/7/3.4/1.2/0.35/0.15/1.00/0.90/ 7.2/0.30//Output:149.02%/12.76%=11.68/2.68/ 38/ 87", 14.6.7. "Input:7/7/3.4/1.2/0.35/0.15/1.00/0.90/ 2.4/0.50//Output:175.04%/11.01%=15.90/2.62/ 55/110". 14.7. Delete all "extern" declarations. 14.8. Sixth step of the adjustment - "avd.InputTimeFactor.2" computing - is completed. Chapter 15. Step seven: "avd.InputRiskLimit" computing 15.1. Purpose of the seventh step is to limit deposit relative drawdown in test period by certain value for current trading thread. 15.2. Let this value is "10%" for all trading threads of symbol is being adjusted. 15.3. Declare variable "avd.InputRiskLimit" as "extern": "extern double avd.InputRiskLimit = 0.025 ;". 15.4. Compile code. 15.5. Go to "Settings" tab of strategy tester and set "Optimization = On". 15.6. Go to dialog box "Expert Properties" and set in "Inputs" tab: 15.6.1. "avd.InputRiskLimit" - "Variable = On", "Value = 0", "Start = 0", "Step = 0.001", "Stop = 0.035". 15.7. For each tuning thread of p.14.6: 15.7.1. set corresponding values of main input variables; 15.7.2. set corresponding values of auxiliary variables "avi.InputLE" and "avi.InputTE"; 15.7.3. compile code; 15.7.4. run optimization; 15.7.5. after completion of computations go to tab "Optimization Results"; 15.7.6. find largest "Drawdown %" value that is less than 10%; 15.7.7. for corresponding value of "avd.InputRiskLimit" run command "Set Input Parameters"; 15.7.8. run strategy tester; 15.7.9. find in tab "Report" of strategy tester complete "ROD/PF/LT/TT" values set. 15.8. Following tuning threads are ready for final selection: 15.8.1. "Input:7/7/3.6/0.9/0.45/0.20/0.35/0.35/ 4.6/0.45/0.025//Output:129.69%/ 9.78%=13.26/2.06/ 72/138", 15.8.2. "Input:7/7/3.6/0.9/0.50/0.10/1.00/0.90/ 0.0/0.30/0.024//Output:110.50%/ 9.65%=11.45/1.92/ 59/129", 15.8.3. "Input:7/7/3.4/1.2/0.50/0.15/1.00/0.90/ 0.0/0.30/0.021//Output:108.53%/ 9.60%=11.31/2.74/ 37/ 86", 15.8.4. "Input:7/7/3.4/1.2/0.50/0.15/1.00/0.90/16.0/0.30/0.017//Output: 82.84%/ 9.58%= 8.65/2.73/ 35/ 88", 15.8.5. "Input:7/7/3.4/1.2/0.35/0.15/1.00/0.90/ 0.0/0.25/0.018//Output: 91.74%/ 9.86%= 9.30/3.04/ 35/ 76", 15.8.6. "Input:7/7/3.4/1.2/0.35/0.15/1.00/0.90/ 7.2/0.30/0.019//Output:101.89%/ 9.75%=10.45/2.64/ 38/ 87", 15.8.7. "Input:7/7/3.4/1.2/0.35/0.15/1.00/0.90/ 2.4/0.50/0.022//Output:144.42%/ 9.83%=14.69/2.59/ 55/110". 15.9. Delete all "extern" declarations. 15.10. Seventh step of the adjustment - "avd.InputRiskLimit" computing - is completed. Chapter 16. Step eight: input patameters set final selection 16.1. Assign to each tuning thread of p.15.8 number from 1 to 7 according to listing order. 16.2. Find that tuning thread number 7 has best value of "Return on drawdown", the main measure of trading system profitability. 16.3. Find that all other result values of tuning thread number 7 are completely conforming the adjustment rules. 16.4. Find that tuning threads number 1 and 2 cedes to tuning thread number 7 in result values appraisal. 16.5. Find that although tuning threads number 3, 4, 5, 6 have better values of "Profit factor", these ones have weaker values of "Total trades", moreover all of these have weaker "Return on drawdown" value than "Return on drawdown" value of tuning thread number 7. 16.6. So, for first trading thread, that is defined by pair of "avi.InputIndex.1 = 7" è "avi.InputIndex.2 = 7", tuning thread number 7 "Input:7/7/3.4/1.2/0.35/0.15/1.00/0.90/ 2.4/0.5/0.022/55/110" with results "Output:144.42%/ 9.83%=14.69/2.59/ 55/110" is recognized as best of selected ones. 16.7. Eighth step of the adjustment - tuning thread final selection - is completed. Chapter 17. Step nine: input patameters set storage 17.1. Go to code page "//< A System: Parameters 1 >". 17.2. Set values of selected tuning thread "Input:7/7/3.4/1.2/0.35/0.15/1.00/0.90/ 2.4/0.5/0.022/55/110" in first line of fourth part of array "ac.Parameter []" under "// GOLD" header: "1 , 7 , 7 , 3.4 , 1.2 , 0.35 , 0.15 , 1.00 , 0.90 , 2.40 , 0.50 , 0.022 , 55 , 110 ,". 17.3. Ninth step of the adjustment - tuning thread final storage - is completed. 17.4. First trading thread is adjusted. Part 3. Continuing adjustment Chapter 18. Second trading thread adjustment 18.1. Set following values of the basic variables: 18.1.1. "int avi.InputIndex.1 = 7 ;", 18.1.2. "int avi.InputIndex.2 = 6 ;". 18.2. Thereafter follow common adjustment order according to Part 2 of the Example. 18.3. Study results of draft optimization with step 1.0 in area of values "avd.InputParameter.1" from 0 to 20 and "avd.InputParameter.2" from 0 to 20, then find that: 18.3.1. positive results cover this area almost entirely; 18.3.2. "avd.InputParameter.1" values greater then 10 have approximately equal results; 18.3.3. "avd.InputParameter.2" values greater 5-10 significantly reduce number of trades; 18.4. Run another draft optimization with step 0.5 in area of values "avd.InputParameter.1" from 0 to 10 and "avd.InputParameter.2" from 0 to 10 for more precise appraisal of the tuning thread. 18.5. Study results and select three following areas of "avd.InputParameter.1" and "avd.InputParameter.2" values: 18.5.1. "avd.InputParameter.1" îò 0.0 äî 4.0 ïðè "avd.InputParameter.2 = 2.0"; 18.5.2. "avd.InputParameter.1" îò 2.5 äî 5.5 ïðè "avd.InputParameter.2 = 3.5"; 18.5.3. "avd.InputParameter.1" îò 0.0 äî 8.0 è "avd.InputParameter.2" îò 4.5 äî 6.0. 18.6. For areas p.18.5.1 and p.18.5.2 run optimizations for "avd.InputParameter.1" with step 0.1, then select one pair of "avd.InputParameter.1" and "avd.InputParameter.2" for each the area: 18.6.1. "Input:7/6/2.9/2.0//Output:57.78%/14.25%=4.05/1.68/ 92/171"; 18.6.2. "Input:7/6/3.5/3.5//Output:65.08%/14.82%=4.39/1.84/ 58/106". 18.7. For area p.18.5.3: 18.7.1. run optimization for "avd.InputParameter.1" and "avd.InputParameter.2" simultaneously with step 0.2; 18.7.2. then, after study of results, run optimization with step 0.1 in five following areas: 18.7.2.1. "avd.InputParameter.1" îò 0.7 äî 5.0 è "avd.InputParameter.2 = 5.0"; 18.7.2.2. "avd.InputParameter.1" îò 0.7 äî 5.0 è "avd.InputParameter.2 = 5.1"; 18.7.2.3. "avd.InputParameter.1 = 2.6" è "avd.InputParameter.2" îò 4.0 äî 7.0; 18.7.2.4. "avd.InputParameter.1 = 3.8" è "avd.InputParameter.2" îò 4.0 äî 7.0; 18.7.2.5. "avd.InputParameter.1 = 6.4" è "avd.InputParameter.2" îò 4.0 äî 7.0; 18.7.3. then select from each the p.18.7.2 area one pair of "avd.InputParameter.1" è "avd.InputParameter.2" values: 18.7.3.1. "Input:7/6/1.9/5.0//Output: 64.65%/ 8.74%= 7.40/2.06/ 41/ 85"; 18.7.3.2. "Input:7/6/4.0/5.1//Output: 97.54%/ 8.18%=11.92/2.64/ 32/ 71"; 18.7.3.3. "Input:7/6/2.6/5.1//Output: 78.05%/ 8.17%= 9.55/2.29/ 36/ 77"; 18.7.3.4. "Input:7/6/3.8/5.1//Output: 93.87%/ 8.16%=11.50/2.70/ 31/ 70"; 18.7.3.5. "Input:7/6/6.4/5.0//Output:104.19%/ 8.74%=11.92/3.12/ 30/ 68"; 18.8. So there seven following tuning threads are ready for further adjustment: 18.8.1. "Input:7/6/1.9/5.0//Output: 64.65%/ 8.74%= 7.40/2.06/ 41/ 85"; 18.8.2. "Input:7/6/2.6/5.1//Output: 78.05%/ 8.17%= 9.55/2.29/ 36/ 77"; 18.8.3. "Input:7/6/2.9/2.0//Output: 57.78%/14.25%= 4.05/1.68/ 92/171"; 18.8.4. "Input:7/6/3.5/3.5//Output: 65.08%/14.82%= 4.39/1.84/ 58/106"; 18.8.5. "Input:7/6/3.8/5.1//Output: 93.87%/ 8.16%=11.50/2.70/ 31/ 70"; 18.8.6. "Input:7/6/4.0/5.1//Output: 97.54%/ 8.18%=11.92/2.64/ 32/ 71"; 18.8.7. "Input:7/6/6.4/5.0//Output:104.19%/ 8.74%=11.92/3.12/ 30/ 68". 18.9. For each tuning thread of p.18.8 select best pairs of "avd.InputFallLimit" and "avd.InputFallFactor" values: 18.9.1. "Input:7/6/1.9/5.0/0.00/0.00//Output: 64.65%/ 8.74%= 7.40/2.06/ 41/ 85"; 18.9.2. "Input:7/6/2.6/5.1/0.00/0.00//Output: 78.05%/ 8.17%= 9.55/2.29/ 36/ 77"; 18.9.3. "Input:7/6/2.9/2.0/0.00/0.00//Output: 57.78%/14.25%= 4.05/1.68/ 92/171"; 18.9.4. "Input:7/6/3.5/3.5/0.00/0.00//Output: 65.08%/14.82%= 4.39/1.84/ 58/106"; 18.9.5. "Input:7/6/3.8/5.1/0.00/0.00//Output: 93.87%/ 8.16%=11.50/2.70/ 31/ 70"; 18.9.6. "Input:7/6/4.0/5.1/0.00/0.00//Output: 97.54%/ 8.18%=11.92/2.64/ 32/ 71"; 18.9.7. "Input:7/6/6.4/5.0/0.00/0.00//Output:104.19%/ 8.74%=11.92/3.12/ 30/ 68". 18.10. Note that for the current trading thread with parameters "avd.InputParameter.1 = 7" and "avd.InputParameter.2 = 6" such position management method as "forced position closing" is unsuited. 18.11. For each tuning thread of p.18.9 select best pairs of "avd.InputLockSize" and "avd.InputLockFactor" values: 18.11.1. "Input:7/6/1.9/5.0/0.00/0.00/0.00/0.00//Output: 64.65%/ 8.74%= 7.40/2.06/ 41/ 85"; 18.11.2. "Input:7/6/2.6/5.1/0.00/0.00/0.35/0.40//Output: 76.01%/ 7.34%=10.36/2.17/ 49/ 98"; 18.11.3. "Input:7/6/2.9/2.0/0.00/0.00/0.00/0.00//Output: 57.78%/14.25%= 4.05/1.68/ 92/171"; 18.11.4. "Input:7/6/3.5/3.5/0.00/0.00/0.00/0.00//Output: 65.08%/14.82%= 4.39/1.84/ 58/106"; 18.11.5. "Input:7/6/3.8/5.1/0.00/0.00/0.35/0.30//Output: 92.17%/ 7.35%=12.54/2.57/ 43/ 89"; 18.11.6. "Input:7/6/4.0/5.1/0.00/0.00/0.35/0.35//Output: 95.39%/ 7.32%=13.03/2.51/ 46/ 92"; 18.11.7. "Input:7/6/6.4/5.0/0.00/0.00/0.00/0.00//Output:104.19%/ 8.74%=11.92/3.12/ 30/ 68". 18.12. For each tuning thread of p.18.11 select best value of "avd.InputTimeFactor.1": 18.12.1. "Input:7/6/1.9/5.0/0.00/0.00/0.00/0.00/0.00//Output: 64.65%/ 8.74%= 7.40/2.06/ 41/ 85"; 18.12.2. "Input:7/6/2.6/5.1/0.00/0.00/0.35/0.40/0.00//Output: 76.01%/ 7.34%=10.36/2.17/ 49/ 98"; 18.12.3. "Input:7/6/2.9/2.0/0.00/0.00/0.00/0.00/10.8//Output: 66.82%/12.84%= 5.20/1.80/ 91/178"; 18.11.4. "Input:7/6/3.5/3.5/0.00/0.00/0.00/0.00/15.0//Output: 67.43%/12.50%= 5.39/1.86/ 57/112"; 18.11.5. "Input:7/6/3.8/5.1/0.00/0.00/0.35/0.30/0.00//Output: 92.17%/ 7.35%=12.54/2.57/ 43/ 89"; 18.12.6. "Input:7/6/4.0/5.1/0.00/0.00/0.35/0.35/0.00//Output: 95.39%/ 7.32%=13.03/2.51/ 46/ 92"; 18.12.7. "Input:7/6/6.4/5.0/0.00/0.00/0.00/0.00/0.00//Output:104.19%/ 8.74%=11.92/3.12/ 30/ 68". 18.13. For each tuning thread of p.18.12 select best value of "avd.InputTimeFactor.2": 18.13.1. "Input:7/6/1.9/5.0/0.00/0.00/0.00/0.00/0.00/0.50//Output:102.80%/12.94%= 7.94/2.23/ 41/ 85"; 18.13.2. "Input:7/6/2.6/5.1/0.00/0.00/0.35/0.40/0.00/0.00//Output: 76.01%/ 7.34%=10.36/2.17/ 49/ 98"; 18.13.3. "Input:7/6/2.9/2.0/0.00/0.00/0.00/0.00/10.8/2.20//Output:104.59%/14.55%= 7.19/1.97/ 91/178"; 18.13.4. "Input:7/6/3.5/3.5/0.00/0.00/0.00/0.00/15.0/2.60//Output:114.22%/16.58%= 6.89/2.14/ 57/112"; 18.13.5. "Input:7/6/3.8/5.1/0.00/0.00/0.35/0.30/0.00/0.50//Output:156.94%/12.37%=12.69/2.91/ 43/ 89"; 18.13.6. "Input:7/6/4.0/5.1/0.00/0.00/0.35/0.35/0.00/0.50//Output:165.60%/12.54%=13.21/2.80/ 46/ 92"; 18.13.7. "Input:7/6/6.4/5.0/0.00/0.00/0.00/0.00/0.00/0.05//Output:174.02%/12.52%=13.90/3.48/ 30/ 68". 18.14. For each tuning thread of p.18.13 select "avd.InputRiskLimit" value corresponding to largest "Drawdown %" value that is less than 10%: 18.14.1. "Input:7/6/1.9/5.0/0.00/0.00/0.00/0.00/0.00/0.50/0.018//Output: 67.32%/ 9.57%= 7.03/2.22/ 41/ 85"; 18.14.2. "Input:7/6/2.6/5.1/0.00/0.00/0.35/0.40/0.00/0.00/0.034//Output:130.30%/ 9.89%=13.17/2.16/ 49/ 98"; 18.14.3. "Input:7/6/2.9/2.0/0.00/0.00/0.00/0.00/10.8/2.20/0.016//Output: 59.44%/ 9.47%= 6.28/1.95/ 91/178"; 18.14.4. "Input:7/6/3.5/3.5/0.00/0.00/0.00/0.00/15.0/2.60/0.014//Output: 55.52%/ 9.47%= 5.86/2.04/ 57/112"; 18.14.5. "Input:7/6/3.8/5.1/0.00/0.00/0.35/0.30/0.00/0.50/0.020//Output:114.71%/ 9.97%=11.51/2.88/ 43/ 89"; 18.14.6. "Input:7/6/4.0/5.1/0.00/0.00/0.35/0.35/0.00/0.50/0.019//Output:111.89%/ 9.73%=11.50/2.76/ 46/ 92"; 18.14.7. "Input:7/6/6.4/5.0/0.00/0.00/0.00/0.00/0.00/0.05/0.019//Output:117.32%/ 9.59%=12.23/3.39/ 30/ 68". 18.15. For second trading thread, that is defined by pair of "avi.InputIndex.1 = 7" è "avi.InputIndex.2 = 6", tuning thread of p.18.14.5 "Input:7/6/3.8/5.1/0.00/0.00/0.35/0.30/0.00/0.50/0.020/43/89" with results "Output:114.71%/9.97%=11.51/2.88/43/89" is recognized as best of selected ones. 18.16. Go to code page "//< A System: Parameters 1 >". 18.17. Set values of selected tuning thread "Input:7/6/3.8/5.1/0.00/0.00/0.35/0.30/0.00/0.50/0.020/43/89" in second line of fourth part of array "ac.Parameter []" under "// GOLD" header: "1 , 7 , 6 , 3.8 , 5.1 , 0.00 , 0.00 , 0.35 , 0.30 , 0.00 , 0.50 , 0.020 , 43 , 89 ,". 18.18. Second trading thread is adjusted. Chapter 19. Third trading thread adjustment 19.9. Let third trading thread of trading symbol "GOLD" in the example be empty. Chapter 20. Fourth trading thread adjustment 20.1. Let fourth trading thread of trading symbol "GOLD" in the example be empty. Part 4. Completing adjustment Chapter 21. Completing system optimization mode 21.1. Go to code page "//< A System: Parameters 2 >". 21.2. Set initial values of input patameters according to Chapter 9 of the Example. 21.3. Go to code page "//< A System: Parameters 1 >". 21.4. Set "avb.IsOptimizing = 0 " to complete system optimization mode, see p.4.4. Chapter 22. Risk level adjustment 22.1. Purpose of that adjustment stage is to limit deposit relative drawdown in test period by certain value for current trading symbol. 22.2. Let this value is "20%" for current trading symbol. 22.3. Check that all treads in code page "//< A System: Parameters 1 >" are "Off" excluding treads of trading symbol "GOLD"; in othet words, all first elements in all parts of array "ac.Parameter []" must be "0" excluding the fourth part. 22.4. Go to code page "//< A System: Function 5 >" that is containing method "afr.System.LoadSymbol". 22.5. Delete in first line of the code "//" to activate statement "avd.RiskFactor = avd.InputRiskFactor ;". 22.6. Go to code page "//< A System: Parameters 2 >". 22.7. Declare variable "avd.InputRiskFactor" as "extern": "extern double avd.InputRiskFactor = 1.00 ;". 22.8. Compile code. 22.9. Go to "Settings" tab of strategy tester and set "Optimization = On". 22.10. Go to dialog box "Expert Properties" and set in "Inputs" tab: 22.10.1. "avd.InputRiskFactor" - "Variable = On", "Value = 0", "Start = 0", "Step = 0.01", "Stop = 2.00". 22.11. Run optimization. 22.12. After completion of computations go to tab "Optimization Results". 22.13. Find that largest "Drawdown %" value, that is less that 20%, is equal to "19.94%". 22.14. Find that corresponding value of "avd.InputRiskFactor" is equal to "1.26". 22.15. Go to code page "//< A System: Function 5 >". 22.16. Restore in first line of the code "//" before "avd.RiskFactor = avd.InputRiskFactor ;". 22.17. Go to code page "//< A System: Parameters 2 >". 22.18. Delete "extern" declaration of "avd.InputRiskFactor" variable. 22.19. Go to code page "//< A System: Parameters 1 >". 22.20. Set value of fourth element in array "ac.RiskFactor []" equal to "1.26". 22.21. Compile code. 22.22. Run strategy tester. 22.23. Save results: "Output:605.01%/19.94%=30.34/2.92/96/203". 22.24. Set "avd.SystemStop = 0.80" or less. 22.25. Compile code. 22.26. Run strategy tester. 22.27. Check that obtained results are the same that ones of p.22.23. 22.28. Risk level adjustment for trading symbol "GOLD" is completed. Chapter 23. Code changes 23.1. Content of code page "//< A System: Parameters 1 >" before adjustment: " //< A System: Parameters 1 > bool avb.IsOptimizing = 0 ; double avd.SystemStop = 0.80 ; string ac.Symbol [] = { "" , "EURUSD" , "GBPUSD" , "" } ; double ac.RiskFactor [] = { 0 , 1.00 , 1.00 , 0 } ; double ac.Parameter [ ac.Symbols , ac.Threads , ac.Parameters ] = { // Reserved 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , // EURUSD 1 , 7 , 6 , 0.8 ,10.0 , 0.50 , 0.40 , 0.00 , 0.00 , 0.00 , 16.40 , 0.014 , 20 , 85 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , // GBPUSD 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , // Reserved 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , } ; // " 23.2. Content of code page "//< A System: Parameters 1 >" after adjustment: " //< A System: Parameters 1 > bool avb.IsOptimizing = 0 ; double avd.SystemStop = 0.80 ; string ac.Symbol [] = { "" , "EURUSD" , "GBPUSD" , "GOLD" } ; double ac.RiskFactor [] = { 0 , 1.00 , 1.00 , 1.26 } ; double ac.Parameter [ ac.Symbols , ac.Threads , ac.Parameters ] = { // Reserved 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , // EURUSD 0 , 7 , 6 , 0.8 ,10.0 , 0.50 , 0.40 , 0.00 , 0.00 , 0.00 , 16.40 , 0.014 , 20 , 85 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , // GBPUSD 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , // GOLD 1 , 7 , 7 , 3.4 , 1.2 , 0.35 , 0.15 , 1.00 , 0.90 , 2.40 , 0.50 , 0.022 , 55 , 110 , 1 , 7 , 6 , 3.8 , 5.1 , 0.00 , 0.00 , 0.35 , 0.30 , 0.00 , 0.50 , 0.020 , 43 , 89 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , 0 , 7 , 7 , 1.0 , 1.0 , 0.00 , 1.00 , 0.00 , 0.00 , 0.00 , 0.00 , 0.000 , 1 , 1 , } ; // " 23.3. Code page "//< A System: Parameters 1 >" is only place of code changes. 23.4. System adjustment is completed.