Try putting the code in your start() function, instead of init(). If this is a demo account you should not need to check the "allow live trading" box.

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
Hi I have recently downloaded a demo version of metatrader 4.0 (the Alpari edition). I've tried to run this simple program:
However the trade never opens, even though i've checked the 'Allow live trading' checkbox.
If I check the 'Ask manual confirmation' however, a box pops up and asks me if I want to trade.
How can I open trades from the code automatically?