Multi-Strategy

Multi-Strategy

Multi-Strategy

Starting from PineConnector MT4 EA v2.143 and MT5 EA v2.095, you can now trade multiple strategies on a single license using the enhanced "close" and "cancel" commands that closes positions with the same comment.

Available Commands:

  • closelong (closes buy positions)
  • closeshort (closes sell positions)
  • cancellong (closes buystop and buylimit orders)
  • cancelshort (closes sellstop and selllimit orders)

Please note that support for other close commands such as “closelongpct” and “closelongvol” will be added in the future.

Now you can trade two or more timeframes/strategies simultaneously for the same instrument using just one license.

Implementation

To execute multiple strategies, you need to include a comment in your signals.

Entries

To enter the market, you may use either of the 6 entry commands:

  • buy
  • sell
  • buylimit
  • selllimit
  • buystop
  • sellstop

Let's assume you want to run 2 strategies. For Strategy 1 signals, include the comment "strategy 1", and for Strategy 2 signals, include the comment "strategy 2".

LicenseID,buy,EURUSD,risk=1,comment="strategy 1"
LicenseID,buy,EURUSD,risk=1,comment="strategy 2"
💡
Identifiers You are free to use any identifiers you'd like instead of "Strategy 1" and "Strategy 2".

For example, you can indicate the strategy name or timeframe you are trading such as "SuperTrend Strategy" or "15 minutes".

💡
Case-Sensitive Please note that comments/identifiers are case-sensitive. "Strategy 1" is not equal to "strategy 1".

Closing

To close positions for a specific strategy, the close command must be accompanied by the same comment.

List of closing commands presently supported:

  • closelong (closes buy positions)
  • closeshort (closes sell positions)
  • cancellong (cancels buystop and buylimit orders)
  • cancelshort (cancels selllstop and selllimit orders)

Using our example, to close positions for Strategy 1:

LicenseID,closelong,EURUSD,comment="strategy 1"

With the above command:

  • All buy trades for EURUSD with the comment "strategy 1" will be closed.
  • Sell trades for EURUSD with the same comment will not be closed.
  • Buy positions for EURUSD without any comment or with different comments will not be closed.

Similarly, to close positions on Strategy 2:

LicenseID,closelong,EURUSD,comment="strategy 2"

Close on Reverse

Instead of closing positions of a strategy using the “closelong” or “closeshort” commands, you may close your positions with the Close On Reverse EA feature. For example, there are 2 buy EURUSD positions with the following syntax:

LicenseID,buy,EURUSD,risk=1,comment="strategy 1"
LicenseID,buy,EURUSD,risk=1,comment="strategy 2"

Once both positions are open, you may close one of them with:

LicenseID,sell,EURUSD,risk=1,comment="strategy 1"

The buy position with “strategy 1” comment will close and a sell position will open. The other buy position with “strategy 2” comment will left untouched.

Important Note

Blanket Behavior — Entries Without Comments

Sending a "closelong" command without a comment will close positions with or without comments.

For example, you have the following open:

  1. buy EURUSD without a comment
  2. buy EURUSD with “strategy 1” commented
  3. buy EURUSD with “strategy 2” commented

Sending an EURUSD “closelong” will close all 3 positions above.

Innovation Exchange: Ideas, Feedback, and Beyond

If there are ways we can improve the implementation of the multi-strategy feature (or any other feature or aspect), please let us know!

super-embed:<iframe data-tally-src="https://tally.so/embed/3jaVWx?alignLeft=1&hideTitle=1&transparentBackground=1&dynamicHeight=1" width="100%" height="350" frameborder="0" marginheight="0" marginwidth="0" title="Submit a feature request"></iframe><script>var d=document,w="https://tally.so/widgets/embed.js",v=function(){"undefined"!=typeof Tally?Tally.loadEmbeds():d.querySelectorAll("iframe[data-tally-src]:not([src])").forEach((function(e){e.src=e.dataset.tallySrc}))};if(d.querySelector('script[src="'+w+'"]'))v();else{var s=d.createElement("script");s.src=w,s.onload=v,s.onerror=v,d.body.appendChild(s);}</script>