//+------------+ //| TickTime | //+------------+ #property copyright "Copyright 2008 Ron Thompson" #property link "http://www.forexmt4.com/" /* This indicator shows ticks over time */ //---- indicator settings #property indicator_chart_window #property indicator_buffers 2 #property indicator_color1 Green #property indicator_width1 3 #property indicator_color2 Red #property indicator_width2 3 extern int TicksToConsider = 100; extern double PercentOneWay = 66.0; //---- buffers //double BG[]; //Green //double BR[]; //Red double TickCurr; double TickPrev; double tickup; double tickdn; double tu[100000]; double td[100000]; int ptr=-1; // objects int uniq=0; //+-----------+ //| Init | //+-----------+ int init() { // delete all of my objects //for(int i=0; i<=65535; i++) // { // ObjectDelete("mytt2"+DoubleToStr(i,0)); // } uniq=0; if(IsTesting())ObjectsDeleteAll(); // 233 up arrow // 234 down arrow // 158 little dot // 159 big dot // 168 open square // 120 box with X //SetIndexBuffer(0,BG); //Green //SetIndexStyle(0, DRAW_ARROW); //SetIndexArrow(0,120); //SetIndexBuffer(1,BR); //Red //SetIndexStyle(1, DRAW_ARROW); //SetIndexArrow(1,120); Print("Init complete"); } //+-----------+ //| DE-Init | //+-----------+ int deinit() { // delete all of my objects //for(int i=0; i<=65535; i++) // { // ObjectDelete("mytt2"+DoubleToStr(i,0)); // } uniq=0; if(IsTesting())ObjectsDeleteAll(); Print("DE-Init complete"); } //+-----------+ //| Each Tick | //+-----------+ int start() { int i; string x; double pctu; double pctd; TickPrev=TickCurr; TickCurr=Close[0]; ptr++; if(ptr>99999) { ptr=0; for(i=0; i<=100000; i++) { tu[i]=0; td[i]=0; } } x="XX"; if(TickCurr>TickPrev) { tu[ptr]=1; x="UP"; } if(TickCurr<TickPrev) { td[ptr]=1; x="DN"; } tickup=0; tickdn=0; for(i=ptr; i>(ptr-TicksToConsider); i--) { if(tu[i]>0) tickup++; if(td[i]>0) tickdn++; } pctu=(tickup/TicksToConsider)*100; if( pctu >= PercentOneWay ) { //BG[0]=Close[0]; ObjectCreate("mytt2"+DoubleToStr(uniq,0), OBJ_TEXT, 0, Time[0], Close[0]); ObjectSetText("mytt2"+DoubleToStr(uniq,0),"x",15,"Arial",LimeGreen); uniq++; } pctd=(tickdn/TicksToConsider)*100; if( pctd >= PercentOneWay ) { //BR[0]=Close[0]; ObjectCreate("mytt2"+DoubleToStr(uniq,0), OBJ_TEXT, 0, Time[0], Close[0]); ObjectSetText("mytt2"+DoubleToStr(uniq,0),"x",15,"Arial",Red); uniq++; } //Comment("101 ptr="+ptr+" tu="+tickup+" pct="+pctu+" td="+tickdn+" pct="+pctd+" "+x); Comment("ptr="+ptr+" pct="+pctu+" pct="+pctd); }//start
Sample
Analysis
Market Information Used:
Series array that contains close prices for each bar
Series array that contains open time of each bar
Indicator Curves created:
Indicators Used:
Custom Indicators Used:
Order Management characteristics:
Other Features: