Antirepaint

From MetaTraderProgrammer WIKI
Jump to: navigation, search


Overview

The antirepaint package is to identify repainting in an indicator and to determine it's real performance in real market. It can be used either on live charts and in visual testing via strategy tester.

The antirepaint is capable to watch 4 index of the indicator. It shows the original (possibly repainting) index as well as the real non-repainting version of the index clearly separable. For the line indicators the non-repainting version of lines are dashed while the original lines are solid. For arrow/dot indicators the non-repainting version of arrows/dots are empty circles while the original ones are filled.

Usage on live chart

Step 1 – Installation

Install the indicator following this guide: Installation_Manual

Step 2 – Make note of the investigated indicator

Make sure the indicator you want to investigate is working. If you want to use different parameters than the default, make note of the first 8 parameters you are using. Also make note of the indicator name, char by char. Write it down case-sensitively making sure no space, dot, underline, etc is missing.

Step 3 – Select the appropriate indicator

Choose between the 3 versions of the indicator:

  • antirepaint_subwin - For all indicators which use separate window (not drawn on the main

chart)

  • antirepaint_dot - For arrow/dot indicators.
  • antirepaint - all other cases

Note: If you are clear about all the parameter, you can use the base version for all the purposes. Double-click Drag&drop the indicator to the chart.

Step 4 – Setting up parameters

Set the parameters according to the section devoted to parameter description and click OK. Make sure the indicator's line is visible on the chart

Step 5 – See result

After few bars drawn you can check the result. By pressing Ctrl+D you can check the result also in the data window.

Usage on Visual Testing

Step 1 - 4

Do the same steps as in the previous section until Step 4.

Step 5 – Save template

Select Charts->Template->Save Template from menu (you can find the same in the toolbars). Save the chart template as name "indicatortester".

Step 7 – Set up strategy tester

Press Ctrl+R to show Strategy Tester. Set the following settings:

Expert Advisor: "indicatortester"

Visual Mode: checked, pull the slider a one step before the right side. (About other settings please read the document "Strategy_Tester_Manual.pdf" page 4.)

Step 8 – Run test and view results

Press the start button and watch the results.

Explanation of Parameters

Parameter Unit Description Sample Values
indicator_name - file name of the indicator you want to investigate "Bands", "Heiken Ashi"
indicator_useparams - if false, the default parameters of the investigated indicator are used true or false
indicator_input1-8 - If the indicator_useparams is true, you can set the first 8 inputs of the investigated indicator 1 to 8
idx1-4 - indicator indices to investigate 0, 1, 2, 3
bar_allow_repaint - includes an exception for a bar that is allowed to repaint (mostly the current bar, 0) 0, 1, 2, 3
bar_allow_firsttick_only - allows the value of a particular particular bar to repaint on the first tick of the bar after it 0, 1, 2, 3
bar_allow_firsttick_only - allows the value of a particular particular bar to repaint on the first tick of the bar after it 0, 1, 2, 3
bar_draw_original number of bars ago if set to true, allows Antirepaint to display the output of the original indicator in the chart history 100


If indicator_useparams is set to true, you can set 8 number inputs. For most cases you can leave this on false.

For true/false parameters in indicator_input1-8, use 0/1 (false/true) values.

In most cases you don't need to touch the parameters idx1-4. You can select 4 indicator index of the investigated indicator. You can check the indicator indexes in the Data Window (Ctrl+D). Note, that numbering is started from 0. Some indicators doesn't show anything in the data window, for them you can use their indicator settings window -> Colors tab to find out the numbering.

Antirepaint also comes with parameters for type and styles (draw_orig_type, draw_orig_style, draw_nonrepaint_type, draw_nonrepaint_style). These parameters are not available on the dot version. For more information about the types and styles used, go to http://docs.mql4.com/constants/drawstyle

For bar_draw_original, the default is 100, meaning that the last bar plus max 100 bars may you see repainting on the original version. The original indicator may repaint more bars anyway.