quick question about offline charts....can you attach an EA on a offline chart?
thanx
thanx
Indicators can't attach to a chart 34 replies
Attach Indicator to Chart using EA 43 replies
In mt4 can you run strategy tester for an EA on a custom offline chart? 4 replies
How to Attach an EA to a Chart 20 replies
How to attach an indicator to MT4 chart 6 replies
DislikedIf the offline chart is receiving updates (ie, ticks) via some other process (script, EA, indicator), then yes, an EA can be attached and can behave as if it was on a regular online chart.
This is very common with non-standard Time period, Range Bar, Renko, Volume, Tick, Index, and Basket charts - which all use offline charts.
Just slap the EA on the applicable offline chart and, as long as the offline chart is being fed new ticks, your EA should behave as if it was on a regular online chart.Ignored
DislikedNow I can attach an EA to my offline chart (it's a simple tick chart), but the EA does nothing since it's not really getting new ticks (i.e. the Start function in the EA never runs), the data is just being posted there by the data logged from a live chart.Ignored
//+------------------------------------------------------------------+ //| hsUpdateChartWindow | //+------------------------------------------------------------------+ void hsUpdateChartWindow( string strSymbol, int intTF ) { int intWindow = WindowHandle( strSymbol, intTF ); static int intMT4MsgID = 0; if( intWindow > 0 ) { // Send update (refresh) command to offline chart PostMessageA( intWindow, WM_COMMAND, 33324, 0 ); // Send simulated tick to offline chart if ( intMT4MsgID == 0 ) intMT4MsgID = RegisterWindowMessageA("MetaTrader4_Internal_Message"); PostMessageA( intWindow, intMT4MsgID, 2, 1 ); } }
DislikedYou need to "notify" the offline chart of an incoming tick. In your offline chart generator, do something like this after you update the bar data each time:
[code]//+------------------------------------------------------------------+
//| hsUpdateChartWindow |
//+------------------------------------------------------------------+
void hsUpdateChartWindow( string strSymbol, int intTF )
{
int intWindow = WindowHandle( strSymbol, intTF );
static int intMT4MsgID = 0;
if( intWindow > 0 )...Ignored