how to identify which shift (or actual time) where the last fractal has been created by the indicator
In MQL 5 use this to find the last fractal high. IsNewBar detects a new bar.
int FracHnd; double LastFracHi; int LastFracHiBar; int OnInit() { FracHnd=iFractals(_Symbol,_Period); LastFracHi=0; return INIT_SUCCEEDED; } void OnTick() { static double buffer[1]; if(IsNewBar()) { LastFracHi=0; int count=1; for(int shift=2;shift<=30;shift++) { if(CopyBuffer(FracHnd,UPPER_LINE,shift,count,buffer)!=count) { Print("CopyBuffer error ",_LastError); ExpertRemove(); return; } if(buffer[0]==iHigh(_Symbol,_Period,shift) { LastFracHi=buffer[0]; LastFracHiBar=shift; break; } } } ... }
lippmaje: In MQL 5 use this to find the last fractal high.
if(CopyBuffer(FracHnd,MAIN_LINE,shift,count,buffer)!=count)
Nope. Perhaps you should read the manual.
The buffer numbers are the following: 0 - UPPER_LINE, 1 -
LOWER_LINE.
Technical Indicators / iFractals - Reference on algorithmic/automated trading language for MetaTrader 5
Technical Indicators / iFractals - Reference on algorithmic/automated trading language for MetaTrader 5
William Roeder:
thanks!
Nope. Perhaps you should read the manual.
rcmw:
Thank you guys! So I can get the high/low value and shift of the fractal buffer from the code above. However, what do I need to do in order to pull the date time value of the shift where fractal has occurred?
Nevermind. I figured this out already. Thanks!
Thank you guys! So I can get the high/low value and shift of the fractal buffer from the code above. However, what do I need to do in order to pull the date time value of the shift where fractal has occurred?
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'm trying to reference fractal values (fractal up/down) to identifying where they are in the price chart historically.
iFractal() function only takes two parameters (Symbol & timeframe) so I'm not sure how to identify the indicator buffers from that. Any thoughts?