I have developed an indicator that doesn't work properly. I highly appreciate if someone can fix it.
This indicators shows buy arrow (Up arrow) when the daily high is higher than the highest of last five days, and likewise, it shows Sell arrow ( Down arrow) when the daily low is lower than the lowest of last five days. It should keep the direction if the the daily high or low doesn't break the high or low of the last five days.
Here is the code:
iLow()
Returns Low price value for the bar of indicated symbol with timeframe and shift.
Meaning this is a double price value.
However,
iLowest()
Returns the shift of the lowest value over a specific number of bars depending on type.
Meaning this is an integer bar number, you still need to access the Low array to read the price value from that particular bar.
You are essentially saying:
if(Low[i] is < lower then the bar number from the Low Array that is containing the lowest value)
Which makes no sense at all.
Returns Low price value for the bar of indicated symbol with timeframe and shift.
Meaning this is a double price value.
However,
Returns the shift of the lowest value over a specific number of bars depending on type.
Meaning this is an integer bar number, you still need to access the Low array to read the price value from that particular bar.
You are essentially saying:
if(Low[i] is < lower then the bar number from the Low Array that is containing the lowest value)
Which makes no sense at all.
Thanks Marco for pointing out my dumb mistake :)
What if I say : (iLow(NULL,PERIOD_D1,i)<iLow(NULL,PERIOD_D1,iLowest(NULL,PERIOD_D1,MODE_LOW,j,i)))
Thanks Marco for pointing out my dumb mistake :)
What if I say : (iLow(NULL,PERIOD_D1,i)<iLow(NULL,PERIOD_D1,iLowest(NULL,PERIOD_D1,MODE_LOW,j,i)))
if(iLow(Symbol(),PERIOD_D1,i)<iLow(Symbol(),PERIOD_D1,iLowest(Symbol(),PERIOD_D1,MODE_LOW,WHOLE_ARRAY,0))) { //Do Something... }
I replaced the line into my code but unfortunately it didn't work. Any suggestion?!
Exactly what does not work ?
input int Period=6; //--- int start() { if(Bars<=100) return(0); static datetime buy,sell; int cb=IndicatorCounted(); int begin=(cb<1)?Bars-Period+1:Bars-cb; for(int i=begin;i>=0;i--) { if(sell!=Time[i] && iLow(NULL,PERIOD_D1,i)<iLow(NULL,PERIOD_D1,iLowest(NULL,PERIOD_D1,MODE_LOW,Period,i+1))) { buffSell[i]=High[i]+200*Point; sell=Time[i]; } else if(sell!=Time[i]) buffSell[i]=0.0; //--- if(buy!=time[i] && iHigh(NULL,PERIOD_D1,i)>iHigh(NULL,PERIOD_D1,iHighest(NULL,PERIOD_D1,MODE_HIGH,Period,i+1))) { buffBuy[i]=Low[i]-200*Point; buy=Time[i]; } else if(buy!=Time[i]) buffBuy[i]=0.0; } }
Thanks Ernst, as always, you fixed the code perfectly. The only issue is that on some bars that the high/low of the bar is not breaking out, the arrow is not being showed, while these type of bars should carry the previous direction of arrow either if it was Sell or Buy. I appreciate if you can fix this issue as well.
if(sell!=Time[i] && Low[i]<iLow(NULL,PERIOD_D1,iLowest(NULL,PERIOD_D1,MODE_LOW,Period-1,i+1))) { buffSell[i]=High[i]+200*Point; sell=Time[i]; } else if(sell!=Time[i]) buffSell[i]=0.0;

- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I have developed an indicator that doesn't work properly. I highly appreciate if someone can fix it.
This indicators shows buy arrow (Up arrow) when the daily high is higher than the highest of last five days, and likewise, it shows Sell arrow ( Down arrow) when the daily low is lower than the lowest of last five days. It should keep the direction if the the daily high or low doesn't break the high or low of the last five days.
Here is the code: