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
//+------------------------------------------------------------------+ //| RedrawIndicators-2.mq4 | //| Satori | //| http://www.metaquotes.ru/forum/7790/ | //+------------------------------------------------------------------+ #property copyright "Satori" #property link "http://www.metaquotes.ru/forum/7790/" #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Red #property indicator_color2 Blue #property indicator_color3 Yellow //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; extern int BarsCount=20; //кол-во считаемых баров, если 0 - то все extern string Currency1="EURUSD"; extern string Currency2="GBPUSD"; int handle,handle2; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexLabel(0,Currency1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexLabel(1,Currency2); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,ExtMapBuffer3); handle= FileOpen("TestFile.csv",FILE_CSV|FILE_WRITE,';'); handle2= FileOpen("TestFile2.csv",FILE_CSV|FILE_WRITE,';'); if(handle<1 || handle2<1 ) { Print("Файл не обнаружен, последняя ошибка ", GetLastError()); return(false); } else { FileWrite (handle,"index",Symbol(),"","index1",Currency1,"","index2",Currency2); FileWrite (handle2,"index",Symbol()," ",Currency1," ",Currency2); } return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- FileClose(handle); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int i; double test1,test2; datetime tt1,tt2,TimeMain; BarsCount=MathMin(Bars,(MathMin(iBars(Currency1,Period()),iBars(Currency2,Period())))); for (i=0;i<BarsCount-counted_bars;i++) { TimeMain=Time[i]; ExtMapBuffer1[i]=iTime(Currency1,Period(),iBarShift(Currency1,Period(),TimeMain)); ExtMapBuffer2[i]=iTime(Currency2,Period(),iBarShift(Currency2,Period(),TimeMain)); ExtMapBuffer3[i]=(ExtMapBuffer1[i]-ExtMapBuffer2[i]); tt1=Time[i]-ExtMapBuffer1[i]; tt2=Time[i]-ExtMapBuffer2[i]; if (ExtMapBuffer3[i]!=0 || tt1!=0 || tt2!=0) { if (FileWrite (handle, i,TimeToStr(Time[i]),"",iBarShift(Currency1,Period(),ExtMapBuffer1[i]),TimeToStr(ExtMapBuffer1[i]),"",iBarShift(Currency2,Period(),ExtMapBuffer2[i]),TimeToStr(ExtMapBuffer2[i]) )<=0) Print("нифига не пишет!!"); } FileFlush(handle); if ((iTime(Symbol(),Period(),i)!=iTime(Currency1,Period(),i) || Time[i]!=iTime(Currency1,Period(),i) || iTime(Currency1,Period(),i)!=iTime(Currency2,Period(),i) ) && i>0) { if (FileWrite (handle2,i, TimeToStr(Time[i])," ",TimeToStr(iTime(Currency1,Period(),i))," ",TimeToStr(iTime(Currency2,Period(),i)) )<=0) Print("нифига не пишет!!"); } }//---- return(0); } //+------------------------------------------------------------------+1) time-series appeared to be cached (that is why the chart is displayed)
2) the data centre address (before the terminal was connected to Alpari demo account via data centre)
. So I removed the data centre address and switched to Alpari demo account, the switch was successful, data centre is disconnected. Switched back to the MIG demo account - connection to the server was successful, but the MarketWatch data did not change. Forced to update GBPJPY H4 (on the chart) , history bounced.
But last quote time is still 10-43 on all pairs. I have a build 199.
Now I will try to run Redraw2 indicator
I looked at MarketWatch - it has the same time 10:43 everywhere.
Now I will make the third variant to dot all the dots.
//+------------------------------------------------------------------+ //| RedrawIndicators-2.mq4 | //| Satori | //| http://www.metaquotes.ru/forum/7790/ | //+------------------------------------------------------------------+ #property copyright "Satori" #property link "http://www.metaquotes.ru/forum/7790/" #property indicator_separate_window #property indicator_buffers 3 #property indicator_color1 Red #property indicator_color2 Blue #property indicator_color3 Yellow //---- buffers double ExtMapBuffer1[]; double ExtMapBuffer2[]; double ExtMapBuffer3[]; extern int BarsCount=20; //кол-во считаемых баров, если 0 - то все extern string Currency1="EURUSD"; extern string Currency2="GBPUSD"; int handle,handle2; //+------------------------------------------------------------------+ //| Custom indicator initialization function | //+------------------------------------------------------------------+ int init() { //---- indicators SetIndexStyle(0,DRAW_LINE); SetIndexBuffer(0,ExtMapBuffer1); SetIndexLabel(0,Currency1); SetIndexStyle(1,DRAW_LINE); SetIndexBuffer(1,ExtMapBuffer2); SetIndexLabel(1,Currency2); SetIndexStyle(2,DRAW_LINE); SetIndexBuffer(2,ExtMapBuffer3); handle= FileOpen("TestFile3.csv",FILE_CSV|FILE_WRITE,';'); handle2= FileOpen("TestFile3-2.csv",FILE_CSV|FILE_WRITE,';'); if(handle<1 || handle2<1 ) { Print("Файл не обнаружен, последняя ошибка ", GetLastError()); return(false); } else { FileWrite (handle,"index",Symbol(),"iBarShift1","index1","Time[index1-1]",Currency1,"Time[index1+1]","iBarShift2","index2","Time[index2-1]",Currency2,"Time[index2+1]"); FileWrite (handle2,"index",Symbol()," ",Currency1," ",Currency2); } return(0); } //+------------------------------------------------------------------+ //| Custom indicator deinitialization function | //+------------------------------------------------------------------+ int deinit() { //---- FileClose(handle); //---- return(0); } //+------------------------------------------------------------------+ //| Custom indicator iteration function | //+------------------------------------------------------------------+ int start() { int counted_bars=IndicatorCounted(); int i; double test1,test2; double Bar1,Bar2; int iBarShift1,iBarShift2; datetime tt1,tt2,TimeMain; BarsCount=MathMin(Bars,(MathMin(iBars(Currency1,Period()),iBars(Currency2,Period())))); for (i=0;i<BarsCount-counted_bars;i++) { TimeMain=Time[i]; iBarShift1=iBarShift(Currency1,Period(),TimeMain); iBarShift2=iBarShift(Currency2,Period(),TimeMain); ExtMapBuffer1[i]=iTime(Currency1,Period(),iBarShift1); ExtMapBuffer2[i]=iTime(Currency2,Period(),iBarShift2); ExtMapBuffer3[i]=(ExtMapBuffer1[i]-ExtMapBuffer2[i]); tt1=Time[i]-ExtMapBuffer1[i]; tt2=Time[i]-ExtMapBuffer2[i]; if (ExtMapBuffer3[i]!=0 || tt1!=0 || tt2!=0) { Bar1=iBarShift(Currency1,Period(),ExtMapBuffer1[i]); Bar2=iBarShift(Currency2,Period(),ExtMapBuffer2[i]); if (FileWrite (handle, i,TimeToStr(Time[i]),iBarShift1,Bar1,TimeToStr(iTime(Currency1,Period(),Bar1-1)),TimeToStr(ExtMapBuffer1[i]),TimeToStr(iTime(Currency1,Period(),Bar1+1)),iBarShift1,Bar2,TimeToStr(iTime(Currency2,Period(),Bar2-1)),TimeToStr(ExtMapBuffer2[i]),TimeToStr(iTime(Currency2,Period(),Bar2+1)) )<=0) Print("нифига не пишет!!"); } FileFlush(handle); if ((iTime(Symbol(),Period(),i)!=iTime(Currency1,Period(),i) || Time[i]!=iTime(Currency1,Period(),i) || iTime(Currency1,Period(),i)!=iTime(Currency2,Period(),i) ) && i>0) { if (FileWrite (handle2,i, TimeToStr(Time[i])," ",TimeToStr(iTime(Currency1,Period(),i))," ",TimeToStr(iTime(Currency2,Period(),i)) )<=0) Print("нифига не пишет!!"); } }//---- return(0); } //+------------------------------------------------------------------+