<!DOCTYPE html>
<html>
<!-- This file is automatically generated: do not edit. -->
<head>
<title>Scripts</title>
<meta charset="utf-8">
</head>
<body>
<!-- <h1>Scripts</h1> -->
<p>There are 2 scripts in the <tt>bin</tt> directory that can send or receive information<br />
from a MetaTrader running the experts<br />
OTZmqCmdEA.mq4 or OTPyZmqCmdEA.mq4.</p>

<p>These are Python scripts that require you have <a href="PyZmq.html">PyZmq</a> installed.</p>

<h3>OTZmqSubscribe.py</h3>

<p><tt>Usage: OTZmqSubscribe.py [options] [topics...]</tt></p>

<p>Collect ticks from OTMql4Zmq</p>

<p>Arguments on the command line are the list of Topics to subscribe to on a listener at<br />
the same time. By default everything ('') is subscribed to, but you could add<br />
one or more of <tt>timer, tick, retval, bar</tt>  to the command line to see only<br />
those topics.</p>

<p>MAYBE: do NOT run this until the expert has been loaded onto a chart.<br />
It may (but shouldn't) prevent the expert from binding to the ports.<br />
Also be sure to not keave it running between restarting Metatrader.</p>

<h3>OTZmqPublish.py</h3>

<p><tt>Usage: OTZmqPublish.py [options] [topics...]</tt></p>

<p>Publish request commands to OTMql4Zmq. Give options on the commnd line,<br />
and then it will enter a loop reading from the standard input to take<br />
commands to send to an PyZmq enabled Mt4 (or anything else).</p>

<p>Arguments on the command line are the list of Topics to subscribe to on a listener at<br />
the same time. By default everything ('') is subscribed to, but you could add<br />
timer to the command line to see only timer topics come back.</p>

<p>The script subscribes on the subscribe port and then sends requests to the requests<br />
port. In both cases, the Mt4 binds the sockets, and this script connects.<br />
The commands on stdin are sent to the Zmq enabled Mt4.</p>

<p>There are 2 types of requests that we can send:</p>
<ul>
	<li>exec - the request is sent, and a reply is waited for on the requests port (REQ/REP)</li>
	<li>cmd  - the request is sent, and a reply is waited for on the subscibe port,           where the reply is by put in the return subscription as a 'retval' topic.</li>
</ul>
<p>The theory is that exec commands should be quick and not block the tick, and<br />
the cmd requests are for longer running commands. In practice this isn't<br />
implemented like that in the EA, and instead the following is true: use</p>
<ul>
	<li>exec - use exec for sending to the OTZmqCmdEA.mq4 (-e exec)</li>
	<li>cmd - use cmd for sending to the OTPyZmqCmdEA.mq4 (-e cmd)Use the command line argument -e or --exectype.</li>
</ul>
<p>In fact even that is not true - this only works with OTZmqCmdEA.mq4 at the moment!</p>

<p>We'll straighten this out later.</p>

<p>See also: <a href="CodeScripts.html">CodeScripts</a></p>

<hr />

<p>Parent: <a href="Home.html">Home</a></p></body>
</html>
