Hi Guys,
Sorry if it should be posted in another forum. I started learning programming on mql5 recently and already made 3 simple EAs... but stuck with a little problem now. See my code:
<CODE DELETED>
Basically, my goal is to move SL towards profit if the difference between SL and current price increases. Problem is that it works only once. SL gets adjusted and then seems like stay unchanged no matter what happens. Did I miss anything?
Oh Sorry, surely will do next time!
Oh Sorry, surely will do next time!
Why next time, please edit your post.
The OP can't after there has been a reply.
Hi Guys,
Sorry if it should be posted in another forum. I started learning programming on mql5 recently and already made 3 simple EAs... but stuck with a little problem now. See my code:
Basically, my goal is to move SL towards profit if the difference between SL and current price increases. Problem is that it works only once. SL gets adjusted and then seems like stay unchanged no matter what happens. Did I miss anything?
Thanks for your responses and good luck.
- What are the values of profit, sl, stoploss ?
- Try to put your print statement outside the if statement.
Thanks everyone for your help, I am happy to tell that I looked at my code this morning with a fresh state of mind and found the problem: tick.bid! I was reading values for tick only at the time when I send my initial order, then is was staying without change. Now I read tick data on every tick.
Very simple error though... don't code at 3am :D
Good luck
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Hi Guys,
Sorry if it should be posted in another forum. I started learning programming on mql5 recently and already made 3 simple EAs... but stuck with a little problem now. See my code:
Basically, my goal is to move SL towards profit if the difference between SL and current price increases. Problem is that it works only once. SL gets adjusted and then seems like stay unchanged no matter what happens. Did I miss anything?
Thanks for your responses and good luck.