hello friends,
i hope you are very good .
there are "4051 errors","order ticket not found errors "at this comic program.
modification errors,deleting errors .etc.
i know stoplevel and freeze point logic .when i add or subtract stoplevel for stoploss points error 130 added.
why does not programming love me? :)
thanks bye .
Add some { } braces to make your like easier and clearer . . .
if(OrderType() == 3 || OrderType() == 5) // if this . . . //ERASE LAST SELECTED PENDING ORDER int SilinecekEmirNumarasi=OrderTicket(); // do this . . . OrderDelete(SilinecekEmirNumarasi); // do this regardless of the if . . .
what are 3 and 5 ? use the correct constant names so we don't have to guess . . .
return correctly from an int type function . . . return an int.
Don't you want to know if your trading functions fail ? and if they do fail what the error was ?
Hello Raptor UK. Thanks again for helpfull knowledges. Is it possible to open orders with a logic " as soon as the ask/bid levels passes over the orderopenprice,modify orderstoploss as orderopenprice. Does stoplevels let this order. At 2011 championship there was a program by "Tim Fass" and i think it was without stoplevels. Is it possible? Do stoplevels and freezepoints differ at championships from the real life?
If you want to know what will work without giving errors in terms of OrderSend, OrderModify and Stoplevel and Freezelevel read and understand this article, it has all the information you need but is quite detailed so needs some time studying it: Requirements and Limitations in Making Trades
pascalboy:
i am making mistakes but cannot find why .
Plus 10 what ?
Ask<=AcikAlimEmriAcilisFiyati + 10) // 10 what ?
OrderModify(AcikSatimEmriNo,0,AcikSatimEmriAcilisFiyati,0,0,0)
- What are Function return values ? How do I use them ? - MQL4 forum
- How do you expect to modify the order price to ZERO?
- Why are you trying to only modify the last one (modifies are outside the loop)
int start() { //IF ORDER'S TOTAL NUMBER BELOW TWO OPEN PENDING ORDERS while(OrdersTotal()<2) { int Emiral=OrderSend(Symbol(),OP_BUYSTOP,0.1,Ask+MarketInfo(Symbol(),MODE_STOPLEVEL)*Point,3,Ask-500*Point,Ask+1000*Point,0); int Emirsat=OrderSend(Symbol(),OP_SELLSTOP,0.1,Bid-MarketInfo(Symbol(),MODE_STOPLEVEL)*Point,3,Bid+500*Point,Bid-1000*Point,0); } /////////////////////////////////////// //IF THERE ARE MARKET ORDERS for(int i=OrdersTotal();i<=1;i--) { if(OrderSelect(i,SELECT_BY_POS)) if (OrderType()==OP_BUY || OrderType()==OP_SELL) { Print(".............",OrderType()); //IF THERE ARE OP_BUYSTOP OR OP_SELLSTOP ORDERS for(i=OrdersTotal();i<=1;i--) if(OrderSelect(i,SELECT_BY_POS)) //ERASE LAST SELECTED PENDING ORDER if(OrderType()==OP_BUYSTOP ) int OpBuySilinecekEmirNumarasi=OrderTicket(); OrderDelete(OpBuySilinecekEmirNumarasi); if(OrderType()==OP_SELLSTOP) int OpSellSilinecekEmirNumarasi=OrderTicket(); OrderDelete(OpSellSilinecekEmirNumarasi); } } //IF THERE IS A OP_BUY ORDER SELECT IT for(i=1;i<OrdersTotal();i++) { if(OrderSelect(i-1,SELECT_BY_POS)) if(OrderType()==OP_BUY) { int AcikAlimEmriNo=OrderTicket(); int AcikAlimEmriAcilisFiyati=OrderOpenPrice(); int AcikAlimEmriZararDurdur=OrderStopLoss(); int AcikAlimEmriKarAl=OrderTakeProfit(); int AcikAlimEmriTipi=OrderType(); } // IF THERE IS A OP_SELL ORDER SELECT IT if(OrderType()==OP_SELL) { int AcikSatimEmriNo=OrderTicket(); int AcikSatimEmriAcilisFiyati=OrderOpenPrice(); int AcikSatimEmriZararDurdur=OrderStopLoss(); int AcikSatimEmriKarAl=OrderTakeProfit(); int AcikSatimEmriTipi=OrderType(); } } //IF ASK PRICE IS ABOVE OR EQUAL TO ORDEROPEN PRICE MODIFY ORDER 'S STOPLOSS AS ORDEROPENPRICE if(OrderType()==OP_BUY && Ask>= AcikAlimEmriAcilisFiyati && Ask<=AcikAlimEmriAcilisFiyati+10*Point) OrderModify(AcikAlimEmriNo,AcikAlimEmriAcilisFiyati,0,0,0,0); //IF BID PRICE IS BELOW OR EQUAL TO ORDEROPEN PRICE MODIFY ORDER 'S STOPLOSS AS ORDEROPENPRICE if(OrderType()==1 && Bid<= AcikSatimEmriAcilisFiyati && Bid>=AcikSatimEmriAcilisFiyati+10) if(OrderType()==OP_SELL && Bid<= AcikSatimEmriAcilisFiyati && Bid>=AcikSatimEmriAcilisFiyati-10*Point) OrderModify(AcikSatimEmriNo,AcikSatimEmriAcilisFiyati,0,0,0); ///EMİRLERİ SINIRLARA GÖRE MODİFİYE ET return; }
//IF ORDER'S TOTAL NUMBER BELOW TWO OPEN PENDING ORDERS while(OrdersTotal()<2) { int Emiral=OrderSend(Symbol(),OP_BUYSTOP,0.1,Ask+MarketInfo(Symbol(),MODE_STOPLEVEL)*Point,3,Ask-500*Point,Ask+1000*Point,0); int Emirsat=OrderSend(Symbol(),OP_SELLSTOP,0.1,Bid-MarketInfo(Symbol(),MODE_STOPLEVEL)*Point,3,Bid+500*Point,Bid-1000*Point,0); } /////////////////////////////////////// //IF THERE ARE MARKET ORDERS for(int i=OrdersTotal();i<=1;i--) { if(OrderSelect(i,SELECT_BY_POS)) if (OrderType()==OP_BUY || OrderType()==OP_SELL) { Print(".............",OrderType()); //IF THERE ARE OP_BUYSTOP OR OP_SELLSTOP ORDERS for(i=OrdersTotal();i<=1;i--) if(OrderSelect(i,SELECT_BY_POS)) //ERASE LAST SELECTED PENDING ORDER if(OrderType()==OP_BUYSTOP ) int OpBuySilinecekEmirNumarasi=OrderTicket(); OrderDelete(OpBuySilinecekEmirNumarasi); if(OrderType()==OP_SELLSTOP) int OpSellSilinecekEmirNumarasi=OrderTicket(); OrderDelete(OpSellSilinecekEmirNumarasi); } }
![MQL5 - Language of trade strategies built-in the MetaTrader 5 client terminal](https://c.mql5.com/i/registerlandings/logo-2.png)
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
hello friends,
i hope you are very good .
there are "4051 errors","order ticket not found errors "at this comic program.
modification errors,deleting errors .etc.
i know stoplevel and freeze point logic .when i add or subtract stoplevel for stoploss points error 130 added.
why does not programming love me? :)
thanks bye .