Hi, i need a help.... This is my first EA and i am a beginner...
can anyone help me to put Trailing stop for my EA ... i tried many ways but trailing stop is not activating when i am putting it on strategy tester... please help...
this is my full EA(based on CCI for H4 and Daily TF, preferably GBPJPY) , MT4 :
Are you writing a indicator of an expert?
For indicators can not order or modify and close orders.
I do not see any OrderModify () function in your code so i am not sure how you want it to work?
I don't know if this will work for you or not. I'm sure there is no errors in my code as I used it too many times ...
What I did ?
- Added 2 functions (trailing stop code for Buy orders, trailing stop code for Sell orders, Order modify function for SL).
- As you use 2 different magic numbers, I put them in the external settings to get use the trailing stop function the right way.
- changed "extern" to "input" ... Will not effect the code, but only to make you get used to the new language commands.
- Added EA_Name.
- Added SL value.
If the EA will not work, sure you got something else you have to correct. I'm sorry, I can't trace your code as it is not
my coding style :( ....
My advice to you ... Always try to get used to divide your code to many parts (Functions) ... Each part serve a part of the problem.
This will make coding more clear, easy, less errors, easy to trace, any body can understand, you can modify easily, and the most
important is that these functions will serve you in other codes to make easier and faster EAs :)
Good luck ...
I know, this is the old code from 2009, I've learn this code, the fault is in Point on the init() function.
Replace the init() function with