147 lines
3.0 KiB
Plaintext
147 lines
3.0 KiB
Plaintext
/////////////////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center OSC EA Panel ...
|
|
// -------------------------------------------------------------
|
|
// this is an Oscillator for Panel Providing on OSC EA ...
|
|
//
|
|
// Maintainer:
|
|
// ------------
|
|
// Hadi Khazaee Asl (hadi_khazaee_asl@yahoo.com)
|
|
//
|
|
////////////////////////////////////////////////////////////////
|
|
//
|
|
// Global Properties ...
|
|
#property copyright "Copyright 2023, SaherElm IT Center"
|
|
#property link "https://saherelm.ir"
|
|
#property version "1.00"
|
|
#property description "SaherElm OSC Indicator"
|
|
#property strict
|
|
|
|
//
|
|
// START Inputs ...
|
|
//
|
|
//
|
|
// END Inputs ...
|
|
//
|
|
|
|
//
|
|
// START Global Definitions: Variables, Properties and etc ...
|
|
//
|
|
//
|
|
// Includes our shared library ...
|
|
#include "../Libraries/x-saherelm.lib.mq4"
|
|
|
|
//
|
|
#property indicator_separate_window
|
|
#property indicator_buffers 0
|
|
#property indicator_minimum 0.0
|
|
#property indicator_maximum 0.0
|
|
#include "../Include/PanelDialog.mqh"
|
|
|
|
//
|
|
// Define a Dialog Instance ...
|
|
// CPanelDialog dialog;
|
|
|
|
//
|
|
// here we specify logging enabled or not ...
|
|
bool enableLogging = true;
|
|
|
|
//
|
|
// this is a Tag which attached to our Logger ...
|
|
string logTag = "XS_OSC_PANEL";
|
|
//
|
|
// END Global Definitions: Variables, Properties and etc ...
|
|
//
|
|
|
|
//
|
|
// Start Event Handlers ...
|
|
//
|
|
//
|
|
// Initialization ...
|
|
int OnInit() {
|
|
//
|
|
// Initialize what we want ...
|
|
|
|
//
|
|
// Validating Input Parameters ...
|
|
// if (
|
|
// ) {
|
|
// return INIT_PARAMETERS_INCORRECT;
|
|
// }
|
|
|
|
//
|
|
// Set Buffers ...
|
|
|
|
//
|
|
return(INIT_SUCCEEDED);
|
|
}
|
|
|
|
//
|
|
// Do Calculation ...
|
|
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[]
|
|
) {
|
|
//
|
|
// this counts Available Bars ...
|
|
int limit;
|
|
|
|
//
|
|
// because in some cases we may have more than one input for
|
|
// calculation and we must prevent any calculation
|
|
// untill we pass the biggest input length, here we get max Input length
|
|
// and then wait until pass it ...
|
|
int maxLength = 0; // MathMax(fastOSCLength, slowOSCLength);
|
|
|
|
//
|
|
// input variable, we return 0 means nothing passed ...
|
|
if (rates_total < maxLength) {
|
|
return 0;
|
|
}
|
|
|
|
//
|
|
// found which candles calculated before ...
|
|
limit = (prev_calculated == 0) ? rates_total - maxLength - 1 : rates_total - prev_calculated + 1;
|
|
|
|
//
|
|
// this is the main loop of calculations, for each bar index ...
|
|
for (int i = limit - 1; i >= 0; i--) {
|
|
//
|
|
// Start Calculation here ...
|
|
// i is bar_index ...
|
|
|
|
//
|
|
CalculatePanel(i);
|
|
}
|
|
|
|
//
|
|
return rates_total;
|
|
}
|
|
|
|
//
|
|
// De Initialization ...
|
|
void OnDeinit(const int reason) {
|
|
}
|
|
//
|
|
// END Event Handlers ...
|
|
//
|
|
|
|
//
|
|
// START Functions ...
|
|
//
|
|
//
|
|
void CalculatePanel(
|
|
const int &bar_index
|
|
) {
|
|
}
|
|
//
|
|
// END Functions ...
|
|
// |