Grid Trading Expert for MQL4/MQL5 using Orchard Framework 3

This is my first tutorial on writing a grid trading expert.

Caution – grid trading can lead to very large drawdowns. It is high risk.

This covers the standard buy/sell at each level grid. It is a foundation for other grid trading tutorials to come. The expert here uses the Orchard Framework 3, which I expand in this video to support the grid trading expert.

There are 2 errors in the code shown in the video.

At 27:24 lines 67 and 68 should be replaced by one line
if (!PositionInfo.SelectByIndex(i)) continue;

At 29:07 line 133 should be
if (mLegType==POSITION_TYPE_SELL && mLastTick.ask <= mExit) {


  1. Hi, I tested the gird trading expert for a week than the broker send an email as attached.
    Could you please advise on how to handle this issue?

    Thank you. Max

    Your expert advisor EA was attempting to execute trades without the required balance and was sending a high number of order request to our trading server.

    Your EA will be disabled within next 24 hours. We kindly ask you to review your EA settings.

    Pepperstone Client Service

    1. This is the risk of grid trading. Drawdowns can be excessive. You can add a check of available margin before placing a trade to avoid trying to place trades without sufficient funds.

Leave a Reply