View Single Post
  #22 (permalink)  
Old 03-29-2008, 06:22 PM
Mistigri's Avatar
Mistigri Mistigri is offline
Member
 
Join Date: Mar 2006
Posts: 34
Mistigri is on a distinguished road
How about something a little easier, using the FTP function in MT4

Set your FTP settings in Metatrader under Tools / Options / Publisher.

Then write an EA with something like this:

PHP Code:
//+------------------------------------------------------------------+
//|                                             MistigriFX - OOW.mq4 |
//|                                Copyright © 2008, Patrick Nouvion |
//|                                        http://www.mistigrifx.com |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, Patrick Nouvion"
#property link      "http://www.mistigrifx.com"

//+------------------------------------------------------------------+
//| GlobalVars                                                       |
//+------------------------------------------------------------------+
string FileName "";
datetime CurrTime 0;
datetime PrevTime 0;
//+------------------------------------------------------------------+
//| expert init / deinit                                             |
//+------------------------------------------------------------------+
int init()   

   
FileName StringConcatenateAccountNumber(), "-Trades.php" ); 
   
CurrTime iTimeSymbol(), 1);
   
PrevTime iTimeSymbol(), 1);
   
//----
   
return(0); 
}
int deinit() { return(0); }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
{
   
//----
   
CurrTime iTimeSymbol(), 1);
   if( 
CountAll() != && CurrTime != PrevTime )   
   {
         
int H1 FileOpenFileName FILE_CSV|FILE_READ|FILE_WRITE',' );
         if( 
H1 ) { AlertGetLastError() ); return(-1); }
         for( 
int i 0OrdersTotal(); i++ )
         {
            
OrderSelectiSELECT_BY_POSMODE_TRADES );
            
string Data StringConcatenateOrderSymbol()," "OrderLots(), " "OrderProfit() );
            
FileWriteH1Data );
            
FileWriteH1"<br />");
         }
         
FileCloseH1 );
         
//----
         
if( !SendFTP(FileName) ) { Print( GetLastError() ); }
         
PrevTime CurrTime;
   }
   
//----
   
   
return(0);
  }
//+------------------------------------------------------------------+

//+------------------------------------------------------------------+
//                              CountAll                             |
//+------------------------------------------------------------------+
int CountAll()
{
   
int count=0;
   for(
int i OrdersTotal()-1>=0i--)
   {
      
OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      
int OrdMag OrderMagicNumber();
      
int OrdNum OrderTicket();
   
           if( 
OrderType() == OP_BUY  ) { count++; }
      else if( 
OrderType() == OP_SELL ) { count++; }
   }
 return(
count);
}
//+------------------------------------------------------------------+ 
On your website write a php page with something like this:

PHP Code:
<div id="bodyPan">
<h2>View Trades</h2>

<?php
$AccountPost 
0;
 
$AccountGet 0;
$Account 0;
$AccountPost $_POST['Account'];
 
$AccountGet $_GET['Account'];

if( 
$AccountPost != || $AccountGet != )
{
    if( 
$AccountPost != ) { $Account $AccountPost; }
    else              { 
$Account $AccountGet; }

    echo 
"<p>Account #: $Account </p>";
    
$FileSta "./OOW/";
    
$FileEnd "-Trades.php";
    
$myFile $FileSta $Account $FileEnd;
    
$fh fopen($myFile'r');
    
$theData fread($fhfilesize($myFile));
    
fclose($fh);
    echo 
"<p>";
    echo 
$theData;
    echo 
"</p>";
}
else
{
?>

<p>
<form name="ViewTrades" method="post" action="">
<label stle="margin-top: 5px;">Account:</label>
<input style="margin-top: 11px; margin-left: 15px;" type="text" name="Account" value="0" />
<input class="submit" type="submit" name="submit" value="Submit" style="background-color: #ffffff; margin-left: 100px; margin-top: 18px;" />
</form>
</p>

<?php
}
?>

</div>
Notice that I upload the file to a OOW folder ... You would obviously have to change that, but in the end the file would be uploaded every minute.

For an example Go to this link : MistigriFx - View Trades
Enter 123456 for the account number or Click on MistigriFx - View Trades?Account=123456

Patrick

Last edited by Mistigri; 03-29-2008 at 06:29 PM.
Reply With Quote