Design question about many symbol EA - page 3

 

don't forget to add mozzarella and tomato too


 
jjc:

You're not missing anything in terms of performance. This form of multiple-chart arrangement does worry me, however, because an EA can get its own chart handle reliably, but there are many practical issues involved in one chart getting the handle of another chart.

WindowHandle(Symbol(), Period()) is more or less guaranteed to work regardless of what the user does. It even seems to work reliably if there are multiple charts for the same symbol and timeframe. Whereas, on the other hand, retrieving the handle of another chart requires four things to be configured/known correctly:

  • The symbol has to be known, and that's broker-dependent (e.g. EURUSDm vs EURUSD).
  • The time period has to be known. If the user picks a different time frame to the one they're meant to, everything breaks. (This may, of course, be a problem anyway, but many EAs are agnostic about the timeframe they run on.)
  • The chart must already exist. If doing calls in init(), the charts therefore have to be opened in the correct order.
  • If there are multiple charts for the target symbol and timeframe, WindowHandle() becomes unpredictable (which, as above, doesn't seem to be true of a chart getting its own hWnd).

I'm not saying that that your suggestion #2 won't work in any sense - and I didn't give it enough attention first time round. But it would worry me in terms of the scope for user error.

I haven't actually considered the details... I was talking conceptually. But most of the problems you suggested might be solvable (I haven't given it enough thought either).

Anyway, I just now understood your idea - to call start() from within itself in the same EA (the first time I read it I thought u meant to call it from another EA...). Yeah, I see now how that would hog the CPU.


Edit: after further thinking about it, I doubt my number 2 idea can be done reliably... The margin for user error is too big.

 
fbj:

2. In the middle of the night [sods law/typically] when server connection lost and EA sees "!IsConnected()".
Do you just hang about [like if EA not enabled], waiting for reconnect?

When you are disconnected, there is NOTHING you can do. Just return, when it reconnects you'll get a new tick and a call to start()

If you're not getting many ticks it is because nothing is changing, there is NOTHING to do. just return and wait for start()

If you're getting a lot in internet failures - VPS.

If you're getting a lot of long disconnects it's your broker's fault - switch to a different broker.

The only time I see disconnects from IBFX is during the weekend and most of them last about a minute. The few others I see is related to non-redundant ISP in the lightning capital of the world (Florida.)

Reason: