MQL5 Functions not returning values!!

 

Hi there!,, 

I have been testing and returning few small MQL5 functions.. but none are returning any values!..

eg. Such as Signal info, and History Transactions/Deals.


    double totalDeposits = 0.0;
    double totalWithdrawals = 0.0;

   // int totalDeals = HistoryOrdersTotal();
    int totalDeals = HistoryDealsTotal();
    //for (int i = 0; i < totalDeals; i++)
    for(int i=totalDeals-1;i>=0;i--)
    {
     Print("History Detected!!");
         ulong ticket=HistoryDealGetTicket(i);
         if(ticket==0)
           {
            Print("HistoryDealGetTicket failed, no trade history");
            break;
           }
        ulong dealTicket = HistoryDealGetTicket(i);
        long dealType = HistoryDealGetInteger(dealTicket, DEAL_TYPE);
        long dealEntry = HistoryDealGetInteger(dealTicket, DEAL_ENTRY);
     
        
     if(dealType==DEAL_TYPE_BALANCE)
       { 
      // if (dealEntry == DEAL_ENTRY_IN) // Check for deposits
        {
            double dealAmount = HistoryDealGetDouble(dealTicket, DEAL_PROFIT);
            totalDeposits += dealAmount;
        }
       // else if (dealEntry == DEAL_ENTRY_OUT) // Check for withdrawals
        {
            double dealAmount = HistoryDealGetDouble(dealTicket, DEAL_PROFIT);
            totalWithdrawals += dealAmount;
        }
       }
    }
string Transfers;
string Sub;
string Connected;
double Percent;//=SIGNAL_INFO_VOLUME_PERCENT;
    Transfers=DoubleToString(totalDeposits+totalWithdrawals,2);
    // Get the signal ID
    long signalID = SignalBaseGetInteger(SIGNAL_BASE_ID);
    if (signalID > 0) Sub="OK";
    else Sub="No";
    //Terminal Connected
    if(TerminalInfoInteger(TERMINAL_CONNECTED)) Connected="OK";
    else Connected="Error";

    double myBalance = AccountInfoDouble(ACCOUNT_BALANCE);
    double SignalBalance = SignalBaseGetDouble(SIGNAL_BASE_BALANCE);
    double s_maxDD=SignalBaseGetDouble(SIGNAL_BASE_MAX_DRAWDOWN);
    double s_Price=SignalBaseGetDouble(SIGNAL_BASE_PRICE);
    double s_ROI=SignalBaseGetDouble(SIGNAL_BASE_ROI);
    double s_Gain=SignalBaseGetDouble(SIGNAL_BASE_GAIN);
    long    s_Pips=SignalBaseGetInteger(SIGNAL_BASE_PIPS);
    long    s_Trades=SignalBaseGetInteger(SIGNAL_BASE_TRADES);
    string s_Currency=SignalBaseGetString(SIGNAL_BASE_CURRENCY);
    string s_Name=SignalBaseGetString(SIGNAL_BASE_NAME);
    
    if (SignalBalance != 0)
    {
        Percent = NormalizeDouble((myBalance / SignalBalance) * 100,2);
        Print("My balance is ", Percent, "% of Signal balance.");
    }
    else
    {
        Print("Signal's balance is zero, cannot calculate percentage.");
    }

All of signalinfo(SignalBaseGetDouble(),.. etc) returns Nothing!..

Any advice or solution pls..

 
Abubakar Abu Saidu: All of signalinfo(SignalBaseGetDouble(),.. etc) returns Nothing!..
SignalBaseGetDouble

Returns the value of double type property for selected signal.

Where do you first call SignalBaseSelect?

Documentation on MQL5: Language Basics / Data Types / Real Types (double, float)
Documentation on MQL5: Language Basics / Data Types / Real Types (double, float)
  • www.mql5.com
Real types (or floating-point types) represent values with a fractional part. In the MQL5 language there are two types for floating point numbers...
 
William Roeder #:

Where do you first call SignalBaseSelect?

Ah.. thanks.. this solved it!.

but the main headache is the HistoryTotal!

 
Abubakar Abu Saidu #:

Ah.. thanks.. this solved it!.

but the main headache is the HistoryTotal!

You also don't select the history. Please read the documentation !
 
Alain Verleyen #:
You also don't select the history. Please read the documentation !

Okay thanks.. looking into it!

 
Abubakar Abu Saidu:

Hi there!,, 

I have been testing and returning few small MQL5 functions.. but none are returning any values!..

eg. Such as Signal info, and History Transactions/Deals.


All of signalinfo(SignalBaseGetDouble(),.. etc) returns Nothing!..

Any advice or solution pls..

HistorySelect(from, to); 
 
Chioma Obunadike #:

Thank you!!!

 

Does "SignalBaseTotal()'" not supposed to return total orders on MT5?

It returns and works fine on MT4.. but not MT5.

am i missing something?

   int total=SignalBaseTotal();
   Print("Total Signal=="+IntegerToString(SignalBaseTotal()));

Returns 0 on MT5.. 


Returns 1000 on MT4


Abubakar Abu Saidu
Abubakar Abu Saidu
  • www.mql5.com
Trader's profile