Work with WindowFirstVisibleBar, WindowBarsPerChart - automaticaly move graph - please help me - page 3

 

hmmm... I would like using virtual F12 in indicator because I need accurate/fine step bar by bar. Shift left/up or shift right/down doing step more than one bar.

In script F12 working good, but indicator? :-(

 
endy5:

hmmm... I would like using virtual F12 in indicator because I need accurate/fine step bar by bar. Shift left/up or shift right/down doing step more than one bar.

In script F12 working good, but indicator? :-(

Dear endy5.

CI need a tick, try EA and try my previous reply coz I have no problem moving bar, one by one to the left or to the right.

 

Hi friend onewithzachy,

ok, I can do from indicator -> EA, it is no problem. BUT - problem will be run this EA when market will be close. I done easy EA, disconnect net, add to graph,and EA no running. My PC with Vista, build 427 MT4

I tried add script ticks.mq4 from https://www.mql5.com/en/forum/128803/page2#373538 (post 14:56) - I thought that script activate EA - result: script running ok, EA is death.

I wrote on page 2 about it this thread. I don´t know, that your EA is running... My experience (!!!) when do you have connect MT to server, net, open graph, add EA... EA running, ok, clearly. Disconnect net - EA running ok. BUT it isn´t my case - I need running EA without connect to server/net. This is my problem with change indicator to EA. If you have function some code EA, can you insert here? I try run its on MT platform with disconnect net. Thank you very mutch your help me.

 
endy5:

Hi friend onewithzachy,

ok, I can do from indicator -> EA, it is no problem. BUT - problem will be run this EA when market will be close. I done easy EA, disconnect net, add to graph,and EA no running. My PC with Vista, build 427 MT4

I tried add script ticks.mq4 from https://www.mql5.com/en/forum/128803/page2#373538 (post 14:56) - I thought that script activate EA - result: script running ok, EA is death.

I wrote on page 2 about it this thread. I don´t know, that your EA is running... My experience (!!!) when do you have connect MT to server, net, open graph, add EA... EA running, ok, clearly. Disconnect net - EA running ok. BUT it isn´t my case - I need running EA without connect to server/net. This is my problem with change indicator to EA. If you have function some code EA, can you insert here? I try run its on MT platform with disconnect net. Thank you very mutch your help me.

Hi endy5,

1. I said earlier that I've never try fake tick before and I'm not gonna try it, not even now. I just finish read the fake tick post, it was written in year 2010 for MT build lower than now, and if you read carefully there, 7bit suggest that you must have internet connection first before using it (https://www.mql5.com/en/forum/128803/page2#373545) . Please re-read again that fake tick post again, and you must have connection first. And I never suggest using fake tick either, it was WHRoeder who suggest it.

2. I already gave all my answers in page 2 which obviously you're not paying any attention to them. So here's my EA which you actually must pay $$$ for it. Get internet connection first, attach the EA (there's no need to enable EA button), then disconnect the internet connection. The EA will shift chart to the left every 500 ms, and read all the expert print tab.

#include <WinUser32.mqh>
#define WM_COMMAND                0x0111
#define MT4_WMCMD_MOVE_RIGHT      33197 /* Move right (right/down arrow) */
#define MT4_WMCMD_MOVE_LEFT       33198 /* Move left (left/up arrow) */

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
  /*
  There's some that said init() must not be blocked.
  Well ... I want to click YES OK, and NO later on the day 
  :D
  */
  
   int msg;
   msg = MessageBox ("Are you sure to call start from init ?","Click Yes", 
         MB_YESNO| MB_ICONINFORMATION);
         
   if (msg == IDYES) start (); // call a start from init.
   
   msg = MessageBox ("We are NOT call start from init !","OKAY", 
         MB_OK| MB_ICONINFORMATION);
         
   if (!IsExpertEnabled())
   msg = MessageBox ("You have to enable Expert !","Turn Expert On", 
         MB_OK| MB_ICONINFORMATION);
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit(){return(0);}
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
  int handle;
   while (!IsStopped())
     {
     handle = WindowHandle(Symbol(),Period());
     PostMessageA(handle, WM_COMMAND, MT4_WMCMD_MOVE_LEFT, 0);
     Print (TimeSeconds (TimeLocal())," ",Symbol()," TF ",Period()," first bar ",WindowFirstVisibleBar());
     Sleep (500);
     }
   return(0);
  }
//+------------------------------------------------------------------+
 
Thank you, onewithzachy! I helped me very mutch.
 
endy5:
Thank you, onewithzachy! I helped me very mutch.
I wish you good luck endy5 ! :D
 
int WindowLastVisibleBar(){
   int tmpnum = WindowFirstVisibleBar() - WindowBarsPerChart();
   int ret=tmpnum;
   if(tmpnum < 0){ ret=0; }
   return(ret);
}

 this is what I use to get the bar your looking for since WindowFirstVisibleBar() returns the first visible bar from left of the screen. this function will return just the opposite independent of bar shift of course.