v mail:
I wrote this simple code with your function to see that the expert waits as long as two candlesticks but it did not work
if(Open[1]<=Open[2] || Open[1]>=Open[2] )
How can this ever be anything but true?
v mail: in my code first if run without problem and i want 2candle wait for run second if but second if never run
waiting=TimeCurrent(); return; if(iBarShift(_Symbol,PERIOD_CURRENT, waiting) == 2) { Comment(Close[2]); } }
Of course, it never runs — no code ever will after the return.
int num=0; ⋮ num++; if(num==0)If it is initially zero and you increment it, when will that test ever be true?
William Roeder:
If it is initially zero and you increment it, when will that test ever be true?
If it is initially zero and you increment it, when will that test ever be true?
thank you
I wrote code below and it's working.
int num=0; ⋮ num++; if(num==1){num++; waiting=Time[0]; return;} if(iBarShift(_Symbol,PERIOD_CURRENT, waiting) == 2)
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 checked the closing price of two candles 1 and 2, then I want expert wait for two Candle Appear then check the closing price of candles x and x 1.
Candle X And X+1 Still Not Exist(I Attached an Image)
I Found NewBar() Function that force expert to run only on each new bar and found WaitXBars() Function that force expert to wait x bars.
but not working. maybe I should use another method.