AccountMonitor

Author: Kirk Sloan
AccountMonitor
Price Data Components
Series array that contains open time of each bar
Orders Execution
Checks for the total of open orders
Miscellaneous
It sends emails
0 Views
0 Downloads
0 Favorites
AccountMonitor
/*-----------------------------+
|			       |
| Shared by www.Aptrafx.com    |
|			       |
+------------------------------*/

//+------------------------------------------------------------------+
//|                                               AccountMonitor.mq4 |
//|                                                       Kirk Sloan |
//|                                                   ksfx@kc.rr.com |
//+------------------------------------------------------------------+
#property copyright "Kirk Sloan"
#property link      "ksfx@kc.rr.com"

//---- input parameters
extern bool      Run=true;
double Balance;
double Equity;
string Message;

datetime Bartime;
int Bartick=0;
bool Tradeallowed=true;
string Orders;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
//----
if(Bartime!=Time[0]){
   Bartime=Time[0]; 
   Tradeallowed=true;
   }  


   if(Tradeallowed && Run == true) {
   Tradeallowed = false;
   Orders="";
   Message = "";
   OrderInfo();
   Message = StringConcatenate (TimeToStr(CurTime(),TIME_MINUTES),": Balance= ",AccountBalance()," - Equity= ",AccountEquity()," - Open orders: ",Orders) ;
   SendMail("Account Update", Message);
   }
//----
   return(0);
  }
//+------------------------------------------------------------------+

int OrderInfo(){
   int atotal =OrdersTotal();
   int acnt;
   for(acnt=0;acnt<atotal;acnt++){
     OrderSelect(acnt, SELECT_BY_POS, MODE_TRADES);
     if (OrderType()==OP_BUY)  
       Orders = StringConcatenate (Orders,"BUY ",OrderSymbol(),": Profit= ",OrderProfit()," | ");
     if (OrderType()==OP_SELL)  
       Orders = StringConcatenate (Orders,"SELL ",OrderSymbol(),": Profit= ",OrderProfit()," | ");
   }
}

Comments

Markdown supported. Formatting help

Markdown Formatting Guide

Element Markdown Syntax
Heading # H1
## H2
### H3
Bold **bold text**
Italic *italicized text*
Link [title](https://www.example.com)
Image ![alt text](image.jpg)
Code `code`
Code Block ```
code block
```
Quote > blockquote
Unordered List - Item 1
- Item 2
Ordered List 1. First item
2. Second item
Horizontal Rule ---