Using MT4 to Send Trading Stock Signals to C2

Recently, MT4 has offered futures and CFDs. I understand that C2 does not support futures or CFDs for MetaTrader.

I have modified the C2MT4 script so that it will send “AAPL” symbol to Collective 2. Basically, I will be sending Apple stock trading signals and not CFDs for MetaTrader.

Please let me know if this will work.

#import "C2MT4Connector.dll"
string C2Init2(string c2InterfaceHost, string email, string password, string systemid, double c2LotMultiplier, string eaVersion, string terminal_data_path, string terminal_commondata_path, string reserve );
string C2OrderOpen(string email, string password, string systemid, int orderid, string symbol, int cmd, double volume, double price, double stoploss, double takeprofit, string timeStamp, string mt4OrderComment);
string C2OrderClose(string email, string password, string systemid, int orderid, string symbol, int cmd, double volume, double closePrice, string mt4OrderComment);
int C2ReadResponses();
string C2NextResponse();
#import

extern string C2SystemID = “”;
extern string C2Email = “”;
extern string C2Password = “”;
extern double C2LotMultiplier = 10;
extern string C2InterfaceHost = “ts.collective2.com”;

Hello,

we can do that.

But we need to know how to convert MT4 symbols to Collective2 symbols.

See https://collective2.com/symbols

Perhaps the right way is to create a new set of functions like above and add two or three parameters:

  1. Collective2Symbol
  2. TypeOfSymbol
  3. Exchange

where

  • Collective2Symbol is a symbol known to Collective2
  • TypeOfSymbol is “stock”, “forex”, “futures”, …
  • Exchange is “US” for US symbols or “LSE”, “MEFF”, “ASX”, … for foreign exchanges.

Is it viable?

Bob,

Thanks for your prompt reply.

There will be no need to convert MT4 symbols to Collective2 symbols as I will be sending exact stock trading symbol to the C2MT4Connector.dll

  if(trading_function >= OP_BUY )
      {
         if (trading_function == 0) 
         {
         result= OrderSend(_Symbol,OP_BUY,Lots,Ask,Slippage,sl,tp,sOP+" "+(string)b_magic[ind],b_magic[ind],0,clOP);
         C2OrderOpen(C2Email, C2Password, C2SystemID, result, "AAPL", OP_BUY, Lots, Ask, 0.0, 0.0, "", "");
         ReadCollective2Responses();
    
         }
         
         if (trading_function == 1) 
         {
         result= OrderSend(_Symbol,OP_SELL,Lots,Bid,Slippage,sl,tp,sOP+" "+(string)b_magic[ind],b_magic[ind],0,clOP);
         C2OrderOpen(C2Email, C2Password, C2SystemID, result, "AAPL", OP_SELL, Lots, Bid, 0.0, 0.0, "", "");
         ReadCollective2Responses();
         }
      }
      trading_function = -1; 
   }
}




    void CloseSelect()
    {
        int ticket = OrderTicket();
        C2OrderClose(C2Email, C2Password, C2SystemID, ticket, "AAPL", OrderType(), Lots, OrderClosePrice(), ""); 
        ReadCollective2Responses();
       if(OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),Slippage,clrGold)) //--- Request successfully completed 
       {
          Alert("Position has been successfully closed!!");
       }
       else
       {
          Alert("The position close request could not be completed");
       }
    }

Do I need to send the exchange name if I were to trade the following symbols?

“SJM”, “VTR”, “TSO”, “LNG”, and etc…

Symbol Desc ription
SJM _____ J.M. SMUCKER CO
VTR _____ VENTAS INC
TSO _____ TESORO CORPORATION
LNG _____ CHENIERE ENERGY INC
JOY _____ JOY GLOBAL
WDAY _____ WORKDAY
URI _____ UNITED RENTALS INC
DECK _____ DECKERS OUTDOOR CORP
SWIR _____ SIERRA WIRELESS INC
FMX _____ FOMENTO ECONOMICO MEX
ADSK _____ AUTODESK INC
LULU _____ LULULEMON ATHLTCA INC
RYAAY _____ RYANAIR HLDGS PLC ADS
GMCR _____ GREEN MTN COFFEE ROASTER
CSIQ _____ CANADIAN SOLAR INC
HES _____ HESS CORP
KSU _____ KANSAS CITY SOUTHERN
WYNN _____ WYNN RESORTS LTD
FSLR _____ FIRST SOLAR INC. COMMON STOCK
CP _____ CANADIAN PACIFIC RLWY
DDD _____ 3D SYSTEMS

Alternatively, I can send trading signals via email but it may not be as reliable as using C2MT4Connector.dll.

To: signal@lists.collective2.com

Subject: C2 signal

Text:

systemid=12345

pw=bonzaiBaby231

BTO 100 AAPL LIMIT 12.34 GTC (stock)

profittarget=35

stoploss=9

OK. Done. You can try it as it is now.

If you will not use some obscure symbols :scream: it will work.

No Exchange needed.

Let mi know.

Happy trading!

Hello traders!

We added a “translation file” to support stocks and other instruments signals from MetaTrader to C2.

It is an optional C2MT4Connector.ini file which looks like this:


[C2Symbology]
; ----------------------------------------------------
; Translation from MT4 symbols to Collective2 symbols
; ----------------------------------------------------
;
; Syntax: MT4Symbol = Collective2Symbol
; For example: Ger30Sep15 = XGU5
; 
; Lines starting with semicolon are comments.
;
; You can EXCLUDE some symbols from being posted to Collective2.
; For example:  EURCHF = EXCLUDE
; EURCHF signals will NOT be sent to Collective2 then, but trades in MT4 
; will be performed!
;
Ger30Sep15=XGU5

Our C2MT4Connector looks in this file whenever it sends a signal to Collective2.
If it finds a MetaTrader symbol in this file, it changes it to the Collective2 symbol and sends a signal.
The symbol used inside MetaTrader is not changed. Just the symbol sent to Collective2.

Installation:

  • Stop MT4
  • Download this file www.collective2.com/downloads/C2MT4Connector/C2MT4Connector.dll
    to the MQL4\Libraries folder. (Rewrite an old file there. )
  • Start Notepad and copy the text from the example above to it.
    (I can’t attach that INI file to this forum.)
  • Add your symbols translations there.
    For example add your next months futures symbols and their translations.
    Something like this (just an example!):

Ger30Oct15 = XGV5
Ger30Nov15 = XGX5

  • Save the file as “C2MT4Connector.ini” to the MQL4\Libraries folder too.
    (Check it again - do not make any typo!)

Happy trading!

Bob,

I would like to send these symbols directly to collective2

ES
NQ
DX
YM
TU
FV
TY
US

Can C2 accept these symbols without their expiration date?

ES – S&P500 emini
NQ – NASDAQ emini
DX – US dollar index
YM – Dow Jones emini
TU - 2Year US treasury notes
FV - 5Year US treasury notes
TY - 1oYear US treasury notes
US - 30Year US treasury bonds

No. We will not recognize them as futures without a month and a year code.

Please use symbols with two year digits: XGU15, XGX15 (and so on).
One year digit (XGU5, XGX5) does not work.