//+------------------------------------------------------------------+
//|                                               StartScriptBox.mq4 |
//|               For educational purpose only, use on your own risk |
//|                             Coded by Georgebaker aka FXSniperGuy |
//|                                                 Date: 16.03.2023 |
//+------------------------------------------------------------------+
#import "rsfExpander.dll"
   bool LoadMqlProgramW(int hChart, int programType, string programName);
#import

#property copyright "Copyright 2022, MetaQuotes Software Corp."
#property link      "https://www.mql5.com"
#property version   "1.00"
#property strict
#property indicator_chart_window

// MQL program types
#define PROGRAMTYPE_INDICATOR   1
#define PROGRAMTYPE_EXPERT      2
#define PROGRAMTYPE_SCRIPT      4
//+------------------------------------------------------------------+
//| Custom indicator initialization function                         |
//+------------------------------------------------------------------+
int OnInit()
  {
//--- indicator buffers mapping
    int  hChart = WindowHandle(Symbol(), NULL);
   bool result = LoadMqlProgramW(hChart, PROGRAMTYPE_SCRIPT, "Box1");
   Print("result=", result);  
//---
   return(INIT_SUCCEEDED);
  }
//+------------------------------------------------------------------+
//| Custom indicator iteration function                              |
//+------------------------------------------------------------------+
int OnCalculate(const int rates_total,
                const int prev_calculated,
                const datetime &time[],
                const double &open[],
                const double &high[],
                const double &low[],
                const double &close[],
                const long &tick_volume[],
                const long &volume[],
                const int &spread[])
  {
//---

//--- return value of prev_calculated for next call
   return(rates_total);
  }
//+------------------------------------------------------------------+
