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
It's work but now he trade on alls candle :/
I think the problem is my code, I had to change him because my manage order was under my order send .... So i had to keep him before
it's possible to send you my code by PM ? Just if I have not made a mistake?
I send you my code by PM for you see what i mean
ok a few pointers on coding:
- it is a good practice to make functions from the different parts of the code, this way you have a better overview of the code, and function call is easily swapped with and another one.
- always use proper indenting, this helps you keep track of all the curly brackets and makes the code better readable.
- don't nest when it is not really needed ( take a look at the if function in the for-loop I gave you. it simply calls continue (next iterator) so the rest of the code in the for-loop isn't nested)
- don't abuse the if ... else, in most cases you can set the default value and overwrite it on if condition (take a look at the else in your init() function , it is not needed )
- don't use variables on the global scope when they are only used in 1 function. If a value need to be kept in memory declare them static
- it is best to use curly brackets when your statement uses multiple lines, and leave them out when the whole statement is evaluated on a single line
now the problem
- you are using
total=OrdersTotal();
this won't work if you have multiple ea's running or maybe even multiple magicnumbers in one EA. so best make a counting function that always give you the correct data
LastBarTraded is set eventhough the OrderSend command could fail. You should check if your command was successful. Better check upfront if there is a new bar
example of a counting function.
Thank for your anwser and your advice, it's verry nice, because i m not a expert :/.
But now, how to forbid the ea to take a news order 3 hours after the last close ?
in buy condition, &&( TimeCurrent() >= OrderCloseTime()+3*360){ ?