MetaTraderPy
Artifact Content
Not logged in

Artifact e94ac3604cfc1327037901668501f7d5f792a9ca:

Wiki page [API] by polymeris 2012-10-03 19:28:54.
D 2012-10-03T19:28:54.418
L API
P 6c478954b2038d7171ccafaf10902b014248160b
U polymeris
W 12200
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ee77aa">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Classes</strong></big></font></td></tr>
   </table>

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Account">class <strong>Account</strong></a></font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Information&nbsp;about&nbsp;the&nbsp;currently&nbsp;active&nbsp;account.<br>&nbsp;</tt></td></tr>

<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Account-balance"><strong>balance</strong></a>(self)</dt><dd><tt><a href="#Account">Account</a>'s&nbsp;current&nbsp;amount&nbsp;of&nbsp;money&nbsp;in&nbsp;the&nbsp;account.</tt></dd></dl>

<dl><dt><a name="Account-credit"><strong>credit</strong></a>(self)</dt><dd><tt><a href="#Account">Account</a>'s&nbsp;credit&nbsp;value.</tt></dd></dl>

<dl><dt><a name="Account-currency"><strong>currency</strong></a>(self)</dt><dd><tt><a href="#Account">Account</a>'s&nbsp;currency&nbsp;name.</tt></dd></dl>

<dl><dt><a name="Account-equity"><strong>equity</strong></a>(self)</dt><dd><tt><a href="#Account">Account</a>'s&nbsp;equity&nbsp;value.&nbsp;This&nbsp;depends&nbsp;on&nbsp;trading&nbsp;server<br>

settings.</tt></dd></dl>

<dl><dt><a name="Account-freeMargin"><strong>freeMargin</strong></a>(self)</dt><dd><tt><a href="#Account">Account</a>'s&nbsp;free&nbsp;margin&nbsp;value.</tt></dd></dl>

<dl><dt><a name="Account-isDemo"><strong>isDemo</strong></a>(self)</dt><dd><tt>Returns&nbsp;true&nbsp;if&nbsp;this&nbsp;is&nbsp;a&nbsp;demo&nbsp;account.</tt></dd></dl>

<dl><dt><a name="Account-leverage"><strong>leverage</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;current&nbsp;leverage&nbsp;of&nbsp;this&nbsp;account.</tt></dd></dl>

<dl><dt><a name="Account-margin"><strong>margin</strong></a>(self)</dt><dd><tt><a href="#Account">Account</a>'s&nbsp;margin&nbsp;value.</tt></dd></dl>

<dl><dt><a name="Account-name"><strong>name</strong></a>(self)</dt><dd><tt><a href="#Account">Account</a>'s&nbsp;name.</tt></dd></dl>

</td></tr></table> 
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Advisor">class <strong>Advisor</strong></a></font></td></tr>
    

<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>An&nbsp;expert&nbsp;advisor&nbsp;takes&nbsp;care&nbsp;of&nbsp;trade&nbsp;for&nbsp;one&nbsp;symbol.<br>
This&nbsp;is&nbsp;the&nbsp;base&nbsp;class&nbsp;to&nbsp;MetaTrader&nbsp;expert&nbsp;advisors&nbsp;written&nbsp;in&nbsp;Python.<br>

Implement&nbsp;a&nbsp;tick()&nbsp;with&nbsp;no&nbsp;arguments&nbsp;method&nbsp;in&nbsp;your&nbsp;derived&nbsp;classes.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Advisor-__init__"><strong>__init__</strong></a>(self)</dt><dd><tt>You&nbsp;may&nbsp;want&nbsp;to&nbsp;implement&nbsp;your&nbsp;own&nbsp;__init__&nbsp;method.<br>

If&nbsp;so,&nbsp;the&nbsp;arguments&nbsp;passed&nbsp;will&nbsp;be&nbsp;the&nbsp;advisor's&nbsp;symbol,<br>
point&nbsp;and&nbsp;relevant&nbsp;digits.</tt></dd></dl>

<dl><dt><a name="Advisor-account"><strong>account</strong></a>(self)</dt><dd><tt>Returns&nbsp;an&nbsp;instance&nbsp;with&nbsp;information&nbsp;about&nbsp;the&nbsp;active<br>
account.<br>
This&nbsp;information&nbsp;isn't&nbsp;available&nbsp;before&nbsp;the&nbsp;first&nbsp;tick.</tt></dd></dl>

<dl><dt><a name="Advisor-askPrice"><strong>askPrice</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;current&nbsp;tick's&nbsp;ask&nbsp;price.<br>
This&nbsp;information&nbsp;isn't&nbsp;available&nbsp;before&nbsp;the&nbsp;first&nbsp;tick.</tt></dd></dl>

<dl><dt><a name="Advisor-bidPrice"><strong>bidPrice</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;current&nbsp;tick's&nbsp;bid&nbsp;price.<br>
This&nbsp;information&nbsp;isn't&nbsp;available&nbsp;before&nbsp;the&nbsp;first&nbsp;tick.</tt></dd></dl>

