TUTORIAL: Capture Modes/Methods
This tutorial covers the various capture methods which say how the color index buffers read from a custom indicator should be interpreted, in order to derive a buy/sell indication, or trade/no trade. The various capture modes are gone through in order of importance.
Some capture methods require a Mid Point value that is supplied as an additional setting to the Color Indexes. For example, if an indicator is signalling buy if greater than 50 and sell if less than 50 then the Mid Point value should be set to 50.
Another setting that can important to capture is Null Value. Null value is the value a color index buffer has when the color is not being shown. Usually, it's fine to keep this set to AUTO. Auto will handle when the null value is either 0 or special constant called EMPTY_VALUE (this is the official MetaTrader way of not showing a color). Occasionally, though, an indicator developer may chose to use something like -1, in which case Null Value would have to be set to -1 instead of AUTO.
Capture Method - DefaultBuySell
This is by far the most mode common capture method as it candle both changes of color, e.g. line color change, histogram, dots/arrows, and also handle values say crossing 50 for buy/sell, or 0 (so called mid point value). It can even handle values crossing oversold/overbought levels. Lets look at color changes first:
DefaultBuySell for Color Changes
If two color indexes are specified then will regard as buy signal if first color index is present (not null) or sell if second color index is present. Color indexes need to be comma separated, e.g. 0,1 will signal buy if color index 0 is not null or sell if color index 1 is not null. This works for line color changes, histogram color changes and for dots/arrows and the like, which is display used color index buffers. Note, some indicators use chart objects for displaying arrows. This will show up in color index helper tool and will need something like OBJ:Arrow mentioned in our library.
Some indicators may have multiple pairs of buy/sell color indexes then need to be check.ed This can achieved by simply listing them in pairs comma separated, e.g. buy1,sell1,buy2,sell2 etc.
In MetaTrader 5 is quite common to see where a single color index gives buy/sell indication by say being value 1 for buy and value 2 for sell. In this situation supply the color index that gives the value and set Mid Point to the buy:sell value, e.g. 1:2. If other values also give buy and sell then can supply these by comma separated, e.g. if 1 or 3 is buy and 2 or 4 is sell then can set Mid Point to 1,3:2,4
Finally, can use ~ before Mid Point value to check color index before supplied one is not null. This can be useful for MetaTrader 5 where (say) color index 0 is giving the price and index 1 is giving the color value, so want to look at color given by index 1 but also check index 0 is valid (not null).
DefaultBuySell for Value Crossing Mid Point
Indicators that give buy/sell by line crossing particular value can also be handled by DefaultBuySell. Just need to supply the color index that gives then value and in Mid Point setting supply the value that gives the buy/sell threshold, e.g. 0 or 50. So, if mid point 50 is supplied then buy will be when color index buffer is giving a value above 50 and sell is when below 50.
For oversold/overbought you can supply this in the Mid Point setting as (say) 80/20 which will signal buy when color index goes above 80 and sell when goes below for 20, e.g. for a breakout strategy. If supply 20/80 then will signal buy will below 20 and signal sell when above 80, e.g for a reversal strategy.
Capture Method - CrossBuySell
The second most common method is CrossBuySell which is for when indicator lines are crossing each other, e.g. slow and fast line crossing, or price crossing an indicator line. Crossing upper & lower bands is also supported, e.g. price crossing Bollinger Bands. Special values of the Mid Point setting can also be used to control how the supplied color indexes are handled. Finally, this capture mode can handle Heiken-Ashi style candles as they have close and open price and buy/sell is determined if close is above or below open price.
CrossBuySell for Two Lines Crossing Each Other
Simply supply the color index buffers that give the values that are crossing each other, comma separated. The line that is moving faster should be supplied second. For example, if a red line (color index 4) crossing a slower yellow line (color index 5) then supply 5,4 for the color indexes setting - will give buy when red above yellow and visa versa for sell.
Note, the indicators don't necessarily have to show two lines. If had histogram crossing a line then CrossBuySell capture method will work as well, as the histogram is just represented by a color index buffer also.
CrossBuySell for Price Crossing Line
A special color index buffer of -1 presents price. So, if interested in price crossing a line (say given by color index 0) then color indexes needs to be set to 0,-1. If you are interested in candle close price crossing then the Shift setting, which is also present when capturing indicators, should be set to 1 (closed candle), rather then 0 (live candle - current market price). Note, if interested in Heiken-Ashi close crossing then set color index to -2 instead of -1.
CrossBuySell for Line or Price Crossing Upper/Lower Bands
If interested in a line crossing upper and lower bands then three color indexes can be supplied to achieve that. Supply the upper band color index followed by lower band index and then the index that gives the line that is doing the crossing, again comma separated. Will normally signal buy when line crosses upper band and sell if crosses lower band, e.g. break out strategy. If interested reversal strategy, e.g. signal sell when line crosses upper band then set Mid Point to !. If interested in price crossing upper/lower bands then supply -1 as the color index buffer to represent price.
CrossBuySell and Checking Gap Between Lines, e.g. number of pips between lines
If interested on checking not just lines have crossed but also that the gap between the lines if sufficiently big then this can be done by setting the required minimum gap in the Mid Point setting. If interested in number of pips rather the absolute difference then add the letter p after the number.
CrossBuySell and Checking Crossed Line Reached Certain Value
If interested on checking not just lines have crossed but the crossed line has also reached a certain value then can set this can be achieved by placing a tilde before the value in the Mid Point setting. For example, if interested if green line crossed red for buy and that green value is above 15 then set the Color Indexes to the green followed by red index and set the Mid Point to ~15. Note, for sell will check red crossed green and red value is above 15.
CrossBuySell Correct Color and Above Other Line
If need to check a line or histogram that changes color for buy and sell and also that it has crossed another line (color index) then this can be achieved by setting Color Indexes to the buy color followed by sell color followed by line to have crossed and then set Mid Point to > or ~. Note, if want reversal i.e. signal sell rather than buy and visa versa then set Mid Point to !~ Note, if not interested in color being correct and just want to use whichever of the first two color index are available then set Mid Point to ~~ or for reversal set to !~~.
CrossBuySell Line Beyond Two Other Crossed Lines
For indicators that have lines crossing each other and when need to check line is beyond those lines then this can be achieved by setting the Color Index for the lines that are crossing followed by the color index of the line that needs to be beyond this and then set Mid Point to ^. A good example of this is the Ichimoku indicator, where two lines are used to show a 'cloud' and then a third line needs to be above this for buy or below for sell.
CrossBuySell With Four Color Indexes, e.g. Bollinger lines crossed other Bollinger
If interested in check two lines have crossed two other lines then this can be achieved by supplying the color indexes for the slower upper and lower bands followed by the color indexes of the faster bands, i.e. supplying 4 color indexes comma separated. By default, i.e. Mid Point is blank, will check both lines have crossed with reversal being achieved by setting Mid Point to !. However, if just interested in one line of faster bands have crossed then set Mid Point to ^ or !^ for reversal.
CrossBuySell With Five Color Indexes, e.g. similar to 4 color indexes but also (say) price crossed
If want something similar to the four color indexes of two bands crossing each other but also want to check (say) the price has crossed also then this can be achieved by adding a 5th color index of -1 to represent price.
CrossBuySell With Six Color Indexes
We added this for an indicator called 'Follow The Line PRO', which has three lines - a signal line crossing an upper and lower line (band). However, those lines also changed color with green for buy and red for sell. This unfortunately meant checking 6 color indexes, with 3 for green (buy) situation and another 3 for red (sell). Those 6 color indexes should be supplied as buyUpper,buyLower,buySignal,sellUpper,sellLower,sellSignal.
Capture Method - DefaultValue
Used in our EA product when the raw value is to be captured from the indicator, rather than deriving a buy/sell indication straightaway. This is useful for bespoke configuration, where more analysis is done on the indicator before signalling buy/sell.
Capture Method - Distance (to Not Null)
This is can be used for indicators that show arrows/dots at the start of the trade signal. The capture method will scan back through the chart to see if the latest arrow/dot is buy or sell. You need to supply two color indexes, one for the buy arrow/dot and the other for the sell, which are not null when arrow/dot is shown. Useful for indicators that repaint or can vary how far back the arrow/dot can appear, e.g. not always on closed candle. If the arrow/dot is reliably shown (say) on closed candle then recommend DefaultBuySell capture method with shift setting of 1 (closed candle), as more efficient (less CPU). Can also be used when checking for arrow/dot on upper time frame and don't want to wait ages before know if buy or sell - by scanning back can know if buy/sell straightaway.
Capture Method - DistanceMidPoint
Similar to capture method distance, this will scan back to see when supplied color index gives a buy/sell signal when compared to supplied Mid Point. As with DefaultBuySell capture method, the mid point value gives the transition between buy and sell, e.g. 0 or 50 are quite common values. This capture method is useful for indicators that only give a signal at the start of the buy/sell zone. The looping/scanning back will see if buy or sell is that latest and is great for an indicator that repaints or if (say) upper time frame check, where don't want to wait ages for signal before know if upper time frame is buy or sell.
Capture Method - Inc/Dec
This can be used to see if supplied color index is increasing or decreasing in value, i.e. sloping up or down. It's also possible to check how much sloping as well. Begin by supplying the color index of the line for which the slope is to be checked. If the line changes color, i.e. presented by more than one color index, then supply these comma separated. Buy will then be returned if line has increased from previous candle or sell if decreased. If also want to check several candles back then set the number of candles in the Mid Point setting.
If also want to check the extent of the slope that this too can be specified in the Mid Point setting, just put a / before the value. If want to supply as pips rather than absolute value then add the letter p after the number.
Capture Method - NotNullIsBuy and NotNullIsSell
This is a special case where have an indicator showing colors (one of buy and one for sell - say) but one color is always present and the other color is on top, which is turned on and off for the trade signal, i.e. not null or null, so when off reveals the color underneath. This means the color index that is always present is of no use. Instead, just need to supply the color index that is being turned on and off and seeing if present, i.e. not null. If buy signal is when that index is giving not null then use capture method 'Not Null Is Buy' and if sell signal when not null then use 'Not Null Is Sell'
Capture Method - UseNotNull
This is for an indicator line/histogram that changes color, i.e. uses more then one color index, but not interested in the color, just the value from it, which is to be compared with a supplied Mid Point value. Set the color indexes to what is used to show the line or histogram and the system will automatically use the value from the color index that is not null. This will then be compared to the Mid Point value to get the buy/sell signal, similar to how is done for the DefaultBuySell capture method.
Capture Method - OnCross
This capture method focuses on giving a buy/sell signal at the point the indicator value crosses a supplied Mid Point value. You can supply the Mid Point value in the same way as capture method DefaultBuySell, but will only get a signal when cross of that supplied mid point has occurred. In the case of oversold/overbought then will only signal when goes back from oversold/overbought zone. The capture method is useful for timing trades such that the happen on the cross of the required value. The color index setting should the index that provides the value to be checked against the supplied Mid Point.
OnCross also supports three color indexes for line/price reaching upper or lower bands. Works similar to CrossBuySell in this regard, except that it just signals when cross of bands happens. For reversal, i.e. when Mid Point is set to !, it will signal when price/line crosses back under high band for sell and back above low band for buy.
Capture Method - ValueAboveMid and ValueBelowMid
These capture methods are used to say wether should trade or not, rather than the direction. If supplied color index value is above or below (depending on capture method) the supplied mid value then will trade. If need to check within certain range to trade, e.g. 80 to 20, then can use ValueBlowMid and set Mid Point to 80/20. Note, for our Dashboard type products, a tick or cross will be displayed if can trade or not, rather than a direction arrow. Note, you must combine with other indicator(s) that give a buy/sell indication in order to get a trade signal.
Note, if the value need to check changes color then can provide two color indexes in the Color Index setting, separated by comma. The system will then automatically use the value from the index that is not null.
Capture Method - CrossedForTrade
This is in a similar vein to Value Above/Below Mid, where we determine if should trade or not, rather than the direction. Here two color indexes should be supplied and will allow trading if value from second index is above value from first. Again, other indicator(s) should be combined to give the buy/sell signal.
Capture Method - IncreasingForTrade
This is another capture method that will say if should trade or not, rather than giving a buy/sell direction. Will allow trade if the value from the supplied color index is going up (increasing). Will need to combine with other indicator(s) to give a buy/sell direction.
Capture Method - CurrencyDiff
This is for indicators that output information on individual currencies, where a separate color index is used for each currency. The input Gen_currencies is used to convert the currency to the color index, numbered 0 upwards. The system will automatically capture the required base and counter currency value for the currency pair being traded. With this capture method the difference between the values will be compared with the supplied Mid Point value and buy/sell signal will depend on that. For example, if Mid Point is 0 and base currency is higher/crossed counter currency then will signal buy and visa versa for sell. If Mid Point is greater then 0 then the difference will need to above that for the signal. If want to check base/counter reached certain values then can set in Mid Point using /, e.g. if mid point 6/3 which will check for buy that base > 6 and counter < 3 and visa versa for sell, i.e. base would need to be < 3, etc. If only interested in one currency reaching that target that put a tilde before, e.g. ~6/3 (will of course check the other currency isn't in the same zone, e.g. both above 6).
Finally, if want reversal signal when currency lines cross each other then set Mid Point to ! or if supplying a value in Mid Point, i.e. for minimum difference, then use a negative value. Note, to do reversal on 6/3 Mid Point setting then put 3/6 instead.
Capture Method - CurrencyIncDec
This is similar to CurrencyDiff but will look at the slope of the currency lines, rather than the extent they are crossed. Will check that base currency is increasing (sloping up) and counter currency is decreasing (sloping down) for buy signal and visa versa for sell.
Capture Method - CurrencyPosn
This is another currency based capture method that will instead rank the currencies from strongest down to weakest. Position 1 is currency with highest value and position 2 is 2nd from highest, and so on. Set Mid Point to difference the positions needs to be above for trade. Or can set to 2/6 (say) which will signal when base currency is in top two currencies and counter is in bottom two for buy trade and visa versa for sell, assuming 8 currencies.
Capture Method - AboveBelowReversal
This remains for legacy reasons. It's now possible to configure oversold/overbought reversal with DefaultBuySell capture method.
Capture Method - Value*
These also remain for legacy reasons. They concern capturing raw value from indicators, but DefaultValue should now be used instead.