//+-----------+ //| Spread | //+-----------+ #property copyright "Copyright 2005 Ron Thompson" #property link "http://www.forexmt4.com/" //---- indicator settings #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Yellow #property indicator_color2 Green #property indicator_color3 Aqua //---- buffers double ExtMapBuffer1[]; //Yellow double ExtMapBuffer2[]; //Green double ExtMapBuffer3[]; //Aqua //specific to indicator double spread; double spreadtot; int spreadticks; double maxspread; double minspread; // bar open handling int bartime; // Point handling double myPoint; // support for 3/5 decimal places //+-----------+ //| Init | //+-----------+ int init() { // 233 up arrow // 234 down arrow // 158 little dot // 159 big dot // 168 open square // 120 box with X SetIndexBuffer(0,ExtMapBuffer1); //Yellow SetIndexStyle(0, DRAW_LINE, STYLE_SOLID, 2); SetIndexBuffer(1,ExtMapBuffer2); //Green SetIndexStyle(1, DRAW_LINE, STYLE_SOLID, 2); SetIndexBuffer(2,ExtMapBuffer3); //Aqua SetIndexStyle(2, DRAW_LINE, STYLE_SOLID, 2); myPoint=SetPoint(); Print("Init complete"); } //+-----------+ //| DE-Init | //+-----------+ int deinit() { Print("DE-Init complete"); } //+-----------+ //| Each Tick | //+-----------+ int start() { int pos; // draw once at open of bar if(bartime!=Time[0]) { bartime=Time[0]; spreadtot=0; spreadticks=0; maxspread=0; minspread=99; ExtMapBuffer1[0]=0; ExtMapBuffer2[0]=0; ExtMapBuffer3[0]=0; } // multiply 5 digit brokers by 10 since the chart windows won't // scale to 5 digit prices if(myPoint==Point) { spread=(Ask-Bid); } else { spread=(Ask-Bid)*10; } if(spread>maxspread) maxspread=spread; if(spread0) { FileSeek(myhandle,0,SEEK_END); FileWrite(myhandle, mydata+" "+gregorian); FileClose(myhandle); } }