You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I try to complete your jobs, it's very useful to hold indicator values in object-oriented style rather than MT4 indicator buffers.
But I have a differend idea for under data structure, I prefer the linked list rather than dynamic array because performance issue.
my ideas:
class IndicatorBuffer is an abstract for data buffer implemented by double linked list. Implementation with Dynamic array (with ArrayResize) has performance issue. EA slow down rapidly as data grows because ArraySetAsSeries +ArrayResize will move data in memory.
IndicatorBuffer always keep the list sorted according to bar time, the newer value insert to head. so there is a head pointer.
when IndicatorBuffer grows to max_size, the limit of buffer capacity, IndicatorBuffer discard oldest value, so there is a tail pointer and double linked way.
class Indicator is an abstract for multi-buffer indicator. It has a array of IndicatorBuffer and the length of array is determined by second parameter to constructor.
Add(double) and Add(int) adaptive to data type and store in corresponding field of MqlParam. GetDouble(mode) and GetInt(mode) search list from head pointer and return right value and proper type.
Passing indicator name as string to constructor, not enum defined in Indicator class, will keep flexibility and isolated.
ToString() display last n values in buffers, default n=3.
Indicator.mq4 is a demo to demonstrate how to use the base class to implement a customize indicator, and show the value on MT4 chart. Place Indicator.mq4 in Indicators directory manually.
The text was updated successfully, but these errors were encountered:
janckerchen
changed the title
Hold indicator value in EA31337 class, I have implement it and create a pull request.
Hold indicator value in EA31337 class, I have implemented it and create a pull request.
May 2, 2017
kenorb
changed the title
Hold indicator value in EA31337 class, I have implemented it and create a pull request.
Class to hold indicator values
Jun 17, 2019
I try to complete your jobs, it's very useful to hold indicator values in object-oriented style rather than MT4 indicator buffers.
But I have a differend idea for under data structure, I prefer the linked list rather than dynamic array because performance issue.
my ideas:
class IndicatorBuffer is an abstract for data buffer implemented by double linked list. Implementation with Dynamic array (with ArrayResize) has performance issue. EA slow down rapidly as data grows because ArraySetAsSeries +ArrayResize will move data in memory.
IndicatorBuffer always keep the list sorted according to bar time, the newer value insert to head. so there is a head pointer.
when IndicatorBuffer grows to max_size, the limit of buffer capacity, IndicatorBuffer discard oldest value, so there is a tail pointer and double linked way.
class Indicator is an abstract for multi-buffer indicator. It has a array of IndicatorBuffer and the length of array is determined by second parameter to constructor.
Add(double) and Add(int) adaptive to data type and store in corresponding field of MqlParam. GetDouble(mode) and GetInt(mode) search list from head pointer and return right value and proper type.
Passing indicator name as string to constructor, not enum defined in Indicator class, will keep flexibility and isolated.
ToString() display last n values in buffers, default n=3.
Indicator.mq4 is a demo to demonstrate how to use the base class to implement a customize indicator, and show the value on MT4 chart. Place Indicator.mq4 in
Indicators
directory manually.pull request #22
The text was updated successfully, but these errors were encountered: