diff --git a/Exchange/tests/Exchange.test.mq5 b/Exchange/tests/Exchange.test.mq5 index d3d289c61..38ac7cbe8 100644 --- a/Exchange/tests/Exchange.test.mq5 +++ b/Exchange/tests/Exchange.test.mq5 @@ -30,50 +30,87 @@ #include "../Exchange.h" // Test classes. -class AccountDummy : public AccountBase {}; // -class ExchangeDummy : public Exchange {}; -class SymbolDummy : public SymbolInfo {}; -class TradeDummy : public Trade { - public: - TradeDummy(IndicatorBase *_indi_candle) : Trade(_indi_candle) {} -}; - -// Global variables. -ExchangeDummy ex_dummy; - -// Test dummy Exchange. -bool TestExchange01() { - bool _result = true; - // Initialize a dummy Exchange instance. - Ref exchange = new ExchangeDummy(); - - // Attach instances of dummy accounts. - Ref account01 = new AccountDummy(); - Ref account02 = new AccountDummy(); - exchange REF_DEREF AccountAdd(account01.Ptr(), "Account01"); - exchange REF_DEREF AccountAdd(account02.Ptr(), "Account02"); - - // Attach instances of dummy symbols. - Ref symbol01 = new SymbolDummy(); - Ref symbol02 = new SymbolDummy(); - exchange REF_DEREF SymbolAdd(symbol01.Ptr(), "Symbol01"); - exchange REF_DEREF SymbolAdd(symbol02.Ptr(), "Symbol02"); - - // Attach instances of dummy trades. - Ref trade01 = new TradeDummy(Platform::FetchDefaultCandleIndicator(_Symbol, PERIOD_CURRENT)); - Ref trade02 = new TradeDummy(Platform::FetchDefaultCandleIndicator(_Symbol, PERIOD_CURRENT)); - - exchange REF_DEREF TradeAdd(trade01.Ptr(), "Trade01"); - exchange REF_DEREF TradeAdd(trade02.Ptr(), "Trade02"); - return _result; -} +class AccountDummy : public AccountBase { + /** + * Returns balance value of the current account. + */ + float GetBalance() { return 0; } -/** - * Implements OnInit(). - */ -int OnInit() { - Platform::Init(); - bool _result = true; - assertTrueOrFail(TestExchange01(), "Fail!"); - return _result && GetLastError() == 0 ? INIT_SUCCEEDED : INIT_FAILED; -} + /** + * Returns credit value of the current account. + */ + float GetCredit() { return 0; } + + /** + * Returns profit value of the current account. + */ + float GetProfit() { return 0; } + + /** + * Returns equity value of the current account. + */ + float GetEquity() { return 0; } + + /** + * Returns margin value of the current account. + */ + float GetMarginUsed() { return 0; } + + /** + * Returns free margin value of the current account. + */ + float GetMarginFree() { return 0; } + + /** + * Get account available margin. + */ + float GetMarginAvail() { + return 0; + {} + }; // + class ExchangeDummy : public Exchange {}; + class SymbolDummy : public SymbolInfo {}; + class TradeDummy : public Trade { + public: + TradeDummy(IndicatorBase *_indi_candle) : Trade(_indi_candle) {} + }; + + // Global variables. + ExchangeDummy ex_dummy; + + // Test dummy Exchange. + bool TestExchange01() { + bool _result = true; + // Initialize a dummy Exchange instance. + Ref exchange = new ExchangeDummy(); + + // Attach instances of dummy accounts. + Ref account01 = new AccountDummy(); + Ref account02 = new AccountDummy(); + exchange REF_DEREF AccountAdd(account01.Ptr(), "Account01"); + exchange REF_DEREF AccountAdd(account02.Ptr(), "Account02"); + + // Attach instances of dummy symbols. + Ref symbol01 = new SymbolDummy(); + Ref symbol02 = new SymbolDummy(); + exchange REF_DEREF SymbolAdd(symbol01.Ptr(), "Symbol01"); + exchange REF_DEREF SymbolAdd(symbol02.Ptr(), "Symbol02"); + + // Attach instances of dummy trades. + Ref trade01 = new TradeDummy(Platform::FetchDefaultCandleIndicator(_Symbol, PERIOD_CURRENT)); + Ref trade02 = new TradeDummy(Platform::FetchDefaultCandleIndicator(_Symbol, PERIOD_CURRENT)); + + exchange REF_DEREF TradeAdd(trade01.Ptr(), "Trade01"); + exchange REF_DEREF TradeAdd(trade02.Ptr(), "Trade02"); + return _result; + } + + /** + * Implements OnInit(). + */ + int OnInit() { + Platform::Init(); + bool _result = true; + assertTrueOrFail(TestExchange01(), "Fail!"); + return _result && GetLastError() == 0 ? INIT_SUCCEEDED : INIT_FAILED; + }