You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Because after gap some indicators behavior is not usable for EA decision, I use simple code to avoid EA trading after GAP. At params section of EA add:
extern int MinGapSize = 3;
extern int BackGapBars = 10;
.... add check of Gap before decision of trading
if (NotGap()) {
if (Trend>0) Buy=true;
if (Trend<0) Sell=true;
}
........ and this is fuction to check GAP bigger than MinGapSize inside last BackBGapBars:
bool NotGap() // check if there is not a gap at current position or BackGapBars back
{ bool result=true;
double GapPrice1=High[0];
double GapPrice2=Open[0];
double GapPoint = MarketInfo(Symbol(), MODE_POINT);
int GapSpread = MarketInfo(Symbol(), MODE_SPREAD);
for (int ii=0;ii<=BackGapBars;ii++)
{ if(Open > High + (MinGapSize + GapSpread)*GapPoint)
{ result=false; GapPrice1=High; GapPrice2=Open;}
if(Open < Low - (MinGapSize + GapSpread)*GapPoint)
{ result=false; GapPrice1=Low; GapPrice2=Open;}
}
if (!result)
{ string Suffix=TimeToStr(Time[0]);
if (ObjectFind("GAP"+Suffix)==-1)
{ ObjectCreate("GAP"+Suffix, OBJ_RECTANGLE, 0, Time[0], GapPrice1, Time[1], GapPrice2);
ObjectSet("GAP"+Suffix,OBJPROP_COLOR,SteelBlue);
}
}
return(result);
}
thats all. See the picture for bad behavior of indicators after gap .. oooh, I have not enough credits for uploading anything, so try it yourself