137 lines
No EOL
4.6 KiB
MQL5
137 lines
No EOL
4.6 KiB
MQL5
//+------------------------------------------------------------------+
|
|
//| My_EA.mqh |
|
|
//| Zucarato |
|
|
//| zucarato@gmail.com |
|
|
//+------------------------------------------------------------------+
|
|
#property copyright "Zucarato"
|
|
#property link "zucarato@gmail.com"
|
|
//+------------------------------------------------------------------+
|
|
//| defines |
|
|
//+------------------------------------------------------------------+
|
|
// #define MacrosHello "Hello, world!"
|
|
// #define MacrosYear 2010
|
|
//+------------------------------------------------------------------+
|
|
//| DLL imports |
|
|
//+------------------------------------------------------------------+
|
|
// #import "user32.dll"
|
|
// int SendMessageA(int hWnd,int Msg,int wParam,int lParam);
|
|
// #import "my_expert.dll"
|
|
// int ExpertRecalculate(int wParam,int lParam);
|
|
// #import
|
|
//+------------------------------------------------------------------+
|
|
//| EX5 imports |
|
|
//+------------------------------------------------------------------+
|
|
// #import "stdlib.ex5"
|
|
// string ErrorDescription(int error_code);
|
|
// #import
|
|
//+------------------------------------------------------------------+
|
|
//| Included Headers |
|
|
//+------------------------------------------------------------------+
|
|
#include <Expert\Expert.mqh>
|
|
#include <Trade\DealInfo.mqh>
|
|
#include <Tools\DateTime.mqh>
|
|
#include <Trade\PositionInfo.mqh>
|
|
#include <Trade\TerminalInfo.mqh>
|
|
#include <Trade\SymbolInfo.mqh>
|
|
#include "..\CustomLybrary\CustomHistoryLibrary.mqh"
|
|
|
|
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| EA custom class declaration |
|
|
//+------------------------------------------------------------------+
|
|
class CMy_EA : public CExpert
|
|
{
|
|
|
|
protected:
|
|
|
|
//PARAMETERS
|
|
//string EA_Symbol; //Stores the symbol name of the EA
|
|
|
|
//OBJECTS
|
|
CDealInfo Deals; //Deals History info handler
|
|
CHistoryOrderInfo Orders; //Orders History info handler
|
|
CCustom_History History; //Custom History handler
|
|
CPositionInfo Positions; //Positions History info handler
|
|
CTerminalInfo Terminal; //Terminal info handler
|
|
CSymbolInfo EA_Symbol; //Symbol info handler
|
|
|
|
|
|
public:
|
|
|
|
|
|
//Constructor
|
|
CMy_EA(); //Default Constructor
|
|
|
|
|
|
//Get-Set Methods
|
|
void SetDaysOffset(uchar n) {History.SetDaysOffset(n);}
|
|
//string GetSymbol() { return EA_Symbol; }
|
|
|
|
//Event handlers Methods
|
|
void OnStartM(void);
|
|
|
|
//Testing Methods
|
|
void Position_Retriever();
|
|
|
|
|
|
|
|
};
|
|
|
|
//+------------------------------------------------------------------+
|
|
//| Class methods implementation |
|
|
//+------------------------------------------------------------------+
|
|
|
|
void CMy_EA::CMy_EA()
|
|
{
|
|
|
|
EA_Symbol.Name(_Symbol);
|
|
History.EA_Symbol(EA_Symbol.Name());
|
|
|
|
}
|
|
|
|
void CMy_EA::OnStartM(void)
|
|
{
|
|
|
|
//Selects database todays data
|
|
History.f6001HistorySelectToday();
|
|
|
|
//Prints database parameters
|
|
Print("Days offset: ",History.GetDaysOffset());
|
|
Print("Selection Start Time: ",History.GetDayTradeStartTime());
|
|
Print("Selection End Time: ",History.End_Time());
|
|
History.f6030CalculateCurrentCloseResult();
|
|
Print("Profit of current selection: ",History.GetCurrentClosedResult());
|
|
|
|
//Prints current Terminal information
|
|
Print("TERMINAL PARAMETERS:");
|
|
Print("Terminal Client build no. ",Terminal.Build());
|
|
Print("Terminal connected?: ",Terminal.IsConnected());
|
|
Print("Is trade allowed? ",Terminal.IsTradeAllowed());
|
|
Print("Max numbers of bars in chart: ",Terminal.MaxBars());
|
|
Print("Numbers of CPU cores available: ",Terminal.CPUCores());
|
|
Print("",Terminal.Build());
|
|
Print("",Terminal.Build());
|
|
Print("",Terminal.Build());
|
|
Print("",Terminal.Build());
|
|
Print("",Terminal.Build());
|
|
Print("",Terminal.Build());
|
|
|
|
|
|
|
|
/*
|
|
int mydealstotal = HistoryDealsTotal();
|
|
Print("Number of deals: ",mydealstotal);
|
|
Print("Number of orders in History: ",HistoryOrdersTotal());
|
|
*/
|
|
|
|
}
|
|
|
|
|
|
|
|
void CMy_EA::Position_Retriever(void)
|
|
{
|
|
|
|
|
|
|
|
} |