104 lines
2.3 KiB
Plaintext
104 lines
2.3 KiB
Plaintext
///////////////////////////////////////////////////////
|
|
//
|
|
// SaherElm IT Center ??? Indicator
|
|
// ---------------------------------------------
|
|
// saherelm implementation of above indicator ...
|
|
//
|
|
// 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 ??? Indicator"
|
|
#property strict
|
|
|
|
//
|
|
// START Inputs ...
|
|
//
|
|
//
|
|
// END Inputs ...
|
|
//
|
|
|
|
//
|
|
// START Global Definitions: Variables, Properties and etc ...
|
|
//
|
|
#property indicator_chart_window
|
|
//
|
|
// END Global Definitions: Variables, Properties and etc ...
|
|
//
|
|
|
|
//
|
|
// Start Event Handlers ...
|
|
//
|
|
//
|
|
// Initialization ...
|
|
int OnInit() {
|
|
//
|
|
// Initialize what we want ...
|
|
|
|
//
|
|
return(INIT_SUCCEEDED);
|
|
}
|
|
|
|
//
|
|
// Calculating what we want ...
|
|
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 = MathMax(0, 0);
|
|
|
|
//
|
|
// 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 ...
|
|
|
|
//
|
|
}
|
|
|
|
//
|
|
return rates_total;
|
|
}
|
|
//
|
|
// END Event Handlers ...
|
|
//
|
|
|
|
//
|
|
// START Functions ...
|
|
//
|
|
//
|
|
// END Functions ...
|
|
// |