- "Doesn't work" is meaningless - just like saying the car doesn't work. Doesn't start, won't go in gear, no electrical, missing the key, flat tires - meaningless. There are no mind readers here.
- Check your return codes and find out why. What are Function return values ? How do I use them ? - MQL4 forum and Common Errors in MQL4 Programs and How to Avoid Them - MQL4 Articles
hahahahhaha sorry i didn't explain ..
doesn't work that men it doesn't put the orders the Buy Stop and the Sell Stop as shown in the pic
my question is ..is there something to know when i affect a value from ibands to a variable ?
because the rest of the code work fin when i change it to this for exmpl
double BuyLevel1=Close[1]+10*pte; int B1=OrderSend(Symbol() , OP_BUYSTOP , lot , BuyLevel1 , Slippage , BuyLevel1-SL*pte , BuyLevel1+TP*pte, "" ,MagicNumber , TimeCurrent()+expiration , Green);
thank you in advance :)
https://charts.mql5.com/10/344/usdjpy-h1-fxpro-financial-services-2.png
Your image shows the USDJPY chart. The trade log shows the EA running on GBPUSD opened an order.
- Post the rest of the code.
- How do you stop opening infinite number of trades?
extern int TP=40; extern int SL=30; extern double lot=0.01; extern int ExpirationTime = 22; ////////////////////////// int MagicNumber=26091; int Slippage=10; int mypoint; double pte; int BarsCount = 0; int expiration=60*60*ExpirationTime; ////////////////////////// int init() { //////////////////////////////////////////////////////////////////////////// if(MarketInfo(Symbol(), MODE_DIGITS)==3||MarketInfo(Symbol(), MODE_DIGITS)==5) mypoint=10; else mypoint=1; pte=Point*mypoint; /////////////////////////////////////////////////////////////////////////// return (0); } int start() { if( Hour()==1 && Minute()==59) { ////////////////////////////////////// this is how i stop opening infinite number of trades int Orders= OrdersTotal(); // Number of orders if (Orders==0) // If numb. of ord. = 0 Comment("No orders"); // Comment to the window corner else // If there are orders Comment("Available ",Orders," orders." );// Comment { int orders=0; for (int i=0; i<OrdersTotal(); i++){ if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) if(OrderSymbol()==Symbol()) orders++; } if(orders==0) ////////////////////////////////////////////////////////////////////////// { double BuyLevel=iBands(NULL,0,15,2,0,PRICE_MEDIAN,MODE_UPPER,1); int B=OrderSend(Symbol() , OP_BUYSTOP , lot , BuyLevel , Slippage , BuyLevel-SL*pte , BuyLevel+TP*pte, "" ,MagicNumber , TimeCurrent()+expiration , Green); double SellLevel=iBands(NULL,0,15,2,0,PRICE_MEDIAN,MODE_LOWER,1); int S=OrderSend(Symbol() , OP_SELLSTOP , lot , SellLevel , Slippage ,SellLevel+SL*pte , SellLevel-TP*pte, "" ,MagicNumber , TimeCurrent()+expiration , Blue); } } BarsCount = Bars; } return (0); }
the pic was just an exempel..to show u ..wher it most normaly open the orders ...
sooryy for the disturbance :(
You need to Normalize the entry levels
double BuyLevel=NormalizeDouble(iBands(NULL,0,15,2,0,PRICE_MEDIAN,MODE_UPPER,1),Digits); double SellLevel=NormalizeDouble(iBands(NULL,0,15,2,0,PRICE_MEDIAN,MODE_LOWER,1),Digits);
You use int A and int B in your code. Print an error report if these==-1
- SL/TP (stops) need to be normalized to tick size (not Point.) (On 5Digit Broker Stops are only allowed to be placed on full pip values. How to find out in mql? - MQL4 forum) and abide by the limits Requirements and Limitations in Making Trades - Appendixes - MQL4 Tutorial and that requires understanding floating point equality Can price != price ? - MQL4 forum
- Open price for pending orders need to be adjusted. On Currencies, Point == TickSize, so you will get the same answer, but it won't work on Metals. So do it right: Trailing Bar Entry EA - MQL4 forum or Bid/Ask: (No Need) to use NormalizeDouble in OrderSend - MQL4 forum
- Lot size must also be adjusted to a multiple of LotStep. If that is not a power of 1/10 then NormalizeDouble is wrong. Do it right.
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hey
please guys any one can help me with my expert ..
i wanna make a buystop in the upper line of the ibands and a sellstop in the lower line of the ibands ..of the candle of 00:00 every day
so i write it like that ..but it wouldnt work.. can u guys pliizz help me