Hi everyone.
I don't know how to express my problem.
I managed to get the value of the last candle called LastCandleNb.
if it is >0 then bullish candle.
if <0 then bearish candle.
I can do it live.
But I would like to improve the function. to call it in the code more easily. like. (and make it a .mqh, if possible)
LastCandle = bullish candle or bearish candle
of course, depending on LastCandleNb < or > 0.
I just have to do
But impossible to find a formulation without error.
Thanks a lot.
Before you get any answer, you have to inform us about the LastCandleNb ?
what you mean by that " LastCandleNb "? is it a fixed variable, runtime value or a function which return a number... ?
otherwise, no one can understand what you want!
Adding screenshot(s) could help reader to give a good answer
Before you get any answer, you have to inform us about the LastCandleNb ?
what you mean by that " LastCandleNb "? is it a fixed variable, runtime value or a function which return a number... ?
otherwise, no one can understand what you want!
Adding screenshot(s) could help reader to give a good answer
Hello,
thank you Mohammed for your answer!
Yes of course, sorry, I hadn't thought about it
i use:
#define LastCandleNb iClose(_Symbol,PERIOD_CURRENT,1)-iOpen(_Symbol,PERIOD_CURRENT,1)
Hello,
thank you Mohammed for your answer!
Yes of course, sorry, I hadn't thought about it
i use:
Hello you can define the candle number in the definition as well :
#define LastCandleNB(int) ((iClose(_Symbol,_Period,int)-iOpen(_Symbol,_Period,int))/_Point)>0.0?1:-1 /* explanation if the Close minus the Open at int location is bigger than 0 then return 1 otherwise -1 */
- www.mql5.com
Hello Lorentzos,
thank for your answers.
I didn't really understand why, but it's a great update! more clear..
Now, i have :
LastCandleNb = 1 or -1
But, can you direct me to,
I would like to have
LastCandle = BuyCandle / or / SellCandle.
in fact I want to call directly in my ea.
Comment(LastCandle)
and that it shows me
BuyCandle or SellCandle
but I don't see how to have LastCandle with 2 possibilities.
thank you all for your help
Hello Lorentzos,
thank for your answers.
I didn't really understand why, but it's a great update! more clear..
Now, i have :
But, can you direct me to,
I would like to have
LastCandle = BuyCandle / or / SellCandle.
in fact I want to call directly in my ea.
and that it shows me
but I don't see how to have LastCandle with 2 possibilities.
thank you all for your help
You can return a string in the ternary operator too , like this :
#define LastCandleNB(int) (iClose(_Symbol,_Period,int)>=iOpen(_Symbol,_Period,int))?"BuyCandle":"SellCandle"
It checks is the Close >= Open ? if yes return BuyCandle if not return SellCandle
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi everyone.
I don't know how to express my problem.
I managed to get the value of the last candle called LastCandleNb.
if it is >0 then bullish candle.
if <0 then bearish candle.
I can do it live.
But I would like to improve the function. to call it in the code more easily. like. (and make it a .mqh, if possible)
LastCandle = bullish candle or bearish candle
of course, depending on LastCandleNb < or > 0.
I just have to do
But impossible to find a formulation without error.
Thanks a lot.