the first two lines:
double theHighest = close[iHighest(NULL,0,MODE_CLOSE,Depth,i)]; // <= close of the bar found double theLowest = close[iLowest(NULL,0,MODE_CLOSE,Depth,i)];
But instead of waiting for 2 hours or more why don't you write a simple script to check it out yourself?
That would take 5 min to get the result instead of 2 hours?
As Gooly says, but bear in mind that by using close, it is unclear from the documentation whether the default is set as series or not
So you should include
ArraySetAsSeries(close,true);
Before your code. Otherwise just use Open instead of open
the first two lines:
But instead of waiting for 2 hours or more why don't you write a simple script to check it out yourself?
That would take 5 min to get the result instead of 2 hours?
Thanks gooly. But it is not clear about "2 hours" , could you please explain more ?
Actually i am trying to create my own Zigzag indicator (modifying the default ZigZag indicator of MT4), which will get the CLOSE price of the bar (instead of High and Low of the bar).
Thanks
As Gooly says, but bear in mind that by using close, it is unclear from the documentation whether the default is set as series or not
So you should include
Before your code. Otherwise just use Open instead of open
Thanks GumRai. Do you mean using : time,open,high,low,close,tick_volume,volume,spread (found at OnCalculate function) need to set them as Series first,
while using "Close" or "iClose" , we do not need to set them as series?
Thanks GumRai. Do you mean using : time,open,high,low,close,tick_volume,volume,spread (found at OnCalculate function) need to set them as Series first,
while using "Close" or "iClose" , we do not need to set them as series?
Close (with the capital letter) etc are series arrays
but
from the documentation for OnCalculate
"To determine the indexing direction of time[], open[], high[], low[], close[], tick_volume[], volume[] and spread[], call ArrayGetAsSeries(). In order not to depend on default values, you should unconditionally call the ArraySetAsSeries() function for those arrays, which are expected to work with."
Close (with the capital letter) etc are series arrays
but
from the documentation for OnCalculate
"To determine the indexing direction of time[], open[],high[], low[], close[], tick_volume[], volume[] and spread[], call ArrayGetAsSeries(). In order notto depend on default values, you should unconditionally call the ArraySetAsSeries() function forthose arrays, which are expected to work with."
Taking advantage of this topic, I had a doubt earlier..
If I wish to spot some divergence with bollinger bands.. can it be done using this code?
double theHighest = Close[iHighest(NULL,0,MODE_CLOSE,Depth,i)]; //count the close for the past Depth bars double theHighestPast = Close[iHighest(NULL,0,MODE_CLOSE,Depth,i+Depth)]; //count the close for the past Depth bars before theHighest double BB = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,"how to specify that this is to count the last 'Depth' bars"); double BBPast = iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_UPPER,"how to specify that this is to count the 'Depth' previous than the last Depth bars"); if(theHighestPast>BBpast /* if closed out of the bands at some point between this time*/ && theHighest<=BB && theHighest>theHighestPast /*the last highest was higher than the previous and didnt close out of the bollinger bands*/)
I've checked to use the iBarShift() function, but not shure how it would fit in this..
Hi.
Can please someone paste the entire code here?
Some traders like myself doesn't have any knowledge about coding and doesn't know where to paste that characters in MetaEditor.
Thanks for understanding.
erborja: Can please someone paste the entire code here? Some traders like myself doesn't have any knowledge about coding and doesn't know where to paste that characters in MetaEditor.
|
|
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi,
We can get highest / lowest value of last Depth bar using (similar to MT4 Zigzag indicator) :
But how can we get the highest/lowest of the CLOSE price of each bar in the last Depth bars ? Which one from the code below is the right one ?
Thank you in advance.