Professional Documents
Culture Documents
//| Gimmebar.mq4 |
//| See Joe Ross Trading Manual on Gimme-Bars (e.g. from the |
//| library on www.trading-naked.com)
//|Bolllitouch - yet another perky mod |
//+------------------------------------------------------------------+
#property copyright "by Shimodax, 2005"
#property link "http://www.strategybuilder.com"
//+------------------------------------------------------------------+
//| |
//+------------------------------------------------------------------+
int init()
{
//---- 2 additional buffers are used for counting.
IndicatorDigits(MarketInfo(Symbol(),MODE_DIGITS)+2);
// two bollies
SetIndexBuffer(0,BufferBand1);
SetIndexStyle(0,DRAW_LINE);
SetIndexDrawBegin(0,BobaPeriod);
SetIndexBuffer(1,BufferBand2);
SetIndexStyle(1,DRAW_LINE);
SetIndexDrawBegin(1,BobaPeriod);
SetIndexBuffer(3,BufferBuy);
SetIndexStyle(3,DRAW_ARROW);
SetIndexDrawBegin(3,BobaPeriod);
SetIndexArrow(3, 167);
SetIndexEmptyValue(3, 0);
SetIndexBuffer(5,BufferBuyEntry);
SetIndexStyle(5,DRAW_ARROW);
SetIndexDrawBegin(5,BobaPeriod);
SetIndexArrow(5, 236);
SetIndexEmptyValue(5, 0);
//+------------------------------------------------------------------+
//| Custom indicator iteration function |
//+------------------------------------------------------------------+
int start()
{
int counted_bars= IndicatorCounted(),
lastbar;
if (counted_bars>0)
counted_bars--;
return (0);
}
//+------------------------------------------------------------------+
//| Mark Gimmee-Bars and mark possible entries for deals |
//+------------------------------------------------------------------+
double GimmeeBar(int offset, int lastbar, double &sellbuf[], double &buybuf[],
double &sellbuf2[], double &buybuf2[],
double &band1buf[], double&band2buf[], int period, int deviation)
{
double band1, band2;
int markerdist= 5; // distance between bars and marker dots
sellbuf[i]= 0;
buybuf[i]=0;
sellbuf2[i]= 0;
buybuf2[i]=0;
band1buf[i]= band1;
band2buf[i]= band2;
if (High[i]>=band1) {
sellbuf[i]= High[i] + markerdist*Point;
if (i < 2 )
{
UD="m Down";
DoAlert(UD);
}
}
if (Low[i]<=band2) {
buybuf[i]= Low[i] - markerdist*Point;
if (i < 2 )
{
UD="m Up.";
DoAlert(UD);
}
/*
if (DebugLogger)
Print(TimeOffset(offset), "BG-GimmeBar ", "");
*/
return (0);
}
//+------------------------------------------------------------------+
void DoAlert(string UD)
{
if (!NewBar() || !Use_Sound)
return;
if(Alert_ON==true)Alert("Alert ! Line Touched "+Symbol()+" M"+Period()+" @
"+DoubleToStr(Bid,Digits)+"");
PlaySound ("Alert2");
}
bool NewBar()
{
static datetime dt = 0;
if (dt != Time[0])
{
dt = Time[0];
return(true);
}
}