Help

 

I am trying to build an EA for MT3 in ZeroCode and need some assistance. I am building an advisor that puts in a trade when the 3 EMAs cross and exit when the 3 EMAs cross in the opposite direction or hit the stoploss, whichever comes First. Below is what my imputs are in ZeroCode except the exit on the crossover. Can someone help me whith this to program this as a reliable advisor:

BUY LOGISTICS

AND MA (1) Current > MA (2) Current

AND MA (2) Current > MA (3) Current

SELL LOGISTICS

AND MA (1) Current < MA (2) Current

AND MA (2) Current < MA (3) Current

Thank you

Todd

 

The expert put me into the USD/CHF when the 3 EMAs were not crossed.

 

Please clarify with screenshots. I'm not sure how exactly you think about 3 ema cross and 3 ema cross in opposite direction.

 

I have gone down to 2 moving averages, but it puts me in the wrong way or not at all. (attached)

Buy logics:

MA (1) Previous < MA (2) Previous

AND MA (1) Current > MA (2) Current

Sell logics:

MA (1) Previous > MA (2) Previous

AND MA (1) Current < MA (2) Current

Also I want it to exit the trade when the moving averages cross in the opposite direction. or when the take profit or trailing stop is hit, whichever comes first.

Thanks

 

the file type is only allowing 58kb but you will not be able to see it clearly. So I have attached the advisor.

 

finally figured it out

Files:
gbp.jpg  61 kb
chf.jpg  55 kb
journal.jpg  33 kb
 

Let me know what the problem is because I have 2 other advisors to build. And I will be willing to upload them for you and others to use.

 
Toddr:
I have gone down to 2 moving averages, but it puts me in the wrong way or not at all. (attached) Buy logics: MA (1) Previous MA (2) Current Sell logics: MA (1) Previous > MA (2) Previous AND MA (1) Current < MA (2) Current

The logics are ok. It should be working now. The mql you attached was not generated from above logics. The logics in the attached mql are opposite what you write here, so put above logics again, compile it to mql file, and overwrite the old expert file (or delete the old one first before copy the newly compiled mql).

Toddr:
Also I want it to exit the trade when the moving averages cross in the opposite direction. or when the take profit or trailing stop is hit, whichever comes first. Thanks
No need to do anything. Opposite trade is automatically closed before entering a new trade. If SL/TP is hit then the broker will close the trade for you automatically too.

 

I will try putting the proper logic in. Thanks for the quick responce.

As for the exit I am talking about exiting when the moving averages cross in the opposite direction (prevents whipsaws). Then putting me immediately into a trade in that direction. I have attached an example, and I hope that it explaines it clearly.

Files:
 

Toddr ,your trading style will bring you alot of money only when the market is really active:sweatdrop , but it can also kill you when the market is sideway . If you don't believe, please take a look the change of the moving everage, during the sideway market in "real time" . (Trust me , I have try this strategy before, in real time and manually )

 

I agree with Cartoon here, this strategy has been shown alot, the trick to this is to find out whent he market is sideways or active. There are some experts that are great for a sideways market and this is one of the experts who works well with the active market. I think this is key to being succesful in the market, find out how to switch between the two experts..

Reason: