I don't know for a fact . . . but is this legitimate ? have you tested it ?
CloseEMA < FastEMA < SlowEMA
RaptorUK:
I don't know for a fact . . . but is this legitimate ? have you tested it ?
What do you mean by you last comment? I have tested it over the past month 5min chart and it only makes one trade. Opens short and then closes next tick.
I mean have you specifically tested this to see if it actually gives the result you are looking for ?
CloseEMA < FastEMA < SlowEMA
What I'm getting at is this code the same as . . .
CloseEMA < FastEMA && FastEMA < SlowEMA
or the same as . . .
(CloseEMA < FastEMA) < SlowEMA or maybe . . . CloseEMA < (FastEMA < SlowEMA)
RaptorUK:
I mean have you specifically tested this to see if it actually gives the result you are looking for ?
I dont know how to only test only one line of code. I only know how to make alerts to see if it returns a value I want when its trading live.
i will run back tests to see if your suggestions help
still no luck :(
It's more of a question than a suggestion . . I don't know the answer myself . . . you could use a print statement or two and see what they show.
Print("CloseEMA= ",CloseEMA, " FastEMA= ",FastEMA, " SlowEMA= ",SlowEMA); Print(CloseEMA < FastEMA < SlowEMA);
Shouldn't you actually set BuyTicket = 0 when you actually close the current Buy order or it hits it's SL ? Similar for SellTicket = 0 . . .

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
This is my first program in MQL4. I am just trying to learn the basics but continue to get hung up on little things. I was hoping that someone might be willing to help.
The strategy for this ea is as follows
OpenLong: 10EMA>20EMA, K Stoch >D Stoch, ADX >= 20, and there is not already an open long order
CloseLong: 5EMA < 10EMA or ADX <20
The reason I have the reset in the code is because without it, during back test I get a series of about 30 trade that open and close with each tick, driving my account balance into the ground.
OpenClose: 10EMA < 20EMA, K Stoch < D Stoch, and ADX >=20, and there is not already an open short order.
Close Long: 5EMA > 10EMA or ADX <20
The reason I have the reset in the code is because without it, during back test I get a series of about 30 trade that open and close with each tick, driving my account balance into the ground.
The code is below:
Thank you to those who help
ZH