55 lines
2.5 KiB
MQL5
55 lines
2.5 KiB
MQL5
//+------------------------------------------------------------------+
| |||
//| ONNX Model Viewer Part 3.mq5 |
| |||
//| Copyright 2026, Allan Munene Mutiiria. |
| |||
//| https://t.me/Forex_Algo_Trader |
| |||
//+------------------------------------------------------------------+
| |||
#property copyright "Copyright 2026, Allan Munene Mutiiria."
| |||
#property link "https://t.me/Forex_Algo_Trader"
| |||
#property version "1.00"
| |||
#property strict
| |||
#property description "Draw an ONNX model graph on the chart"
| |||
| |||
#include "OMV Panel.mqh"
| |||
| |||
//+------------------------------------------------------------------+
| |||
//| Inputs |
| |||
//+------------------------------------------------------------------+
| |||
input group "Model"
| |||
input string ModelFile = "ONNX Model Viewer\\model.onnx"; // Model File Path Inside MQL5 Files
| |||
| |||
//+------------------------------------------------------------------+
| |||
//| Global Variables |
| |||
//+------------------------------------------------------------------+
| |||
COmvPanel panel; // Owns the canvas, the parsed model and the event routing
| |||
| |||
//+------------------------------------------------------------------+
| |||
//| Expert initialization function |
| |||
//+------------------------------------------------------------------+
| |||
int OnInit()
| |||
{
| |||
//--- Build the panel and read the model into it
| |||
if(!panel.Init(ChartID(), ModelFile))
| |||
return(INIT_FAILED);
| |||
return(INIT_SUCCEEDED);
| |||
}
| |||
| |||
//+------------------------------------------------------------------+
| |||
//| Expert deinitialization function |
| |||
//+------------------------------------------------------------------+
| |||
void OnDeinit(const int reason)
| |||
{
| |||
//--- Release the canvas and restore the chart
| |||
panel.Destroy();
| |||
ChartRedraw();
| |||
}
| |||
| |||
//+------------------------------------------------------------------+
| |||
//| ChartEvent function |
| |||
//+------------------------------------------------------------------+
| |||
void OnChartEvent(const int id, const long &lparam, const double &dparam, const string &sparam)
| |||
{
| |||
//--- Route hover, drag and click into the panel
| |||
panel.OnEvent(id, lparam, dparam, sparam);
| |||
}
| |||
//+------------------------------------------------------------------+
| |||
//+------------------------------------------------------------------+
|