Search This Blog

Thursday

KillGap indicators


  You'll never catch myself wishing to take the scissors, cut befell after the holidays or weekends gap and glue quotes? ))) )))
  Forex indicators, once such a gap (which can be hundreds of items and more), fall in prostration (as much bent arrows) on the length of its calculation (for indicators with FIR).  For indicators with IIR all can be much worse. . In short, while "arrow does not straighten out, and the indicators will not be adequate, they will be at best useless, and sometimes can hurt.
 That's what happened with "scissors and paste.  On the schedule podtsepleny Envelops, RSI and ATR in two versions - c gepom (red) and without (blue).
Forex indicators
  For the intraday time-frame, this is not a systematic gap carries no information, but on the contrary - makes a malfunction indicator. You can simply count the history of this indicator re-Gap, but you can use the previous dogepovye quotes.  In any case, it is more acceptable than the presence of Gap in the original data.

  How to identify a "festive" gap?  It is obvious that it must meet two conditions:
1.  The time between adjacent bars should not be less than, say, eight hours.  If it does not take into account, in real-time gap may be incorrectly identified within the day - not uncommon for the quotes come from gepami, which then, in retrospect filter (filled) DC ..
2. The presence of the gap between the bar and Close Open previous.
  In order to build bezgepovye indicators need to have a source of filtered with a cut gepom quotes for all types of prices.  This auxiliary display KillGap, at 0-m buffer is - "glued" quotations on the requested type of price, and the 1-m - cumulative difference gepov - displacement, ensuring continuity.  Actually, the original still bezgepovoe Close Close , High Plus this shift, High без гэпа = High + смещение и т.д. without Gap = High + offset, etc.
iCustom ( 
string symbol, //  character name tool (NULL-current)
int timeframe, //  time-frame (0 - current)
"KillGap" , //  name of this indicator
//
int GapPoints, //  threshold identification Gap in paras. <0 - without filling a second buffer - offset
int GapHours, //  threshold on the time between adjacent bars
//  0 - in hours
//  <0 - in minutes
int applied_price, // type of prices:
//  0 - PRICE_CLOSE - the closing price
//  1 - PRICE_OPEN - open price
// 2 - PRICE_HIGH - maks.tsena
//  3 - PRICE_LOW - min.tsena
//  4 - PRICE_MEDIAN - the average price, (high + low) / 2
//  5 - PRICE_TYPICAL - typical price, (high + low + close) / 3
//  6 - PRICE_WEIGHTED - Weighted close price, (high + low + close + close) / 4
//  7 - the volume
// 
int mode, //  mode - buffer number indicator:
//  0 - buffer killgap quotes
// 1 - buffer bias - cumulative difference gepov
int shift //  int   shift
  ); ) 
If you throw it on the schedule, the process of "gluing" is seen clearly. (Don't gap closing price):

Suffice it to replace its code address to the price of an array to call this indicator the appropriate price type or add gepovoe offset (1-y buffer) to the original prices, it is better for speed, when the indicator is used several types of prices.
You can also prepare bezgepovye price arrays in advance of its conversion cycle (fragment f-uu start () of the stochastic - there should be just three types of prices and dalneshem features are used with arrays - ArrayMaximum (...)):
void start() { void start () (
//  Border conversion
int limit=Bars-IndicatorCounted()- 1 ; int limit = Bars-IndicatorCounted () - 1;
if (limit> 1 ) limit=Bars- 1 ; if (limit> 1) limit = Bars-1; 
//  Fill arrays killgap price
for ( int i=limit; i>= 0 ; i--) { for (int i = limit; i> = 0; i -) ( 
double base =iCustom(NULL, 0 , "KillGap" ,GapPoints,GapHours, 0 , 1 ,i); //  double base = iCustom (NULL, 0, "KillGap", GapPoints, GapHours, 0, 1, i);  get gepovoe shift
      CloseG[i]=Close[i]+ base ; // positioned Price CloseG [i] = Close [i] + base;  
      HighG[i] =High[i] + base ; //  search for a maximum price HighG [i] = High [i] + base;  
      LowG[i]  =Low[i]  + base ; // price of finding the minimumLowG [i] = Low [i] + base;  
     } ) 
In order to properly display indicators risuyuschihsya in tool window (price), count them on killgap quotes values should be shifted by the value of Gap in the opposite direction (code f-uu start () indicator iMA. Gap):
void start() { void start () (
//  Border conversion
int limit= Bars -IndicatorCounted()- 1 ; int limit = Bars-IndicatorCounted () - 1;
if (limit> 1 ) limit= Bars - 1 ; if (limit> 1) limit = Bars - 1; 
//  Buffer bezgepovymi quotes and displacement
for ( int i=limit; i>= 0 ; i--) { for (int i = limit; i> = 0; i -) (
      price[i]= iCustom ( NULL , 0 , "KillGap" ,GapPoints,GapHours,Price, 0 ,i); //  price [i] = iCustom (NULL, 0, "KillGap", GapPoints, GapHours, Price, 0, i);  quotes
      base[i] = iCustom ( NULL , 0 , "KillGap" ,GapPoints,GapHours,Price, 1 ,i); // смещение base [i] = iCustom (NULL, 0, "KillGap", GapPoints, GapHours, Price, a, i); / / shift
     } )
//  Calculate the indicator of the array price []
for (i=limit; i>= 0 ; i--) Ind[i]=iMAOnArray(price, Bars ,MAperiod,Shift,Method,i) -base[i] ; for (i = limit; i> = 0; i -) Ind [i] = iMAOnArray (price, Bars, MAperiod, Shift, Method, i)-base [i];
  } ) 
You may also implement a code indicator KillGap in reworks indicator in the form of a function, but for speed (check) win not noticed.

In the attached archive contains:
KillGap - light source dont gap quotes and displacement
killgap indicators:
iATR.Gap - the average trading range
iBands Gap - Bollinger Bands
iCCI.Gap - Commodity Channel Index
iEnvelops.Gap - envelope
iMa.Gap - Moving Average
iMomentum.Gap - Momentum
iRSI.Gap - Relative Strength Index
iStdDev.Gap - standard deviation
iSAR.Gap - Parabolic
iStoch.Gap - Stochastics
iStoch.GapNR - Stochastics with noise reduction

All indicators are the same fields as their standard prototypes, except for the added field GapPoints Gap identification threshold in points. Временной гэп во всех случаях жестко установлен в 8 часов. Time gap in all cases rigidly fixed at 8 o'clock.  int If you are interested pofiltrovat gepy within the day, you can do in the code indicator of the global variable int GapHours GapHours внешней, т.е. extern external, ie extern int int GapHours . GapHours.  But this makes little sense - gepy within days then usually filtered dealing centers.

Download killgap forex indicators

1 comment:

Forex Signals said...
This comment has been removed by the author.