Welcome Forex EA downloads & MT4/MT5 auto-trading resources — EAs, Gold EAs, quant tools and real-world automation.
Sign In Sign Up

CEquityHstBar - MetaTrader 4 Library | MT4 EA Download - MetaTrader 4 Resources

author EAcpu | 5 reads | 0 comments |

CEquityHstBar - library for MetaTrader 4

CEquityHstBar is a library for displaying EA backtest equity on offline charts. This class is designed to write the equity data from the backtest to a .hst file and then display the equity on the offline chart.

The .hst file is located in the \tester folder, call CopyFile() to copy it to the history folder, then open it from File → Open Offline.

//+------------------------------------------------------------------+
//| test_EquityHstBar.mq4 |
//| Copyright 2017, fxMeter. |
//| https://www.mql5.com/en/users/fxmeter |
//+------------------------------------------------------------------+
#Property Copyright "Copyright 2017, fxMeter."
#Property associated with "https://www.mql5.com/en/users/fxmeter"
# Property version "1.00"
#propertystrict
#include //--- Create an instance CEquityHstBar ebar( "Equity Bar" , PERIOD_M30 ); //--- Or create an instance
// CEquityHstBar ebar;

Integer point = 1 ; //+----------------------------------------------------------------------------------+
//|Expert initialization function |
//+------------------------------------------------------------------+
Integer initialization ()
  { //--- if ( Number ()== 5 || Number == 3 ) point = 10 ; //--- Return ( initialization successful );
  } //+------------------------------------------------------------------+
//|Expert to initialize function |
//+------------------------------------------------------------------+
Blank solution initialization ( constant integer reason)
  { //--- ebar.SaveData();
   ebar.CopyFile();
  } //+------------------------------------------------------------------+
//|Expert check function |
//+------------------------------------------------------------------+
Blank check ()
  { //--- ebar.Update();

Stationary double stop loss = 20 ; // Static double stop profit = 30 ; //Point value integer tkt=- 1 ;
if ( total number of orders ()== 0 )
    {
if ( hour ()/ 2 == 0 ) tkt= order sent ( symbol (), 0 , 0.1 , ask , 10 , ask -stop-loss*pt* view , ask +take-profit*pt* view );
Other tkt = order sent ( symbol (), 1 , 0.1 , bid , 10 , bid + stop loss *pt* view , bid - take profit *pt* view );
    }
  } //+------------------------------------------------------------------+

quityHstBar - library for MetaTrader 4" style="max-width:100%">


Attachment download

📎 equityhstbar.mqh (15.28 KB)

📎 test_equityhstbar.mq4 (3.92 KB)

Source: MQL5 #19439

Verification code Refresh