- Author:
- Copyright (c) since 2011, MJ
This documentation is generated by Doxygen. Click on "Files" to see the list of documented files.
GENERAL DOCUMENTATION
COMMON INPUT VARIABLES
Input Parameters which are used in most of my Indicators
- Indicator User Input Option Start With a Lowercase letter.
_____________0_____________ = "<<< COMMON SETTINGS >>>"
*sExtUniquePrefix: Normally it starts with a 1- and then something related to the indicator name. e.g. 1-IndiName.
- This is used to generate the final Unique sFullUniquePrefix which looks like this: sExtUniquePrefix_ChartPairName_ChartInterval@
- e.g. if sExtUniquePrefix = 1-STO_MTF >> the final sFullUniquePrefix will be: 1-STO_MTF_EURUSD_M1@
- this sFullUniquePrefix must be unique across all charts: I check this for my own indicators (this is mainly to make sure that Objects like Text, Labels, VLines, Hlines, TrendLines etc.. are working correctly.)
- in case one adds multiple same indicators to one chart one must set the sExtUniquePrefix to some thing like: 1-IndiName, 2-IndiName, 3-IndiName.
- e.g. 1-STO_MTF, 2-STO_MTF, 3-STO_MTF
- sExtUniquePrefix: must be a at least 3 and max 25 chars long
*bExShowIndicatorInfo: If TRUE: some indicator info such as indicator name, buffer labels etc. are shown. Main purpose of it is to be able to set it to FALSE to remove all indicator info when using multiple ones in one SubWindow.
*sExtGeneralFontType: General font type used by most text and text label obj etc..
*bExtStartDelay: Default for most of my indicators is a start delay on purpose. If FALSE: it can easily produce mistakes and wrong indicator values etc..
- Note the StartDelay counter is only updating when new ticks arrive: so in slow market in might take a little time.
- This option is here to be able to deactivate this feature for test purpose.
- IMPORTANT: At Inactive Times (e.g. week ends) set it to false: Otherwise it keeps hanging as we have no Tick loop and it never comes over the StartDelay
- TIP: probably the best is to make two templates: one with bStartDelay enabled for live action time: and one template with it deactivated for weekends etc..
- NOTE: Most of my indicators make use of this (not all): some do not even though I still leave the option there - normally in such case I point it out in the indicator input tab.
"== CALCULATION START/END =="
*iExtPastStartChartSHIFT: Sets how many chart bars we calculate from the past:
- Must be greater than 0(CurrentBar) or use: -1 which calculates all possible past results
- NOTE: Most of my indicators make use of this (not all): some do not even though I still leave the option there - normally in such case I point it out in the indicator input tab.
*iExtPastEndChartSHIFT: Sets at which chart bar we end the calculation: if it is greater than 0 we end calculation in the past.
- If one wants to calculate also live bars iExtPastEndChartSHIFT MUST BE 0.
*bExtNoPastSHIFTUseTimeInstead: If TRUE: the PastStart/End SHIFT are ignored and the PastStart/End TIME is used: mainly useful for some kind of backtesting.
- IMPORTANT: this option does not always 100% correctly use the Start and End Time (e.g. some Charts have holes where at certain times there are no bars etc.. e.g. weekends) - but it should be good enough for the purpose.
- With this option one can not use live action. This is mainly intended for indicators using Alerts as some kind of backtest functionality for a defined time period.
*dtExtPastStartTIME: Sets Start Time for chart bars we calculate from the past. (Basically same function as the iExtPastStartChartSHIFT: in fact internally I just convert it to such)
- FORMAT: 2004.01.01 12:00:00
*dtExtPastEndChartTIME: Sets End Time for chart bars we calculate from the past. MUST be earlier than the current time. With this option one can not use live action.
"== DEBUG/Error/INFO RELATED =="
*bExtDebugUsePrintScrollLines: Switch: switches the normal Print() function which writes to MT4 log file and uses instead a 25 line big scrolling comment on the Chart
*bExtDebugAlertOnErr: Debug AlertOn: If TRUE: Additional Alerts are send if an error occurs and not only write it into the log file.
*bExtDebugAlertSoundOnErr: Debug Play Soundfile on Error: If TRUE: also plays a sound file on error
*bExtErrInfSoundFileName: Name of the Soundfile used for Info and Error: must exist in the MT4 sounds folder.
*cExtInfErrObj: Color for the special Error and Info TextLabel Objects
"== OTHER COMMON VARIABLES =="
*iExtCompPrecisionDigits: Rounding Precision used in comparisons of certain values. It is mainly used in Alerts or Color Direction comparisons and such.
- 3 at the moment it uses 3 settings:
- 0=Use Pair Digits
- 1=Use Pair Digits + 1
- 8=Use 8 Digits
===== END OF ===== COMMON INPUT VARIABLES =====
COMMON ERRORS:
I try to fetch many possible errors.
- One of the more annoying errors is when one tries to attach an indicator and two things are already exist:
- 1. when a same Unique indicator name exists: see the info for input parameter: sExtUniquePrefix.
- This can be because an other indicator in the terminal( can also be on an other chart) has already created them and this is a warning for you to change the: sExtUniquePrefix
- BUT sometimes there are other reasons and it must be removed manually from the global variables to be able to attach the indicator: Terminal: Tools>GlobalVariables
- From MT4 doc: Global variables are kept in the client terminal within 4 weeks since the last access, then they will be deleted automatically.
- BTW: If all works correctly I clean up my own indicators Global Variables: but sometimes the hang.
- 2. the second common error is very much related to the one above but is only across the same chart. When the special 3 ERR/INF objects (ErrWarnBottom, ErrWarnTop, Inf:: sometimes also a couple of others)) already exist with the same name.
- Again: This can be because an other indicator in the terminal( can also be on an other chart) has already created them and this is a warning for you to change the: sExtUniquePrefix
- BUT sometimes there are other reasons and they must be removed manually from the global variables to be able to attach the indicator: Terminal: Charts>Objects>Objects List
- TIP for the 2 Errors above:
- in case the indicator can not be applied - before giving up try this:
- Close all charts of the Terminal
- Remove all GlobalVariables: Tools>GlobalVariables
- Restart the terminal and open one chart and try to add the indicator. This should do the trick in 99 % of cases. (Make sure you have enough data for the pair and all needed TimeFrames (in case of an MTF indicator)
- NOTE: this does not mean you will not get any other errors because of wrong User input or not enough data in the charts history etc.. - but this should be more easily resolved afterwards.
- 3. NOTE TEMPLATES:
- VERY IMPORTANT: When creating templates usually the objects mentioned above are saved within the template file.
- if one applies such a template one gets on occasions an error that the objects already exist. THREE solutions:
- 1. When I create a template I usually do one thing befor saving it: I open Chart>Objects>Objects List: and delete all existing objects and then save the template.
- 2. Or remove them manually: remove from the template the objects: I usually use a simple text editor like: (geany) to remove them: search for start tag:" <object> and the end tag: </object> ".
- 4. IMPORTANT: Quite often errors will be related to not having the right or enough History data. Often it is enough to open the Charts with all the needed TimeFrames and restart the terminal.
===== END OF ===== COMMON ERRORS =====
COMMON ALERTER INFOS:
Many of my indicators come with an Alerter or are specific Alerter indicators. I use in general for all such the same costumary Alerter subsystem with quite a number of useful options. (or only slightly changed for a specific indi)
The most common Alerter input options are:
*bPastAlertsOn: * Main On/Off alert option for Past data Alerts. If it is false: there is no alert for Past Data no matter what the other Alert settings are.
- NOTE: Past data Alerts only make use of: bWriteFileAlert, bVLineAlert: all others do not really make much sense
- If there are very many Past data to be processed: it could crash the terminal.
*bLiveAlertsOn: Main On/Off alert option for Live Alerts. If it is false: there is no alert no matter what the other Alert settings are.
*iAlertOptionWhen: Alert Option When to Alert:
- 0=Alert Only once per chart bar OR if MainMessage changed.
- 1=Alert Only IF the MainMessage changed
- 2=Alert Only Once: After that it must be reset.
*bPopUpAlert: If there is an valid Alert: send a PopUp Alert.
*bSoundAlert: If there is an valid Alert: play a Sound Alert.
*sAlertSoundFileName: Name of the Soundfile used for bSoundAlert.
*bEmailAlert: If there is an valid Alert: send an Email Alert (must be correctly configured in MT4 Client).
*bWriteFileAlert: If there is an valid Alert: write it to a AlertFile. (Might fill up your harddisk if not watched) Files are created in MT4:" experts/files: (Notes: Files can only be opened in the terminal_directory\experts\files folder (terminal_directory\tester\files if for expert testing) or in its subfolders)."
- this is a .csv file which can also be opened in excel or such for easy columns access.
*bVLineAlert: If there is an valid Alert: create a VLine on the Chart Bar (Note in case more than one Alert happens we only update the VLine: this means in case an indicator uses different colors fo up and Down Signals only te last one will be recognizable with VLines.
*iAlertVLineStyle: VLine Alerts Line Style: 0=Solid, 1=Dash, 2=Dot, 3=DashDot, 4=DashDotDot.
*iAlertVLineWidth: VLine Alerts width. Valid values are: 1,2,3,4,5. BUT it seems it accepts also individual higher numbers which is quite useful.
*cAlertVLineColorUP: VLine Alerts UP Color value to set/get object color.
*cAlertVLineColorDN: VLine Alerts DOWN Color value to set/get object color.
*bAlertVLineBack: If TRUE: VLine Alerts are Drawn in Background. Boolean value to set/get background drawing flag for object.
*iAlertVLineSubWindowNum: Index of the window where the object will be added. Window index must exceed or equal to 0 and be less than WindowsTotal(). 0 is main chart window.
- Can be used to plot also only in one SubWindow. One can use it also as kind of Bar Histogram using an empty SubWindow indicator: (my version: EmptySubWindow) to plot too.
IMPORTANT NOTE FOR VLine Alerts:
For Live Data Vline Alerts the Vline will usually update during the chartbar and stays with the last 'situation' of the chart bar. If one uses MTF based Alerts e.g. MTF Stochastic based Alerts and plots also the MTF STOk line it usually repaints the last MTF Bar: MTF M5 Chart M1 it might repaint up to about 5 chart bars.
In such a situation it can be that by Live Data the VLine Alerts seem to be wrong when one looks at it later BUT NOTE: the Vline Alerts stay with the situation they where when a chart bar closed and do not repaint like the MTF indicator.
- so to know if such Alerter works correctly one has to watch and check it in the 'live circumstances'.
Basically this is done to avoid potentially 1000 of 1000 VLines to repaint at each tick - and it is also interesting to see what was the ACTUAL situation at the time of the chart bars close
===== END OF ===== COMMON ALERTER INFOS =====