Luandre Ezra: hmm becoming a little bit confuse here. what do you mean by calling it again on the same tick? In my code, did this means calling it again?
if(NewBar() && HAGreenCandleCurrentPeriod(1))
Alert("New Bar & Green Candle");
if(NewBar() && !HAGreenCandleCurrentPeriod(1))
Alert("New Bar & Red Candle");
Those are two separate functions calls. You fixed it in #4.
Ok so far I understand that it is better to use a variable than a function for dealing with the static datetime function. I'm adding a new condition for opening a position. my code is like this:
that code always return the it's sell and never says about buy. I assume it only works only on this line of code. From the previous code into this code there's not much different except checking if there's a open order by magic number and few new condition.
if((newBar &&
(HAGreenCandleHigherPeriod() && HAGreenCandleCurrentPeriod(1)) && //This seems to be checking if 2 bools are true
(HAGreenCandleCurrentPeriod(1) > EMACurrentTimeframe(1)) && //This is checking if a bool is larger than a double??????
(FuncMACDCrossOver(1) == 1 && (MACDFast(1) < 0 && MACDSlow(1) < 0)))
The code from Ernst (on previous page) is working but I don’t know why it’s not working after I add new condition. I will try to use your code and see if it works on my code.
if((newBar &&
(HAGreenCandleHigherPeriod() && HAGreenCandleCurrentPeriod(1)) && //This seems to be checking if 2 bools are true
(HAGreenCandleCurrentPeriod(1) > EMACurrentTimeframe(1)) && //This is checking if a bool is larger than a double??????
(FuncMACDCrossOver(1) == 1 && (MACDFast(1) < 0 && MACDSlow(1) < 0)))
I just realize it that I’m comparing the bool with double. That line should tell me wether the price is above the ema line. I think I’m to focus on that static datetime that I use the bool and not the price. Let me try your code if it works in my code.
The code from Ernst (on previous page) is working but I don’t know why it’s not working after I add new condition. I will try to use your code and see if it works on my code.
I just realize it that I’m comparing the bool with double. That line should tell me wether the price is above the ema line. I think I’m to focus on that static datetime that I use the bool and not the price. Let me try your code if it works in my code.
Hi already change the code and it works now. Thank you for your assist Keith
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Those are two separate functions calls. You fixed it in #4.
Ok so far I understand that it is better to use a variable than a function for dealing with the static datetime function. I'm adding a new condition for opening a position. my code is like this:
that code always return the it's sell and never says about buy. I assume it only works only on this line of code. From the previous code into this code there's not much different except checking if there's a open order by magic number and few new condition.
First of all, this does not detect a new bar.
This does
I'm confused.
The code from Ernst (on previous page) is working but I don’t know why it’s not working after I add new condition. I will try to use your code and see if it works on my code.
I just realize it that I’m comparing the bool with double. That line should tell me wether the price is above the ema line. I think I’m to focus on that static datetime that I use the bool and not the price. Let me try your code if it works in my code.The code from Ernst (on previous page) is working but I don’t know why it’s not working after I add new condition. I will try to use your code and see if it works on my code.
I just realize it that I’m comparing the bool with double. That line should tell me wether the price is above the ema line. I think I’m to focus on that static datetime that I use the bool and not the price. Let me try your code if it works in my code.Hi already change the code and it works now. Thank you for your assist Keith