Attached you will find the source code for a very basic EA.
There are comments in the start() routine to show you where to place your data acquisition code (iCustom(), iMA(), etc.) and where to add the logic you need to decide whether to buy or sell (or to do nothing).
The EA is written to trade on an "always in" basis and thus includes no logic to close a trade (other than the arrival of a trade in the opposite direction) so if you need specific close logic, add it yourself.
If you want to use take profit, copy the appropriate code used for stoploss in the PlaceBuy() and PlaceSell() routines and change it to do take profit instead.
Please post any questions here rather than by PM.
There are comments in the start() routine to show you where to place your data acquisition code (iCustom(), iMA(), etc.) and where to add the logic you need to decide whether to buy or sell (or to do nothing).
The EA is written to trade on an "always in" basis and thus includes no logic to close a trade (other than the arrival of a trade in the opposite direction) so if you need specific close logic, add it yourself.
If you want to use take profit, copy the appropriate code used for stoploss in the PlaceBuy() and PlaceSell() routines and change it to do take profit instead.
Please post any questions here rather than by PM.
Attached File(s)
Skeleton_EA.mq4
5 KB
|
391 downloads
Old Benjamin was right