Having periodic problems with my codes at times ,the code below doesnt work correctly, can someone help me out i am trying to detect if a candle is bearish or not
Having periodic problems with my codes at times ,the code below doesnt work correctly, can someone help me out i am trying to detect if a candle is bearish or not
Code:
Please, insert code correctly: when editing a post, click and paste your code in the popup window (the first time I edited your post and inserted the code correctly)
Your code bool isBearish(int index) { if(tradingTimePrices[index].open<tradingTimePrices[index].close) return true; return false; }
Simplified bool isBearish(int index) { return tradingTimePrices[index].open<tradingTimePrices[index].close; }
-
case 2: if(opens[index]<closes[index]) return true; break; case 1: if(opens[index] < closes[index]) return true;
No difference between case one and case two.
-
Where in OnTick to you call isBullish? Where is your new bar test? Where is your new bar test for multiple timeframes?
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
MT4: New candle - MQL4 programming forum #3 (2014)
MT5: Accessing variables - MQL4 programming forum #3 (2022)I disagree with making a new bar function, because it can only be called once per tick (second call returns false). A variable can be tested multiple times.
Running EA once at the start of each bar - MQL4 programming forum (2011)
Your code Simplified -
No difference between case one and case two.
-
Where in OnTick to you call isBullish? Where is your new bar test? Where is your new bar test for multiple timeframes?
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
MT4: New candle - MQL4 programming forum #3 (2014)
MT5: Accessing variables - MQL4 programming forum #3 (2022)I disagree with making a new bar function, because it can only be called once per tick (second call returns false). A variable can be tested multiple times.
Running EA once at the start of each bar - MQL4 programming forum (2011)William Roeder #:
Your code Simplified -
No difference between case one and case two.
-
Where in OnTick to you call isBullish? Where is your new bar test? Where is your new bar test for multiple timeframes?
For a new bar test, Bars is unreliable (a refresh/reconnect can change number of bars on chart), volume is unreliable (miss ticks), Price is unreliable (duplicate prices and The == operand. - MQL4 programming forum.) Always use time.
MT4: New candle - MQL4 programming forum #3 (2014)
MT5: Accessing variables - MQL4 programming forum #3 (2022)I disagree with making a new bar function, because it can only be called once per tick (second call returns false). A variable can be tested multiple times.
Running EA once at the start of each bar - MQL4 programming forum (2011)
thanks alot this solved it
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Having periodic problems with my codes at times ,the code below doesnt work correctly, can someone help me out i am trying to detect if a candle is bearish or not
Code: