...
Improperly formatted code removed by moderator. Please EDIT your post and use the CODE button (Alt-S) when inserting code.
Hover your mouse over your post and select "edit" ...
...
![MQL5.community - User Memo MQL5.community - User Memo](https://c.mql5.com/36/69/mql5-community-user-memo__1.jpg)
- www.mql5.com
...
Improperly formatted code removed by moderator. Please EDIT your post and use the CODE button (Alt-S) when inserting code.
Hover your mouse over your post and select "edit" ...
...
No you did not! You created a new post instead of editing the first one.
So, I've corrected that now, but please do it properly as instructed next time.
Also, please don't create topics randomly in any section. It has been moved to the section: Expert Advisors and Automated Trading
No you did not! You created a new post instead of editing the first one.
So, I've corrected that now, but please do it properly as instructed next time.
Also, please don't create topics randomly in any section. It has been moved to the section: Expert Advisors and Automated Trading
ok. Thanks.
Is the logic here is :
always open a new pos when "Buy crossover" and "Buy signal" happens
and ,close pos when both happens also " stoch[1]<signal[1] && stoch[0]>signal[0] " ?
Is the logic here is :
always open a new pos when "Buy crossover" and "Buy signal" happens
and ,close pos when both happens also " stoch[1]<signal[1] && stoch[0]>signal[0] " ?
The logic is to buy when the signal line crosses above the stochastic line below the 20 level. The position is to be closed when signal line crosses below the stochastic line.
Please help me. The trade opens as is supposed to but the trades do not close. What do I do?
The logic is to buy when the signal line crosses above the stochastic line below the 20 level. The position is to be closed when signal line crosses below the stochastic line.
Please help me. The trade opens as is supposed to but the trades do not close. What do I do?
Hi I've never used Ctrade as I like to make my own functions & classes instead of importing them. This way you can have complete control over what your code is doing.
In mql5, trades are opened and closed using the OrderSend() function. This function takes a while to get your head around. Opening and closing trades is not as simple as you might think. There is a lot of stuff going on.
However! In the documentation there is lots of example code. If you copy and paste the entire examples, they will work, and that is usually a good starting point.
Have a good study of this:
https://www.mql5.com/en/docs/constants/structures/mqltraderequest
![Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Trade Request Structure Documentation on MQL5: Constants, Enumerations and Structures / Data Structures / Trade Request Structure](https://c.mql5.com/36/69/documentation-on-mql5-constants__14.png)
- www.mql5.com
Hi I've never used Ctrade as I like to make my own functions & classes instead of importing them. This way you can have complete control over what your code is doing.
In mql5, trades are opened and closed using the OrderSend() function. This function takes a while to get your head around. Opening and closing trades is not as simple as you might think. There is a lot of stuff going on.
However! In the documentation there is lots of example code. If you copy and paste the entire examples, they will work, and that is usually a good starting point.
Have a good study of this:
https://www.mql5.com/en/docs/constants/structures/mqltraderequest
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
Good day all. I am fairly new to MQL5. I attempted writing an EA code based on the stochastic indicator but the trades are not closing even when the conditions are met. kindly help me debug. the trade is supposed to close when there is a reverse cross of the indicator opposite to the one that created the signal. this is the code: