Expert Advisors • Indicators • Scripts • Libraries

MQL.RobotFX.org is the biggest collection of MetaTrader expert advisors (MT5 & MT4), indicators, scripts and libraries that can be used to improve trading results, minimize risks or simply automate trading tasks

Metatrader 4 Libraries | Z-Score Calculation | MQL5 Code

New free code from MQL5: indicators, EAs, and scripts for traders.

Image for Z-Score Calculation

  • Max - the maximum value;
  • Min - the minimum value;
  • universal mean - the mean value;
  • standard deviation - mean-squared deviation (unbiased estimate);
  • skew;
  • kurtosis;
  • Z-score on the data array.

You can find the description of the term of Z-score in the article Mathematics in Trading: How to Estimate Trade Results

The file should be placed in the folder of \MQL4\include\...

An exemplary script that calculates Z-score on a trading account:

//+------------------------------------------------------------------+
//|                                                        Get_Z.mq4 |
//|                      Copyright © 2007, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2007, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
 
#include <Z_include.mqh>
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   Print("Z-score of trades made on account ",AccountNumber()," is equal to ",DoubleToStr(getZ(),2));   
//----
   return(0);
  }
//+------------------------------------------------------------------+

The header file, NormalProbability.mq4, contains an example of normal probability using the array.

Capture price channel breakouts with the Price Channel Expert Advisor. Precise entries and exits. Explore now.

Build better strategies with RobotFX professional tools – check them out.

7452

Best MetaTrader Indicators + Profitable Expert Advisors