2026-10-28 22:50:57 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| Monitor.mq5 |
|
| | | //| Copyright 2026, Niquel Mendoza. |
|
| | | //| https://www.mql5.com |
|
| | | //+------------------------------------------------------------------+
|
| | | #property copyright "Copyright 2026, Niquel Mendoza."
|
| | | #property link "https://www.mql5.com"
|
| | | #property version "1.00"
|
| | | #property strict
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | #include "..\\Manager.mqh"
|
| | | #include <TSN\\Std\\Memory.mqh>
|
| | | #include "..\\..\\..\\Utils\\FA\\BarControler.mqh"
|
| | |
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | TSN::CBarControlerFastMinors bar_d1(PERIOD_D1);
|
| | | TSN::CBarControlerFastW1 bar_w1;
|
| | | TSN::CBarControlerFastMN1 bar_mn1;
|
2026-10-29 07:48:56 -05:00 | | | /*
|
| | | //+------------------------------------------------------------------+
|
| | | //| |
|
| | | //+------------------------------------------------------------------+
|
| | | class CAccPrinter : public CAccountGestor
|
| | | {
|
| | | public:
|
| | | CAccountGestor() {}
|
| | | ~CAccountGestor() {}
|
| | |
|
| | | //--- Positions
|
| | | void OnClosePosition(const ROnClosePosition &pos, const int global_pos_index) {}
|
| | | void OnOpenPosition(const ROnOpenPosition &pos) {}
|
| | |
|
| | | //--- Position modify
|
| | | void OnPositionModify(const Position& pos, const uint8_t change_flags) { }
|
| | |
|
| | | //--- Orders
|
| | | void OnOrderAdd(const ROrder& order) { }
|
| | | void OnOrderUpdate(const ROrder& order) { }
|
| | | void OnOrderDelete(const ROrder& order) { }
|
| | |
|
| | | //-- Function that is executed only once, where only the account profit fields are filled, such as account_gross_profit
|
| | | //daily, weekly, etc.
|
| | | void OnNewProfit(const RAccountProfit &profit, const datetime curr_time) { }
|
| | |
|
| | | //--- Function that is executed each time TesterDeposit or TesterWithdrawal is called... or capital is added to the account
|
| | | void OnWithdrawalDeposit(const double value) { } //If the value is positive it means a deposit, otherwise a withdrawal
|
| | |
|
| | | //--- Function that is executed only once, only if there are previously open trades, only the position structure
|
| | | void OnInitNewPos(const ROnOpenPosition &position) { }
|
2026-10-28 22:50:57 -05:00 | | |
|
2026-10-29 07:48:56 -05:00 | | | //---
|
| | | void OnLossProfit(const double p) {}
|
| | | };
|
| | |
|
| | | */
|
2026-10-28 22:50:57 -05:00 | | | //+------------------------------------------------------------------+
|
| | | //| Expert initialization function |
|
| | | //+------------------------------------------------------------------+
|
| | | int OnInit()
|
| | | {
|
| | | //---
|
2026-10-29 07:48:56 -05:00 | | | TSN::account_status.AddLogFlags(VERBOSE_LOG_LEVEL_ALL);
|
2026-10-28 22:50:57 -05:00 | | | TSN::account_status.OnInitEvent();
|
| | |
|
| | | //---
|
| | | CAutoCleaner::AddFunction(TSN::CAccountStatus_Deinit);
|
| | |
|
| | | //---
|
| | | return(INIT_SUCCEEDED);
|
| | | }
|
| | | //+------------------------------------------------------------------+
|
| | | //| Expert deinitialization function |
|
| | | //+------------------------------------------------------------------+
|
| | | void OnDeinit(const int reason)
|
| | | {
|
| | | //---
|
| | | CAutoCleaner::Deinit(reason);
|
| | | }
|
| | | //+------------------------------------------------------------------+
|
| | | //| Expert tick function |
|
| | | //+------------------------------------------------------------------+
|
| | | void OnTick()
|
| | | {
|
| | | //---
|
| | | const datetime time_curr = TimeCurrent();
|
| | | if(bar_d1.IsNewBar(time_curr))
|
| | | {
|
| | | //---
|
| | | CBasicEvents::OnNewDay(time_curr);
|
| | |
|
| | | //---
|
| | | if(bar_w1.IsNewBar(time_curr))
|
| | | CBasicEvents::OnNewWeek(time_curr);
|
| | |
|
| | |
|
| | | //---
|
| | | if(bar_mn1.IsNewBar(time_curr))
|
| | | CBasicEvents::OnNewMonth(time_curr);
|
| | | }
|
| | | }
|
| | | //+------------------------------------------------------------------+
|
| | | //| TradeTransaction function |
|
| | | //+------------------------------------------------------------------+
|
| | | void OnTradeTransaction(const MqlTradeTransaction& trans,
|
| | | const MqlTradeRequest& request,
|
| | | const MqlTradeResult& result)
|
| | | {
|
| | | //---
|
| | | TSN::account_status.OnTradeTransactionEvent(trans);
|
| | | }
|
| | | //+------------------------------------------------------------------+
|