zoop Posted March 3, 2010 Report Posted March 3, 2010 i'm using this code to stop my ea trading when the bands come together double upper1=iBands(NULL,bbtimeframe,bbperiod,deviation,0,PRICE_OPEN,MODE_UPPER,0); double lower1=iBands(NULL,bbtimeframe,bbperiod,deviation,0,PRICE_OPEN,MODE_LOWER,0); if((upper1==lower1))return(0); it works great, however, return(0); also stops the whole ea from functioning Question: how to add code so that (upper1==lower1) justs stop ea from placing new orders, rather than stopping the whole ea my place order and close order code is if ( filter1>filter2) buy=true; } if( filter1<filter2) sell=true; } if((filter1<filter2))closebuy(); if((filter1>filter2))closesell(); much thanks zoop
scarface Posted March 3, 2010 Report Posted March 3, 2010 Re: ( Ask) How to fix this code? i'm using this code to stop my ea trading when the bands come together double upper1=iBands(NULL,bbtimeframe,bbperiod,deviation,0,PRICE_OPEN,MODE_UPPER,0); double lower1=iBands(NULL,bbtimeframe,bbperiod,deviation,0,PRICE_OPEN,MODE_LOWER,0); if((upper1==lower1))return(0); it works great, however, return(0); also stops the whole ea from functioning Question: how to add code so that (upper1==lower1) justs stop ea from placing new orders, rather than stopping the whole ea my place order and close order code is How about adding this little thing to your code?? if ( filter1>filter2 && upper1!=lower1) buy=true; } if( filter1<filter2 && upper1!=lower1) sell=true; } if((filter1<filter2 ))closebuy(); if((filter1>filter2 ))closesell(); much thanks zoop Please try it and let me know. Best wishes, a New Year 2011 has come, and the challenge has just started 8-)
zoop Posted March 3, 2010 Author Report Posted March 3, 2010 Re: ( Ask) How to fix this code? thanks scarface looks like it will work so what does(!) mean in Mql ?
scarface Posted March 4, 2010 Report Posted March 4, 2010 Re: ( Ask) How to fix this code? Hi zoop, Good day, It is simple and here is a short explanation as well. Let's say that Value1==Value2 ............... This means that both values have the same values. If you want them NOT to equal, simply remove one equal sign from (==) to (!=). So now you can see that (==) means equal in value. And (!=) means not equal in value. sometimes you can use ! in front of a constant function. For example, !IsDemo...... This means it won't send orders. They are opposite of each other. I hope this is clear to you. Best wishes, a New Year 2011 has come, and the challenge has just started 8-)
HunFxTrader Posted March 4, 2010 Report Posted March 4, 2010 Re: ( Ask) How to fix this code? You can use boolean to prevent the ea from new order opening as well. For example: // -------------------------------------- bool openneworder = true; if (upper1==lower1) openneworder = false; // -------------------------------------- Before the OrderSend line you should insert this code: if (openneworder) Hope this helps!
zoop Posted March 6, 2010 Author Report Posted March 6, 2010 Re: ( Ask) How to fix this code? You can use boolean to prevent the ea from new order opening as well. For example: // -------------------------------------- bool openneworder = true; if (upper1==lower1) openneworder = false; // -------------------------------------- Before the OrderSend line you should insert this code: if (openneworder) Hope this helps! yes great help, thanks
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now