lucaskoster:
I am trying to include my indicator within my EA
Above code example gives me output 3 , 1, 0 where I am expecting 3, 2, 1. Am I missing something here?
-
Don't try to do that. There are no buffers, no IndicatorCounted() or prev_calculated. No way to know if older bars have changed or been added (history update.)
Just get the value(s) of the indicator(s) into EA/indicator (using iCustom) and do what you want with it.
- Normally, set your indexing direction before you initialize the array.
Code [0] [1] [2] Non-series=default;Resize(2);ar[0]=1;ar[1]=2 1 2 Does not exist AsSeries 2 1 Does not exist Resize(3) 2 1 random ar[0]=3 3 1 random What I think what you are trying to do is make a stack (insert new zero, shift rest). On MT4:
template <typename Datatype> bool resize_buffer(Datatype& deque[], ///<[in,out] The deque. COUNT nRows){ // This enlarges the arr and shifts values B[2]=B[1]; B[1]=B[0]; B[0]=prob 0. bool isSeries = ArrayGetAsSeries(deque); ArraySetAsSeries(deque, !isSeries); if(ArrayResize(deque, nRows) <= 0) return false; ArraySetAsSeries(deque, isSeries); return true; }
You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi All,
I am trying to include my indicator within my EA but am facing some issues with timeserie arrays. I have created arrays and set them as timeserie but when resizing this is still adding new elements to the end of the array, I was expecting when resizing a timeserie to have new elements added to the front of the array?
Above code example gives me output 3 , 1, 0 where I am expecting 3, 2, 1. Am I missing something here?
Thnx