Download MetaTrader 5

Send Easily Twitter Msg From your Indi/Expert [MTwittex]

To add comments, please log in or register
Marco Milani
257
Marco Milani  

Hi,

First of all sorry for my bad english.. hope you'll undestand.. 

Probably there are many others methods for send message on your Twitter account directly from your MQL5 code... but this is my solution! :)

 

I have coded a very easy program that allows you to send message on your Twitter Account..

HOW IT WORKS FROM COMMAND LINE:

MTwitter.exe "Your message" 

So here you can see a Simple Include script that allow you to use SendTwitter method! 

//+------------------------------------------------------------------+
//|                                               Twitter Sender.mqh |
//|                                        Copyright 2010, Supermilo |
//+------------------------------------------------------------------+
#property copyright "Copyright 2010, Supermilo"
#property link      "https://www.mql5.com/en/users/Supermilo"


#import "shell32.dll"                                               
   int  ShellExecuteW(int hwnd, string Operation, string File, string Parameters, string Directory, int ShowCmd);
#import


// SEND TWITTER MESSAGE
void SendTwitter(string msg) 
{
  string dir =  TerminalInfoString(TERMINAL_PATH) + "\MTwittex"; 
  
  int res =  ShellExecuteW(0,"open","MTwittex.exe",CharToString(34)+msg+CharToString(34),dir,0);
   
   if (res < 32)
      Print("Error While Execute Extern File");
   else
      Print("MTwittex Successfull!");
 
}

After you have included this you can simply call SendTwitter Method like :

#include <Twitter Sender.mqh>

if (param1 > param2)
   SendTwitter("Param 1 is bigger than param 2");

N ic e!! :)

 

 

Before you start using MTwittex you must activate this application on your Twitter Account!! 

Here few simple steps for activate MTwittex 

First: 

Dowload the folder MTwittex.zip (unzip it) and you will have a folder like this:    

Folder Content


Second: 

Double click on ACTIVATION.bat this file simply try to send a MSG on Twitter with "Activation" as text.. but this app doesn't know your account and your account doesn't know this app.

So when you run for the first time MTwittex your browser will show a login page or directly it will ask for application permission.Browser Open 

 

Third: 

Login into your twitter and click on Authorize this Application... your browser will show you a PIN code.

Insert your PIN code into the MS Dos Shell and press Enter.

Insert PinCode 

 

Fourth: 

Now your account know MTwittex. 

Copy the entire Folder (Without changhing anything ) in your MT5 terminal folder

MT5 Folder 

 

  

That's all now simply include the Twitter Sender.mqh and you will be able to use the SendTwitter(string msg) function!!

 

NOTE:

  1. For run MTwittex.exe (Virus Scan HERE)  you must have Framework .NET 4 Installed!
  2. When you activate MTwittex it create a xml file with token info, don't delete it or you must re-activate!!!
  3. When you use ACTIVATION.bat a message with Text "Activation" is sent from your account twitter... remove it!! :)

 

 

HAVE FUN!

 

SuperMilo 



To add comments, please log in or register