mirror of
https://github.com/softwaredevelop/mql5.git
synced 2026-08-21 08:18:07 +00:00
refactor(indicators): Integrated with CMO Engine
This commit is contained in:
@@ -13,7 +13,7 @@
|
|||||||
#property indicator_type1 DRAW_LINE
|
#property indicator_type1 DRAW_LINE
|
||||||
#property indicator_color1 clrRed
|
#property indicator_color1 clrRed
|
||||||
#property indicator_style1 STYLE_SOLID
|
#property indicator_style1 STYLE_SOLID
|
||||||
#property indicator_width1 1
|
#property indicator_width1 2
|
||||||
#property indicator_label1 "VIDYA"
|
#property indicator_label1 "VIDYA"
|
||||||
|
|
||||||
#include <MyIncludes\VIDYA_Calculator.mqh>
|
#include <MyIncludes\VIDYA_Calculator.mqh>
|
||||||
@@ -25,8 +25,6 @@ input ENUM_APPLIED_PRICE_HA_ALL InpSourcePrice = PRICE_CLOSE_STD;
|
|||||||
double BufferVIDYA[];
|
double BufferVIDYA[];
|
||||||
CVIDYACalculator *g_calculator;
|
CVIDYACalculator *g_calculator;
|
||||||
|
|
||||||
//+------------------------------------------------------------------+
|
|
||||||
//| |
|
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
int OnInit()
|
int OnInit()
|
||||||
{
|
{
|
||||||
@@ -52,11 +50,9 @@ int OnInit()
|
|||||||
|
|
||||||
void OnDeinit(const int reason) { if(CheckPointer(g_calculator) != POINTER_INVALID) delete g_calculator; }
|
void OnDeinit(const int reason) { if(CheckPointer(g_calculator) != POINTER_INVALID) delete g_calculator; }
|
||||||
|
|
||||||
//+------------------------------------------------------------------+
|
|
||||||
//| Custom indicator calculation function |
|
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
int OnCalculate(const int rates_total,
|
int OnCalculate(const int rates_total,
|
||||||
const int prev_calculated, // <--- Now used!
|
const int prev_calculated,
|
||||||
const datetime &time[],
|
const datetime &time[],
|
||||||
const double &open[],
|
const double &open[],
|
||||||
const double &high[],
|
const double &high[],
|
||||||
@@ -75,9 +71,9 @@ int OnCalculate(const int rates_total,
|
|||||||
else
|
else
|
||||||
price_type = (ENUM_APPLIED_PRICE)InpSourcePrice;
|
price_type = (ENUM_APPLIED_PRICE)InpSourcePrice;
|
||||||
|
|
||||||
//--- Delegate calculation with prev_calculated optimization
|
|
||||||
g_calculator.Calculate(rates_total, prev_calculated, price_type, open, high, low, close, BufferVIDYA);
|
g_calculator.Calculate(rates_total, prev_calculated, price_type, open, high, low, close, BufferVIDYA);
|
||||||
|
|
||||||
return(rates_total);
|
return(rates_total);
|
||||||
}
|
}
|
||||||
//+------------------------------------------------------------------+
|
//+------------------------------------------------------------------+
|
||||||
|
//+------------------------------------------------------------------+
|
||||||
|
|||||||
Reference in New Issue
Block a user