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

 

Hey there endy5,

I've finish my EA that moves several charts simultaneously at the same time, - it's still BETA coz some chart still jumpy and I think I'd like to keep it a secret for a while. :D.

Beside using iBarShift, I also using PostMessageA - 33197 which move arrow down/right and 33198 which moves arrow up/left. You can get them here https://www.mql5.com/en/forum/124688. So I'm not even using using WM_COMMAND like you do (thought I probably will try that too), and I will not use that Virtual Key VK - coz AFAIK that require chart to be activated.

You also using SendMessageA instead using PostMessageA. There's differences between them, SendMessage will wait for message to be processed, while PostMessage will not wait. So when using SendMessage, we actually force MT to wait.

WHRoeder is correct there on point 1, 2. MT takes time to download history. And if we refresh chart too many time in very short period of time, the processor usage will be very high. I know that, coz I've done that before - no fun :(

I will talk about the EA when it's no longer secret ;).

Once again, thank you very much.

:D.

 
onewithzachy:

Hey there endy5,

I've finish my EA that moves several charts simultaneously at the same time, - it's still BETA coz some chart still jumpy and I think I'd like to keep it a secret for a while. :D.

Beside using iBarShift, I also using PostMessageA - 33197 which move arrow down/right and 33198 which moves arrow up/left.

Would it be better to use PgUp and PgDown when the chart needs to be move a long way . . and then switch to Arrow up and down to fine tune the position ?
 
RaptorUK:
Would it be better to use PgUp and PgDown when the chart needs to be move a long way . . and then switch to Arrow up and down to fine tune the position ?

Ah ... I didn't know that we can use PgUp/PgDown in MT4, and I see that endy5 also using that. Well, I have to check, if that doesn't require windows to be an active windows - I think it doesn't have an active one -, then we can use it.

Thanks again, for the idea.

:D

 
Yes thats a great idea, lining up charts of different timeframe is very time consuming, I've always thought the ability to automate that procedure should be a standard part of any trading platform. I think I'll have a go at this too.
 

Hi, thank you onewithzachy,

I tried replace SendMessageA for PostMessageA and I think that problem with WindowFirstVisibleBar is resolved. I will be more testing my code. Thank you again.

Next task for me is implementation fake(false) tick to my code. Source https://www.mql5.com/en/forum/128803/page2#373538

I tried tick.mq4 (from post 14:56) as script - it works very well. When I tried source as EA (from post time 14:51 and 15:05) - nothing, no function... I would like wrote my code as EA (because fake tick don´t work as indicator). Why don´t function fake tick as EA? Can you help me? Thank you.

 
endy5:

Hi, thank you onewithzachy,

I tried replace SendMessageA for PostMessageA and I think that problem with WindowFirstVisibleBar is resolved. I will be more testing my code. Thank you again.

Next task for me is implementation fake(false) tick to my code. Source https://www.mql5.com/en/forum/128803/page2#373538

I tried tick.mq4 (from post 14:56) as script - it works very well. When I tried source as EA (from post time 14:51 and 15:05) - nothing, no function... I would like wrote my code as EA (because fake tick don´t work as indicator). Why don´t function fake tick as EA? Can you help me? Thank you.

Whoa, not really sure what you want with fake tick.

In some of my EA/script, I just call start() from init(), and it run this whole weekend, without the need of tick. I've never tried fake tick before, however this code below may gives you some ideas.

I notice you still using WinAPI command, please read this, it may gives you some ideas : #define's for known command that can be used for PostMessageA()

int init()
  {
  
  start (); // call start from init() ;)
  return (0);
  }

int start()
  {
  
  while (!IsStopped())
    {
    // code goes here :D
    Sleep (1000); // must have any value >= 100
    }
  
  return(0);
  }
 

onewithzachy:
I just call start() from init(), ...

Read the fake tick post. You can NOT call start from init

NO! This is not allowed. init() is expected to return after 2 seconds. Init is not allowed to block! All kinds of problems might (and will) arise from that.

The chart does not yet exist. No history, no bars.

NevTon:
Documentation claims "Returns the system window handler containing the given chart. If the chart of symbol and timeframe has not been opened by the moment of function calling, 0 will be returned."
 
WHRoeder 2012.05.27 15:25

onewithzachy:
I just call start() from init(), ...

Read the fake tick post. You can NOT call start from init

NO! This is not allowed. init() is expected to return after 2 seconds. Init is not allowed to block! All kinds of problems might (and will) arise from that.

The chart does not yet exist. No history, no bars.

NevTon:
Documentation claims "Returns the system window handler containing the given chart. If the chart of symbol and timeframe has not been opened by the moment of function calling, 0 will be returned."

1. The fake tick was posted in 2010 for MT build ???, and now 2012 MT is build 416 - 427, so far all my ea and all my MT has no problems, why don't you try and check that before posting something that based on 2010 posting.

If you wanna some tick executable https://www.mql5.com/en/forum/124688/page2#638423.

2. Your reply to NevTon should be posted at New Version of MetaTrader 4 Client Terminal build 427. BTW, NevTon asked about Window Handle, which got nothing to do with history or bars or whatever.

:D

 

Thank you ALL !

Still one question...

I have some small problem with using key F12 (shift graph) and function WindowFirstVisibleBar(). I wrote my code as indicator, and virtual key F12 is function with only PostMessagesA() (SendMessage() no) but no change value WindowFirstVisibleBar(), return the same value - before press virtual F12. What do I do it?

 
endy5:

Thank you ALL !

Still one question...

I have some small problem with using key F12 (shift graph) and function WindowFirstVisibleBar(). I wrote my code as indicator, and virtual key F12 is function with only PostMessagesA() (SendMessage() no) but no change value WindowFirstVisibleBar(), return the same value - before press virtual F12. What do I do it?

Hi there endy5,

Why F12 ? I use ...

PostMessageA(handle, WM_COMMAND, 33198, 0);

Which I find in #define's for known command that can be used for PostMessageA() in a loop with sleep in an EA not CI

Reason: