This forum is now read-only. You can discuss you questions on Forums of MQL4.community and MQL5.community

A question for the MQ developers - how to trigger the tick?


Back to topics list  | 1 2
avatar
18
Cubesteak 2006.11.28 10:53 
Hi Slawa,

That does indeed work, thank you kindly. A question though - this only triggers one iteration of the Start() loop. I can have a looped sleep statement in the script, but it isn't optimal as it can miss ticks that way.

Is it possible to call this from an indicator? When I try this, it simply hangs the terminal.

Or, is it possible to use a different configuration of this PostMessageA(hWnd,MT4InternalMsg,2,1); message that would allow it to be added to the period optimizer script so that each time the CHART_CMD_UPDATE_DATA (33324) is called, it will call this new message as well?

Thank you again very much for your help! It is truly appreciated...

Cheers,
CS
avatar
5
SaxMan 2007.01.08 20:26 
Hi Slawa,

I've tried this by doing two different approaches:

1. I've copied the script above and made a script.... applied EA to a 3m chart ..... then drop the script onto it. This produces a response in the journal of loaded.... remove ... with the same time stamp. In the Experts tab it produces the same but with a response from the EA printing 1 occurance of the print function (I programmed a simple print Bid Ask EA to test). The EA after that point is non-active on the 3m chart.

2. I place the script above in the actual EA I programmed instead of using a script which acts one time only. This however produced Nothing, not even a one time occurance of the print function.

Please advise,
I too, wish to Trade with EAs on a 3m chart.

PS. Build 201, MIG Trading
avatar
Moderator
4464
Slawa 2007.01.09 10:29 
SaxMan, You need to make one script from 2. Insert in the period_converter script functionality for EA launch
avatar
5
SaxMan 2007.01.09 19:40 
Hi Slawa,

SaxMan, You need to make one script from 2. Insert in the period_converter script functionality for EA launch


My Basic approach in #2 was:

1. Open 1m chart
2. Attach Period_Converter_Opt to make 3m chart
3. Open offline 3m Chart
4. Attach this EA

//+------------------------------------------------------------------+
//|                                              Print Bid & Ask.mq4 |
//|                                          SaxMan Copyright © 2006 |
//|                                                                  |
//+------------------------------------------------------------------+
#property copyright "SaxMan Copyright © 2006"
#property link      ""
#include <WinUser32.mqh>

//---- input parameters
extern bool      print=true;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
   int MT4InternalMsg = RegisterWindowMessageA("MetaTrader4_Internal_Message");
   int hWnd = WindowHandle(Symbol(),Period());
   PostMessageA(hWnd,MT4InternalMsg,2,1);
   
 //----
 
   if(print)
   Print("Bid: "+Bid+"    Ask: "+Ask);
  
//----
   return(0);
  }
//+------------------------------------------------------------------+



As a result, nothing occured.... this should produce a print every tick.

PS. The winuser32.mqh was updated with

int RegisterWindowMessageA(string lpString);

And the Expert Advisor is active.

End result.... nothing

Hope you can help,
SaxMan

avatar
4
qingyang2005 2009.09.02 22:04 

Hi Slawa,

Could you please show us more information about MetaTrader4_Internal_Message ?

all of the Internel comments ? e.g, How can i get datetime when i press the mouse on the Chat ?

Could you please help me solving this topic : http://www.metatrader4.com/forum/13782

Thanks in advance.

Back to topics list   | 1 2