| / | Forum |
|
gomer
2008.11.25 00:35
Hello, I'm very new to MT4 and just wrote and compiled my first EA shown below. When I ran the program in demo mode, it worked and placed my order. However, it kept buying me orders, one after another. My expectation was that the EA would only be called once (I'm running it inside FXDD if that matters) and only one order would be placed. But it seemed to get called repeatedly. How can I cally me EA only once? Is there something I can put inside the start function that will only allow it to be called once? I'm not sure what init() and deinit() funtions are and why I'm returning zero at the end of the start function. Is there a setting inside FXDD that can make it only be called once. More logic will be added to this EA but basically, I'm looking to call the EA only once. Any help is much appreciated. Thanks. //+------------------------------------------------------------------+ //---- |
|
A Pattern Trailing Stop and Exit the Market Developers of order modification/closing algorithms suffer from an imperishable woe - how to compare results obtained by different methods? The mechanism of checking is well known - it is Strategy Tester. But how to make an EA to work equally for opening/closing orders? The article describes a tool that provides strong repetition of order openings that allows us to maintain a mathematically correct platform to compare the results of different algorithms for trailing stops and for exiting the market. |
|
abstract_mind
2008.11.25 00:55
Here is a simple solution. int start() ADVISE: There are many illustrative examples and demos of mql4 programs here in the forum, for which I recommend to start understand them. Using a tool without knowing it is a recipe for disaster. |
|
gomer
2008.11.25 00:58
abstract mind, thank you for your help, this will work. Thanks also for your advice. I am starting slowly and in demo mode for now. |
|
phy
2008.11.25 01:03
Save your EA as a script... Save into /experts/scripts recompile drag it from Navigator - Scripts onto the chart it will execute and exit. EA code is run on every tick. Script code is run once on demand. |
|
gomer
2008.11.25 01:27
phy, thanks so much great instructions. That is exactly what I was looking for.
|
|
ucheujah
2008.12.04 00:55
gomer wrote >>
Hello, I'm very new to MT4 and just wrote and compiled my first EA shown below. When I ran the program in demo mode, it worked and placed my order. However, it kept buying me orders, one after another. My expectation was that the EA would only be called once (I'm running it inside FXDD if that matters) and only one order would be placed. But it seemed to get called repeatedly. How can I cally me EA only once? Is there something I can put inside the start function that will only allow it to be called once? I'm not sure what init() and deinit() funtions are and why I'm returning zero at the end of the start function. Is there a setting inside FXDD that can make it only be called once. More logic will be added to this EA but basically, I'm looking to call the EA only once. Any help is much appreciated. Thanks. //+------------------------------------------------------------------+ //---- i sell a robot that i programed. it works perfectly well only when u follow my instructions. +2348036860370 |
|
ucheujah
2008.12.04 01:04
i sell a robot that i programed. it works perfectly well only when u follow my instructions. +2348036860370
|