Update EA each mili-second not each tick?
4 replies
JS17
6 years ago #202369
Hi all,
How do I get an EA to run each mili-second and not only when the EA gets a tick??
Regards
John
Karish
6 years ago #202381
1st option is: http://www.forexmt4.com/Windows%20programs/MSFX-MT4TickSender-Setup.exe
2nd option is:
create a script file put the following code inside & compile
it send sa fake tick every 100 ms to the chart and all its indicators and EA until this script be removed..
#import “user32.dll”
int PostMessageA(int hWnd,int Msg,int wParam,int lParam);
int RegisterWindowMessageA(string lpString);
#importint start(){
int hwnd=WindowHandle(Symbol(), Period());
int msg = RegisterWindowMessageA(“MetaTrader4_Internal_Message”);
while(!IsStopped()){
PostMessageA(hwnd, msg, 2, 1);
Sleep(100); //1000=1sec..
}
}
good luck
JS17
6 years ago #202404
Karish
Thanks for the reply
Is it not possible to do it inside EA Wizard using some sort of timer function?
Regards
John
Karish
6 years ago #202412
The best option for you is to make a separate MT4 and make a default TEMPLATE with that script already inside it,
so that you wont need to always drag & drop this script to the chart after you dropped the EA inside that chart.
just open a random chart > Templates > Save Template > save it as Default > Replace that new Template with the Older “Default” Template.
Its better not to touch the Wiz’s source code for this…, not worth it.
You would want to modify the already existing script with this code in order to see that the script is already attached on the chart when you plan to make a default template with it,
#import “user32.dll”
int PostMessageA(int hWnd,int Msg,int wParam,int lParam);
int RegisterWindowMessageA(string lpString);
#importint start(){
Text(“#Fake Ticker Script is attached.”,”fake_tick_obj”,7,”Arial Bold”,2,3,2,White);
int hwnd=WindowHandle(Symbol(), Period());
int msg = RegisterWindowMessageA(“MetaTrader4_Internal_Message”);
while(!IsStopped()){
PostMessageA(hwnd, msg, 2, 1);
Sleep(100); //1000=1sec..
}
}void Text(string text,string identity,int textsize,string textfont,int x,int y,int z,color c)
{
ObjectDelete(identity);
ObjectCreate(identity,OBJ_LABEL,0,0,0);
ObjectSet(identity,OBJPROP_XDISTANCE,x);
ObjectSet(identity,OBJPROP_YDISTANCE,y);
ObjectSet(identity,OBJPROP_CORNER,z);
ObjectSetText(identity,text,textsize,textfont,c);
}int deinit() {
ObjectDelete(“fake_tick_obj”);
return(0);
}
this will show you a msg at the bottom left corner of the chart that the script is running, so that you know..,
good luck with what you trying to do 🙂
JS17
6 years ago #202464
Viewing 4 replies - 1 through 4 (of 4 total)