<dl><dt><a name="Advisor-closeOrder"><strong>closeOrder</strong></a>(self, order)</dt><dd><tt>Closes&nbsp;an&nbsp;open&nbsp;order.<br>
Alternatively,&nbsp;cancels&nbsp;the&nbsp;order&nbsp;if&nbsp;it&nbsp;hasn't&nbsp;been&nbsp;issued&nbsp;yet.</tt></dd></dl>

<dl><dt><a name="Advisor-datetime"><strong>datetime</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;current&nbsp;tick's&nbsp;server&nbsp;time.&nbsp;The&nbsp;time&nbsp;is&nbsp;modelled<br>
when&nbsp;testing.</tt></dd></dl>

<dl><dt><a name="Advisor-digits"><strong>digits</strong></a>(self)</dt><dd><tt>Relevant&nbsp;digits&nbsp;after&nbsp;the&nbsp;decimal&nbsp;point&nbsp;for&nbsp;this&nbsp;symbol.<br>
This&nbsp;information&nbsp;isn't&nbsp;available&nbsp;before&nbsp;the&nbsp;first&nbsp;tick.</tt></dd></dl>

<dl><dt><a name="Advisor-indicators"><strong>indicators</strong></a>(self)</dt><dd><tt>Returns&nbsp;a&nbsp;dictionary&nbsp;of&nbsp;watched&nbsp;indicators&nbsp;to&nbsp;their&nbsp;values<br>
this&nbsp;tick.</tt></dd></dl>

<dl><dt><a name="Advisor-isTesting"><strong>isTesting</strong></a>(self)</dt><dd><tt>Returns&nbsp;true&nbsp;if&nbsp;this&nbsp;advisor&nbsp;is&nbsp;being&nbsp;tested.<br>
This&nbsp;information&nbsp;isn't&nbsp;available&nbsp;before&nbsp;the&nbsp;first&nbsp;tick.</tt></dd></dl>

<dl><dt><a name="Advisor-openOrder"><strong>openOrder</strong></a>(self, order)</dt><dd><tt>Opens&nbsp;an&nbsp;order.<br>
The&nbsp;order&nbsp;is&nbsp;issued&nbsp;in&nbsp;between&nbsp;this&nbsp;tick()&nbsp;call&nbsp;and&nbsp;the&nbsp;next.<br>

See&nbsp;<a href="#Order">Order</a>,&nbsp;BuyOrder&nbsp;and&nbsp;SellOrder&nbsp;classes.</tt></dd></dl>

<dl><dt><a name="Advisor-orders"><strong>orders</strong></a>(self)</dt><dd><tt>Returns&nbsp;a&nbsp;list&nbsp;of&nbsp;open&nbsp;orders.<br>

Only&nbsp;orders&nbsp;issued&nbsp;by&nbsp;this&nbsp;advisor&nbsp;are&nbsp;included.</tt></dd></dl>

<dl><dt><a name="Advisor-point"><strong>point</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;symbols&nbsp;point&nbsp;in&nbsp;currency.<br>

This&nbsp;information&nbsp;isn't&nbsp;available&nbsp;before&nbsp;the&nbsp;first&nbsp;tick.</tt></dd></dl>

<dl><dt><a name="Advisor-symbol"><strong>symbol</strong></a>(self)</dt><dd><tt>Returns&nbsp;the&nbsp;advisors&nbsp;symbol&nbsp;as&nbsp;string.<br>

This&nbsp;information&nbsp;isn't&nbsp;available&nbsp;before&nbsp;the&nbsp;first&nbsp;tick.</tt></dd></dl>

<dl><dt><a name="Advisor-unwatchIndicator"><strong>unwatchIndicator</strong></a>(self, indicator)</dt><dd><tt>Stop&nbsp;watching&nbsp;this&nbsp;indicator.</tt></dd></dl>

<dl><dt><a name="Advisor-watchIndicator"><strong>watchIndicator</strong></a>(self, indicator)</dt><dd><tt>Watch&nbsp;an&nbsp;<a href="#Indicator">Indicator</a>.&nbsp;It&nbsp;will&nbsp;be&nbsp;updated&nbsp;between&nbsp;ticks.</tt></dd></dl>

</td></tr></table>

<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Indicator">class <strong>Indicator</strong></a></font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>Technical&nbsp;indicators.<br>
To&nbsp;use&nbsp;them&nbsp;call&nbsp;<a href="#Advisor">Advisor</a>.watchIndicator().<br>&nbsp;</tt></td></tr>

<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Indicator-__init__"><strong>__init__</strong></a>(self, indicator, timeframe, shift<font color="#909090">=0</font>, **kwargs)</dt><dd><tt>Construct&nbsp;an&nbsp;indicator.<br>
You&nbsp;must&nbsp;specify&nbsp;any&nbsp;parameters&nbsp;using&nbsp;MQL4&nbsp;parameter&nbsp;names<br>

