#property copyright "Copyright © 2011, Christian Payne" #property link "http://christianpayne.com.au" #property indicator_chart_window #property indicator_buffers 1 #property indicator_color1 Red //---- input parameters //---- buffers double InsideBar[]; static datetime alert.allowed; string msg; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicator buffers mapping SetIndexBuffer(0,InsideBar); //---- drawing settings SetIndexStyle(0,DRAW_ARROW); SetIndexArrow(0,252); //---- SetIndexEmptyValue(0,0.0); //---- name for DataWindow SetIndexLabel(0,"Inside Bar"); //---- initialization done return(0); } int deinit() { //---- ObjectsDeleteAll(); int err = 0; err=GetLastError(); if (err != 0) { // Alert(Symbol() + " error ib1: (",err,")"); } return(0); } int start() { int i,nCountedBars; // http://docs.mql4.com/customind/IndicatorCounted nCountedBars = IndicatorCounted(); //---- last counted bar will be recounted if(nCountedBars<=2) i=Bars-nCountedBars-3; if(nCountedBars>2) { nCountedBars--; i=Bars-nCountedBars-1; } int j = 0; while(i>=1) { if (Low[i + 1] < Low[i] && High[i + 1] > High[i]) { InsideBar[i] = High[i] + (50 * Point); } else if (Low[i + 2] < Low[i] && High[i + 2] > High[i] && Low[i + 2] < Low[i+1] && High[i + 2] > High[i+1]) { InsideBar[i] = High[i] + (50 * Point); } else { InsideBar[i] = 0; } i --; } if (Low[2] < Low[1] && High[2] > High[1] && CurTime() >= alert.allowed) { alert.allowed = CurTime() + 10 *60; // No more alerts for 10 minutes. Change the '10' to suite msg = "Inside bar Trigger - " + Symbol() + " " + TimeToStr(CurTime(), TIME_DATE) + ":" + TimeToStr(CurTime(), TIME_SECONDS); //SendMail("Inside bar Trigger - " + Symbol(), msg); Alert(msg); } return(0); }