Build 625

User avatar
traderduke
Trader
Posts: 306
Joined: Mon Nov 28, 2011 7:30 pm
Location: East Coast USA

Build 625

Post by traderduke »

Hi
I was woundering if anybody knows where I can find a list of Empty4 syntex & word addition changes to OrdeSelect & all other OrderXXXX.
Problem:
"return value of 'OrderClose' should be checked CloseAll.mq4 59 37

Even mql still list the old.
Last edited by traderduke on Fri Mar 28, 2014 12:51 pm, edited 1 time in total.
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Build 625

Post by milanese »

traderduke » Fri Mar 28, 2014 12:42 pm wrote:Hi
I was woundering if anybody knows where I can find a list of Empty4 syntex & word addition changes to OrdeSelect & all other OrderXXXX. Even mql still list the old.
They don't have updated their manuals so far... maybe because they are still changing..
They new warning build 625 compiler gives you resolve at exp:
the old style of coding gives warning:

Code: Select all

if(lastTicket>=0)
     {
     OrderSelect(lastTicket,SELECT_BY_TICKET,MODE_TRADES);
     }
so use new:

Code: Select all

bool Order_Select=false;
if(lastTicket>=0)
     {
      Order_Select=OrderSelect(lastTicket,SELECT_BY_TICKET,MODE_TRADES);
     }
Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
User avatar
traderduke
Trader
Posts: 306
Joined: Mon Nov 28, 2011 7:30 pm
Location: East Coast USA

Build 625

Post by traderduke »

Tommaso
I'm trying to get Script "CloseAll" to work. It seems to need something else. Orderselect seems OK NOW! Others not SO!

Thanks appreciate your help

Ray

PS: Resolve at EXP., what is that or how to access in editor??

Code: Select all

 switch (option)
   {
      case 0:
      {
         for (cnt = total ; cnt >=0 ; cnt--)
         {
            if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES)==false) break;
            if(Symbol()!=OrderSymbol()) RefreshRates();
            //if(OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),5,Violet);
            if(OrderType()==OP_BUY) OrderClose(OrderTicket(),OrderLots(),Bid,3,White);
            break;
            if(OrderType()==OP_SELL) OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),5,Violet);
            break;
            if(OrderType()>OP_SELL) OrderDelete(OrderTicket());
         }
         break;
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Build 625

Post by milanese »

try it in this way:

Code: Select all

 bool result = false;
if(OrderType()==OP_BUY)  result =  OrderClose(OrderTicket(),OrderLots(),Bid,3,White);
            break;
//ecc....
Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Build 625

Post by milanese »

traderduke » Fri Mar 28, 2014 12:42 pm wrote:Hi
I was woundering if anybody knows where I can find a list of Empty4 syntex & word addition changes to OrdeSelect & all other OrderXXXX.
Problem:
"return value of 'OrderClose' should be checked CloseAll.mq4 59 37

Even mql still list the old.
You must always define a bool result exp for using this now, to check if the operation has had success..
like in my previous posts shown.. thats all..

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
User avatar
traderduke
Trader
Posts: 306
Joined: Mon Nov 28, 2011 7:30 pm
Location: East Coast USA

Build 625

Post by traderduke »

Tommaso
There must be a cleaner way to fix Orderxxxxx problem, I know I ask fror help then I question it.

I used a MA EA from mql and got the OrderSelect FIX but it doesn't help the other 7 Orderxxxxs. Each seems to have their own syntex which is why I question your fix for OrderSelect, not that it wouldn't work but its bulky in the CloseAll script. Here is mql fix for OrderSelct which fixed 8-10 problems in CloseAll :
Old

Code: Select all

OrderSelect(0,SELECT_BY_POS,MODE_TRADES)
Mql

Code: Select all

if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES)==false) break;
Please don't misunderstand me, I don't mean to sound ungrateful.

I really appreciate your help.

Still searching!@!!! :arrrg: :arrrg:

Thanks

Ray
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Build 625

Post by milanese »

traderduke » Fri Mar 28, 2014 3:05 pm wrote:Tommaso
There must be a cleaner way to fix Orderxxxxx problem, I know I ask fror help then I question it.

I used a MA EA from mql and got the OrderSelect FIX but it doesn't help the other 7 Orderxxxxs. Each seems to have their own syntex which is why I question your fix for OrderSelect, not that it wouldn't work but its bulky in the CloseAll script. Here is mql fix for OrderSelct which fixed 8-10 problems in CloseAll :
Old

Code: Select all

OrderSelect(0,SELECT_BY_POS,MODE_TRADES)
Mql

Code: Select all

if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES)==false) break;
Please don't misunderstand me, I don't mean to sound ungrateful.

I really appreciate your help.

Still searching!@!!! :arrrg: :arrrg:

Thanks

Ray
They way you posted works too, yes important is that you check the result.., that is all and makes sense as you should check if an order you want to close is really closed..

Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
User avatar
traderduke
Trader
Posts: 306
Joined: Mon Nov 28, 2011 7:30 pm
Location: East Coast USA

