not use equals , since it is not sure for double digital.
use last > and next <
or last < and next >
use last > and next <
or last < and next >
Yes, what DxdCn says: You cannot use == on two doubles - it doesn't work due to
the way doubles are stored on a computer. Use this:
if (MathAbs(PRICE_OPEN-iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,1))<Point)This checks if the distance (MathAbs(A-B)) is smaller than one point, e.g. they are the same.
PRICE_OPEN is a symbolic constant which is equal to 1 (see price constants in metaeditor).
To get opening price use Open[0] or Open[1] for previous open.
if (Open[0]==iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,1))
This will almost never happen since open hardly ever falls exactly on the band. to get open within couple of pips of band use
if (Open[0]==iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,1))
This will almost never happen since open hardly ever falls exactly on the band. to get open within couple of pips of band use
if (MathAbs(Open[1]-iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,1))<Point*3)as suggested above.
irusoh1:
PRICE_OPEN is a symbolic constant which is equal to 1 (see price constants in metaeditor). To get opening price use Open[0] or Open[1] for previous open.
if (Open[0]==iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,1))
This will almost never happen since open hardly ever falls exactly on the band. to get open within couple of pips of band use
PRICE_OPEN is a symbolic constant which is equal to 1 (see price constants in metaeditor). To get opening price use Open[0] or Open[1] for previous open.
if (Open[0]==iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,1))
This will almost never happen since open hardly ever falls exactly on the band. to get open within couple of pips of band use
if (MathAbs(Open[1]-iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,1))<Point*3)as suggested above.
thanks for all your responses... DxdCn, Thomas, and irusoh1.
didn't realize Price_Open is a symbolic constant equal to 1. So will try Open[0]
for current bar's opening price.
Question: what about the use of Bid? got a tip that Bid will give current Bid price
(not open but tick by tick).
thanks again!
ThomasB:
Yes it does. You can find it in the manual, by using the search on this site.
Sorry about not correcting the PRICE_OPEN mistake - didn't check that part, just copied it.
Yes it does. You can find it in the manual, by using the search on this site.
Sorry about not correcting the PRICE_OPEN mistake - didn't check that part, just copied it.
Thanks Thomas.
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
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
i am a newbie at EA programming and eager to become proficient and a contributing member.
i've read your posts and am most impressed with the comradery here.
was wondering if anyone could tell me what i am doing wrong in this line of code:
if (PRICE_OPEN==iBands(NULL,0,20,2,0,PRICE_CLOSE,MODE_LOWER,1))
-what i am testing: if current opening price equals the lower 20 bollinger band from the previous bar... then... next statemtent...
thanks in advance.
ps. please feel free to let me know of any post protocal errors. ..