Cross Counter MQL4
Winners786:
Hello Friends,
I am new to mql4 coding and learning from past 2 months.
I am trying to code MA cross counter. If MA50 cross above MA1000 then BUY CROSS =1 and same for below.
But the issue is Cross Counter increased by 1 on every tick.
Below is code. Please help me with this.
Thanks in Advance.
You need to hold back calculation until new bars are formed... add these lines before your "MyPoint=SetPairPipValue(Symbol());":
static datetime lastBarTime = 0; datetime currBarTime = iTime(Symbol(),Period(),1); if (currBarTime==lastBarTime) return (0);And
lastBarTime = currBarTime;
Before the final "return (0);".
Hello Friends,
I am new to mql4 coding and learning from past 2 months.
I am trying to code MA cross counter. If MA50 cross above MA1000 then BUY CROSS =1 and same for below.
But the issue is Cross Counter increased by 1 on every tick.
Below is code. Please help me with this.
Thanks in Advance.