Build 625

Post by traderduke »

I was looking for a quick closeall while I was veiwing my terminal /trade and watching them disappear. You are goung a lot deeper then I intended. Here is abasic close from an old mql that I fixed OrderSelect & can't get OrderClose or Delete. Help, please line 21 & 25

Code: Select all

#property copyright "CodeMonkey"
#property link      "forex.monkey@live.com"

//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
int start()
  {
//----
   for(int x=OrdersTotal()-1;x>=0;x--)
   {
      if(OrderSelect(x,SELECT_BY_POS,MODE_TRADES)==false) break; // my new addition
      if(OrderType()==OP_BUY || OrderType()==OP_SELL)
      {
      //OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),666,CLR_NONE);
      if(OrderClose(OrderTicket(),OrderLots(),OrderClosePrice() ,666,CLR_NONE)== false);     //line 21
      break;
      }
      else
      {OrderDelete(OrderTicket());                                               //line 25
      }
   }
//----
   return(0);
  }


thanks
User avatar
milanese
TechAdmin
Posts: 3293
Joined: Wed Jan 09, 2013 9:02 am
Location: btr rdx, r8 +

Build 625

Post by milanese »

traderduke » Fri Mar 28, 2014 4:10 pm wrote:I was looking for a quick closeall while I was veiwing my terminal /trade and watching them disappear. You are goung a lot deeper then I intended. Here is abasic close from an old mql that I fixed OrderSelect & can't get OrderClose or Delete. Help, please line 21 & 25

....

thanks
You must code in this way and it works perfect..

Code: Select all

 #property copyright "CodeMonkey"
        #property link      "forex.monkey@live.com"
         
        //+------------------------------------------------------------------+
        //| script program start function                                    |
        //+------------------------------------------------------------------+
        int start()
          {
        //----
         bool result = false;
           for(int x=OrdersTotal()-1;x>=0;x--)
           {
              if(OrderSelect(x,SELECT_BY_POS,MODE_TRADES)==false) break; // my new addition
              if(OrderType()==OP_BUY || OrderType()==OP_SELL)
              {
              //OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),666,CLR_NONE);
             result=(OrderClose(OrderTicket(),OrderLots(),OrderClosePrice() ,666,CLR_NONE));     //line 21
             break;
              }
              else
              {result=OrderDelete(OrderTicket());                                               //line 25
              }
           }
        //----
           return(0);
          }
better, because much more secure would this way I do it in my EA:

Code: Select all

 void CloseTotalBasket()
{
   ForceTradeClosureBasket= false;
   
   if (OrdersTotal() == 0) return;
   
   for (int cc = OrdersTotal() - 1; cc >= 0; cc--)
   {
      if (!OrderSelect(cc, SELECT_BY_POS) ) continue;
      while(IsTradeContextBusy()) Sleep(100);
      if (OrderType() == OP_BUY || OrderType() == OP_SELL) bool result = OrderClose(OrderTicket(), OrderLots(), OrderClosePrice(), 1000, CLR_NONE);
      if(OrderType() ==  OP_BUYLIMIT || OrderType() ==  OP_SELLLIMIT)  bool result_pending =OrderDelete( OrderTicket() );
      if(OrderType() ==  OP_BUYSTOP || OrderType() ==  OP_SELLSTOP)    result_pending =OrderDelete( OrderTicket() );
      if (result) cc++;
           
      //if (!result) ForceTradeClosure= true; //original, fxdaytrader
      
      //mod. fxdaytrader, orderclose-retry if failed with ordercloseprice(). Maybe very seldom, but it can happen, so it does not hurt to implement this:
      if (!result) {
       while(IsTradeContextBusy()) Sleep(100);
       RefreshRates();
       if (OrderType()==OP_BUY) result = OrderClose(OrderTicket(), OrderLots(), MarketInfo( OrderSymbol(),MODE_BID), 5000, CLR_NONE);
       if (OrderType()==OP_SELL) result = OrderClose(OrderTicket(), OrderLots(), MarketInfo( OrderSymbol(),MODE_ASK), 5000, CLR_NONE);
       if (!result) ForceTradeClosureBasket= true;
      }
     //end mod.
      
   }//for (int cc = OrdersTotal() - 1; cc >= 0; cc--)

  

}//End void CloseAllTrades()
Cheers :)

Tommaso
Global Prime is the official SHF broker :yahoo:
Searching for Servers and Workstations with individual configuration?
Just PM
:smile: Click here to go to the BoardKnowledgeBase
NOTE: Cookies and JavaScript are required for the using the board, with full functionality
User avatar
traderduke
Trader
Posts: 306
Joined: Mon Nov 28, 2011 7:30 pm
Location: East Coast USA

Build 625

Post by traderduke »

Tommaso
Thank you a LOT. If hear of a list of the published changes BROABCAST it.

Thanks again for putting up with me 7 I do appreciate your concern for the result.

Ray
Last edited by traderduke on Sat Mar 29, 2014 4:37 pm, edited 1 time in total.
Post Reply

Return to “Know your MT4 platform”