Hello, is it possible to get the values of candle Where two pairs cross?
I have a overlay indicator, but i would like the intersection between them.
Thanks,
Danilo
Files:
IMG_2521.png
469 kb
Didn't compile or execute it yet. Just a try:
int FirstCross() { int BARS=Bars(_Symbol, PERIOD_CURRENT); for(int i=0;i<BARS-1;i++) { if(pair_cross(sym1, sym2, i)) { Print("Cross at bar="+(string) i); return i; } } } bool pair_cross(string sym1, string sym2, int index) { double close1_1=iClose(sym1, PERIOD_CURRENT, index); double close2_1=iClose(sym2, PERIOD_CURRENT, index); double close1_2=iClose(sym1, PERIOD_CURRENT, index+1); double close2_2=iClose(sym2, PERIOD_CURRENT, index+1); return (close1_1-close2_1)*(close1_2-close2_2)<0; }
Your topic has been moved to the section: MQL4 and MetaTrader 4
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
Please consider which section is most appropriate — https://www.mql5.com/en/forum/172166/page6#comment_49114893
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