25.10.2016 Views

Expert Advisor Programming by Andrew R. Young

Expert Advisor Programming by Andrew R. Young

Expert Advisor Programming by Andrew R. Young

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

EXPERT ADVISOR PROGRAMMING<br />

Fig. 8.2 – Common tab of <strong>Expert</strong> <strong>Advisor</strong> Properties dialog.<br />

You can view all of the terminal checkup functions in the MQL Reference under Checkup.<br />

Demo or Account Limitations<br />

You may decide at some point to sell your profitable expert advisor to other traders. You may also<br />

want to provide a demo version for potential buyers to test. To prevent your EA from being freely<br />

distributed or traded <strong>by</strong> unauthorized persons, you'll want to incorporate some kind of account<br />

limitations that limit the usage of the EA to authorized buyers. You may even want to limit usage to a<br />

particular broker.<br />

To limit usage to a demo account, use the IsDemo() function to check whether the currently active<br />

account is a demo account. If the current account is not a demo account, we will display an alert and<br />

halt the execution of the EA.<br />

if(IsDemo() == false)<br />

{<br />

Alert("This EA only for use on a demo account!");<br />

return(0);<br />

}<br />

124

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!