Hello,
I'm fairly new to mql4. I have been doing fine but lately I have been completely stumped by a problem I have encounter. I have coded a simple ea that works fine once I declare a local variable for buyorder
int buyorder=OrderSend(Symbol(),OP_BUY,LotSize,Ask,3,0 ,0,NULL,MagicNumber,0, Green);
if (buyordergt;0)
OrderModify(buyorder,OrderOpenPrice(),bsl,btp,0,CL R_NONE);
but should I admit buyorder as a global variable (and take away the int) it doesn't work. It merely keeps modifying orders infinitum. For the life of me, I can't comprehend why this should happen as a global variable should have the ability to be used anywhere in the app and it's value should have the ability to change. I could stick with the local variable but I wish to enlarge the ea to make numerous orders and to use monitoring stops etc and I need to use global variables. I have included the ea below. The first version(local variable) functions, the second(global) doesn't. If anyone can help me, that would be so appreciated as I have literally spent days trying to work out it. PS This also applies to the variable sellorder.
Thanks
https://forexintuitive.com/attachmen...1727520325.mq4
https://forexintuitive.com/attachmen...1081469781.mq4