zoop Posted March 3, 2010 Report Share 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 Quote Link to comment Share on other sites More sharing options...
scarface Posted March 3, 2010 Report Share 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, Quote a New Year 2011 has come, and the challenge has just started 8-) Link to comment Share on other sites More sharing options...
zoop Posted March 3, 2010 Author Report Share Posted March 3, 2010 Re: ( Ask) How to fix this code? thanks scarface looks like it will work so what does(!) mean in Mql ? Quote Link to comment Share on other sites More sharing options...
scarface Posted March 4, 2010 Report Share 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, Quote a New Year 2011 has come, and the challenge has just started 8-) Link to comment Share on other sites More sharing options...
HunFxTrader Posted March 4, 2010 Report Share 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! Quote Link to comment Share on other sites More sharing options...
zoop Posted March 6, 2010 Author Report Share 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 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.