comparing account equity over time

 

hello..

please show me how i can get equity amount of previous time periods, like 5 mins intevals then store them in some kind of array. just for comparison purposes, something like   

double equity(int timeframe) {
   double result = accountinfodouble(ACCOUNT_EQUITY, timeframe);
   return result;
}

void compare() {
   int equityArray[];
   for(int 1 = 0; i < 5; i++) {
      equity[i] = equity(i);
   }
   if(equity[2] < equity[1]) {
      Print("IM KILLING IT BABY ");
   }
}
Improperly formatted code edited by moderator.

i used AccountInfoDouble() as an illustration. i know that it does take to parameters.

Thank you kindly. please advice.

 

Your topic has been moved to the section: Expert Advisors and Automated Trading
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893

Improperly formatted code edited by moderator. Please always use the CODE button (Alt-S) when inserting code.

Code button in editor

 
Cieadouu11: please show me how i can get equity amount of previous time periods, like 5 mins intevals then store them in some kind of array. just for comparison purposes, something like   

No directly possible! Equity is a current overall value. It is not associated with any symbol or time-frame, nor is any historical records kept for it.

You will need to keep track of it and store the data somewhere for later reference.

 
Cieadouu11:

hello..

please show me how i can get equity amount of previous time periods, like 5 mins intevals then store them in some kind of array. just for comparison purposes, something like   

Improperly formatted code edited by moderator.

i used AccountInfoDouble() as an illustration. i know that it does take to parameters.

Thank you kindly. please advice.

This article about R-squared metric shows how to do an equity listener if you use the standard CStrategy class from the library. Otherwise you can do it on your own, borrowing code from that class.

R-squared as an estimation of quality of the strategy balance curve - MQL5 Articles

R-squared as an estimation of quality of the strategy balance curve
R-squared as an estimation of quality of the strategy balance curve
  • www.mql5.com
This article describes the construction of the custom optimization criterion R-squared. This criterion can be used to estimate the quality of a strategy's balance curve and to select the most smoothly growing and stable strategies. The work discusses the principles of its construction and statistical methods used in estimation of properties and quality of this metric.