CODE Help NEEDED

 

I am a new programmer,I have been able to write some code but instead of the EA to either buy or sell automatically, I only got alert of either buy or alert of sell whenever my trading conditions are met.

Also I tried to optimise and backtest it but with nothing. I would be glad if anybody can help me to make any necessary adjustment. Attached is the mq4.

Cheers!

 

Have you enabled live trading in the MT4 platform?

Look at the top right corner of the chart. Do you see:

- a smily face

- a sad face

- an x


CB

 
cloudbreaker:

Have you enabled live trading in the MT4 platform?

Look at the top right corner of the chart. Do you see:

- a smily face

- a sad face

- an x


CB

Yes I enabled live trading and there is smile face, but gives alert whenever the conditions are met.Also the backtest do not return anything whereas the code doesnt have any error or warnings when I compiled it.

 
What is output in the Experts and Journal tabs? CB
 

EA loaded successfully

Also EA optimisation has started when i tried to backtest/optimize it.

 

1. Start littering your code with Print() statements to show the contents of GetLastError() and your variables at key points, and to show which areas of your logic are being executed.

2. You're trying to close orders without first selecting them. That won't work.


CB

 

Pls can u kindly help me with the code to select order,I want the EA to only open 1 trade at a time and open an opposite when the 1st trade is close base on the condition on the two EMAs.

No order should be executed when either the takeprofit or stoploss is hit unless the entry condition is satisfied.

I would gladly appreciate it..cheers!

 

Just create a loop, descending the order pool starting at OrdersTotal()-1 and ending at 0 selecting each order by position in the pool using OrderSelect().

You can then check the criteria of your choice to decide whether to close the order with OrderClose().

Since you've managed to code all the stuff you posted in that file, you'll have no problem.

Consult the docs for the parameters you need to pass to OrderSelect().


CB

 
Tanx.
 

hi,


check this, if you need more help:

eaprogramming.co.cc

 
malyjan:

hi,


check this, if you need more help:

eaprogramming.co.cc

malyjan, I recommend u pm people and not spam this forum like so. U r just going to annoy everybody here. If u want to advertise your site, then add it to your profile and add it at the bottom of any appropriate non-spam message u post here. Good luck with your business.

Reason: