richtrader2015: I want to know how can i stop that.
|
|
WHRoeder:
richtrader2015: I want to know how can i stop that. |
|
Hello,
1-I know how to code and already coding my EA and its work very well just wanted to know this simple part. I'm about to launch it on my website.
2-I've learnt to code so that i wouldn't pay someone else to do it for me.
3-thanks for your advice.
Regards
richtrader2015: 1-I know how to code and already coding my EA and its work very well just wanted to know this simple part.
Then where is your code that "Check if there is a open or pend order already on the chart?" If you know how to code mt4 then you should already know how to do that. You don't so GumRai elaborated.
Your code is inside OnInit() and in the MQL reference you can read about the fact that OnInit() is called each and every time you change a Tmeframe or Symbol on the chart the EA is attached to. So all of what you are experiencing I may say are actually expected
best regards

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
Hello to all,
I have recently learnt how to code the new MQL4. and i have written and EA with open position when its attached to the chart. but i have a problem!
when I change the time frame the EA recalculate and re-initiate and open new positions. I want to know how can i stop that. I really appreciate in advance for your help.
the first part of my code is as following: (the MM include file is the money management section)
void OnInit()
{
MM();
//---------------------------------------------------------------------------------------Pending position
if (MM()==true)
{
int Ticketbuy = OrderSend(Symbol(),OP_BUYSTOP,Lots,bullishprice,0,0,tpbull,NULL,0,0,clrNONE);
int Ticketsell = OrderSend(Symbol(),OP_SELLSTOP,Lots,bearishprice,0,0,tpbear,NULL,0,0,clrNONE);
}