as&nbsp;keywords,&nbsp;e.g.&nbsp;'appied_price'&nbsp;or&nbsp;'ma_shift'.<br>
In&nbsp;the&nbsp;case&nbsp;of&nbsp;the&nbsp;Stochastic&nbsp;<a href="#Indicator">Indicator</a>,&nbsp;the&nbsp;keywords&nbsp;for&nbsp;the<br>

%Kperiod&nbsp;and&nbsp;%Dperiod&nbsp;parameters&nbsp;are&nbsp;'k_period'&nbsp;and&nbsp;'d_period',<br>
respectively.<br>
If&nbsp;the&nbsp;indicator&nbsp;only&nbsp;takes&nbsp;timeframe&nbsp;and&nbsp;shift&nbsp;as&nbsp;parameters,<br>

you&nbsp;may&nbsp;omit&nbsp;the&nbsp;keywords.</tt></dd></dl>

<dl><dt><a name="Indicator-value"><strong>value</strong></a>(self)</dt><dd><tt>Return&nbsp;the&nbsp;indicator&nbsp;value&nbsp;for&nbsp;this&nbsp;tick.</tt></dd></dl>

<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>AC</strong> = 0</dl>

<dl><dt><strong>AD</strong> = 1</dl>

<dl><dt><strong>ADX</strong> = 2</dl>

<dl><dt><strong>ALLIGATOR</strong> = 3</dl>

<dl><dt><strong>AO</strong> = 4</dl>

<dl><dt><strong>ATR</strong> = 5</dl>

<dl><dt><strong>AppliedPrice</strong> = &lt;class metatrader.AppliedPrice&gt;</dl>

<dl><dt><strong>BANDS</strong> = 6</dl>

<dl><dt><strong>BEARS_POWER</strong> = 7</dl>

<dl><dt><strong>BULLS_POWER</strong> = 8</dl>

<dl><dt><strong>BWMFI</strong> = 9</dl>

<dl><dt><strong>CCI</strong> = 10</dl>

<dl><dt><strong>DE_MARKER</strong> = 11</dl>

<dl><dt><strong>ENVELOPES</strong> = 12</dl>

<dl><dt><strong>FORCE</strong> = 13</dl>

<dl><dt><strong>FRACTALS</strong> = 14</dl>

<dl><dt><strong>GATOR</strong> = 15</dl>

<dl><dt><strong>ICHIMOKU</strong> = 16</dl>

<dl><dt><strong>MA</strong> = 17</dl>

<dl><dt><strong>MACD</strong> = 18</dl>

<dl><dt><strong>MFI</strong> = 19</dl>

<dl><dt><strong>MOMENTUM</strong> = 20</dl>

<dl><dt><strong>Mode</strong> = &lt;class metatrader.Mode&gt;</dl>

<dl><dt><strong>MovingAverage</strong> = &lt;class metatrader.MovingAverage&gt;</dl>

<dl><dt><strong>OBV</strong> = 21</dl>

<dl><dt><strong>OSMA</strong> = 22</dl>

<dl><dt><strong>RSI</strong> = 23</dl>

<dl><dt><strong>RVI</strong> = 24</dl>

<dl><dt><strong>SAR</strong> = 25</dl>

<dl><dt><strong>STDDEV</strong> = 26</dl>

<dl><dt><strong>STOCHASTIC</strong> = 27</dl>

<dl><dt><strong>Timeframe</strong> = &lt;class metatrader.Timeframe&gt;</dl>

<dl><dt><strong>WPR</strong> = 28</dl>

</td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Order">class <strong>Order</strong></a></font></td></tr>
    
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt>An&nbsp;order&nbsp;to&nbsp;buy&nbsp;or&nbsp;sell&nbsp;that&nbsp;can&nbsp;be&nbsp;issued&nbsp;to&nbsp;the&nbsp;broker.<br>

And&nbsp;later&nbsp;closed.&nbsp;See&nbsp;<a href="#Advisor">Advisor</a>.openOrder()&nbsp;and&nbsp;<a href="#Advisor">Advisor</a>.closeOrder()<br>
methods.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Order-__init__"><strong>__init__</strong></a>(self, command, volume, slippage<font color="#909090">=2</font>, stopLoss<font color="#909090">=25</font>, takeProfit<font color="#909090">=50</font>)</dt><dd><tt>Create&nbsp;an&nbsp;order.<br>

The&nbsp;order&nbsp;command&nbsp;parameter&nbsp;may&nbsp;be&nbsp;one&nbsp;of&nbsp;<a href="#Order">Order</a>.BUY&nbsp;or<br>
<a href="#Order">Order</a>.SELL.&nbsp;Volume&nbsp;is&nbsp;in&nbsp;lots.&nbsp;Slippage&nbsp;in&nbsp;points.</tt></dd></dl>

<hr>
Data and other attributes defined here:<br>
<dl><dt><strong>BUY</strong> = 0</dl>

<dl><dt><strong>SELL</strong> = 1</dl>

</td></tr></table></td></tr></table>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#55aa55">

<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
    
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>VERSION</strong> = 1.1</td></tr></table>
Z 1ad922e44e87d3daf0cd92b1933dcf58