mql5/Experts/Examples/Math 3D/Math 3D.mq5

84 lines
6.8 KiB
MQL5

2025-08-05 01:57:33 -04:00
<EFBFBD><EFBFBD>//+------------------------------------------------------------------+
//| Math_3D.mq5 |
//| Copyright 2000-2025, MetaQuotes Ltd. |
//| https://www.mql5.com |
//+------------------------------------------------------------------+
#include "Functions.mqh"
#property optimization_chart_mode "3d,InpX,InpY"
//--- input parameters
sinput EnFunctionType InpFunction=Chomolungma;
input double InpX =0.0;
input double InpY =0.0;
//--- a pointer to the mathematical function
MathFunction ExtFunction;
//+------------------------------------------------------------------+
//| Expert initialization function |
//+------------------------------------------------------------------+
int OnInit()
{
//--- this EA is designed for optimization
if(!MQLInfoInteger(MQL_OPTIMIZATION))
{
MessageBox("This EA is designed for 3D visualization of optimization results\r\n\r\nRun this EA in the Strategy Tester using the Math Calculations mode!",
"EA warning", 0x00000030);
return(INIT_FAILED);
}
//---
return(INIT_SUCCEEDED);
}
//+------------------------------------------------------------------+
//| TesterInit function |
//+------------------------------------------------------------------+
int OnTesterInit()
{
//--- get a pointer to a mathematical function by its type
ExtFunction=GetMathFunction(InpFunction);
Print(__FUNCTION__, ": ExtFunction=", ExtFunction);
//--- variables to get values during optimization
double x_cur, x_start, x_stop, x_step;
double y_cur, y_start, y_stop, y_step;
bool x_enable, y_enable;