Keep EA alive in terminal..

 

I started testing EA on Live Demo account. I noticed that EA cycles throe code every time new tick is coming in.

I need to keep EA..so to say alive and execute ordersend etc. when some EA condition is true. Closest that I have found so far is one script that is generating artificial tick (..as I understand it). This script can even generate a tick when market is closed. It is too advanced for me and I have trouble integrating this into my EA.

Is there a simpler way to keep EA live in terminal.

 

Here is a sample form script "Jumpstart"..

//+------------------------------------------------------------------+
//|   JumpStart.mq4
//+------------------------------------------------------------------+
#include <stdlib.mqh>
#include <WinUser32.mqh>
#import "user32.dll"
        int RegisterWindowMessageA(string lpString); 
#import
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   int MT4InternalMsg = RegisterWindowMessageA("MetaTrader4_Internal_Message");
   int hWnd = WindowHandle(Symbol(),Period());
   PostMessageA(hWnd,MT4InternalMsg,2,1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
elanin:

I started testing EA on Live Demo account. I noticed that EA cycles throe code every time new tick is coming in.

I need to keep EA..so to say alive and execute ordersend etc. when some EA condition is true.

Forget about artificial ticks.

It is alive. Start() gets called every tick. If the conditions aren't ready, return from start() and retest on the next tick.

 
WHRoeder:

Forget about artificial ticks.

It is alive. Start() gets called every tick. If the conditions aren't ready, return from start() and retest on the next tick.


You are right..can be that I was not clear about my problem.

If EA is made to sets up sort of net from pending trades to be ready for price move. In tester it is no problem as price is moving fast and Start() is called often enough.

On live account (demo forward test) EA must wait for tick and with every tick it sends one pending order. Having artificial tick will make EA set up pending orders much faster (e.g if enter before news, larger number of pending orders and few ticks are coming in).

 

I was able to integrate this script at last. I didn't clocked time difference, but with artificial ticks, EA response is much faster.

 

Got it working. Just removed..

//#import

.. and copy pasted rest to EA as-is. 

//+------------------------------------------------------------------+
//|   JumpStart.mq4
//+------------------------------------------------------------------+
#include <stdlib.mqh>
#include <WinUser32.mqh>
#import "user32.dll"
        int RegisterWindowMessageA(string lpString); 
//#import
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   int MT4InternalMsg = RegisterWindowMessageA("MetaTrader4_Internal_Message");
   int hWnd = WindowHandle(Symbol(),Period());
   PostMessageA(hWnd,MT4InternalMsg,2,1);
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
elanin: EA must wait for tick and with every tick it sends one pending order. Having artificial tick will make EA set up pending orders much faster
Why do you only set one pending. Opening more than one will "make EA set up pending orders much faster" as in done already.
Reason: