OrderModify() question - page 5

 

The OrderSelect() function remains untouched. Correct?

// order pool example

if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES)){

The condition being used is what I am searching for from the list of trading functions.

The OrderSymbol() function seems to be the only ticket information which can be used to specify which ticket is on the USDJPY pair. Is this the condition used by your example?

Thank you

 
WhooDoo22:

The OrderSelect() function remains untouched. Correct?

The condition being used is what I am searching for from the list of trading functions.


The OrderSymbol() function seems to be the only ticket information which can be used to specify which ticket is on the USDJPY pair. Is this the condition used in you example?

If this worked, this'd be the way I'd go with it.

Thank you

I can show you my code . . . . .  or you can code your own, test it,  fix it,  test it, fix it ,  etc.  and when done post it.  Which do you want ?

Before you go searching for functions explain how you are going to meet the requirement  . . . in simple plain English without any specific mention of coding functions.
 

I can show you my code . . . . .  or you can code your own, test it,  fix it,  test it, fix it ,  etc.  and when done post it.  Which do you want ?

RE: I want to understand the condition used to isolate a ticket number on the USDJPY out of three orders on three separate currency pairs. I'd rather do what is easiest for both of us, there is so much to do. :)

Before you go searching for functions explain how you are going to meet the requirement

RE: I will explain in code, the most direct way to express a short, coded execution of this particular logic.

// this code does not include error corrections. Strictly code to execute closing of an order on USDJPY.

   double bid_ask;

   if(OrderSelect(0,SELECT_BY_POS,MODE_TRADES))          {
   if(OrdersTotal()>0)                                   {
   if(OrderSymbol()=="USDJPY")                           {
   if((OrderType()==OP_BUY)||(OrderType()==OP_SELL))     {
   if(OrderType()==OP_BUY)                               {bid_ask=Bid;}
   if(OrderType()==OP_SELL)                              {bid_ask=Ask;}
   
     {OrderClose(OrderTicket(),OrderLots(),bid_ask,2,CLR_NONE);}}}}}

Thank you.

 
WhooDoo22:

I can show you my code . . . . .  or you can code your own, test it,  fix it,  test it, fix it ,  etc.  and when done post it.  Which do you want ?

RE: I want to understand the condition used to isolate a ticket number on the USDJPY out of three orders on three separate currency pairs. I'd rather do what is easiest for both of us, there is so much to do. :)

Before you go searching for functions explain how you are going to meet the requirement

RE: I will explain in code, the most direct way to express a short, coded execution of this particular logic.

Did you test your code ?  did it work ?  where is the TP & SL placed ?  where is the ticket number printed,  what happens if the order in position 0  is not a USDJPY one  ?

 

Remember this post ?

 

RaptorUK:


It's bed time for me now . . .  so here is a hint to get you started,  you have multiple orders,  so you need to loop through them all to find the right one . . . or maybe more than one, cover as many options as you can see.

 
WhooDoo22:
Poor-Thing, this must feel like Coding-Boot-Camp 8)))
 

Simon,

Did you test your code ?

RE: I can't run tests for this code in mt4 terminal since the trading break period has begun til the Sunday open, so I'll be working on sections of volume II in the meantime. I'll be sure to respond to your posts as well.

Thank you.

 
ubzen:
Poor-Thing, this must feel like Coding-Boot-Camp 8)))
You know the saying . . . .  "No pain,  No gain" :-)
 

It could be reversed, No gain, No pain. ;) The choice is to trade pain for gain OR trade no gain for no pain. Either way ya' get somethin'.

 

Simon,

A'ight, this works IF I place the script on a usdjpy chart (no matter if there are more than one tickets open on different currency pairs) The trick is, I cannot place script on a different chart EXCEPT usdjpy chart to close the order. I am currently working on a script where I can place it on any chart to close the usdjpy order.

   double bid_ask;

   if(OrderSelect(OrderTicket(),SELECT_BY_POS,MODE_TRADES))     { // was 0
   if(OrdersTotal()>0)                                   {
   if(OrderSymbol()=="USDJPY")                           {
   if((OrderType()==OP_BUY)||(OrderType()==OP_SELL))     {
   if(OrderType()==OP_BUY)                               {bid_ask=Bid;}
   if(OrderType()==OP_SELL)                              {bid_ask=Ask;}
   
     {
      OrderClose(OrderTicket(),OrderLots(),bid_ask,2,CLR_NONE);
     }
     }}}}

Please post your response for this updated script.

I've solved so many problems (including this) over a few swigs of "brewed" beverages. ;) I am careful of what I type, so I do not break any rules of the MQL4 forum. I do take the rules seriously. phi.nuts :)

Thank you

Files:
 
WhooDoo22:

Simon,

A'ight, this works IF I place the script on a usdjpy chart (no matter if there are more than one tickets open on different currency pairs) The trick is, I cannot place script on a different chart EXCEPT usdjpy chart to close the order. I am currently working on a script where I can place it on any chart to close the usdjpy order.

Please post your response for this updated script.

I've solved so many problems (including this) over a few swigs of "brewed" beverages. ;) I am careful of what I type, so I do not break any rules of the MQL4 forum. I do take the rules seriously. phi.nuts :)

Thank you

2 issues which I can see immediately without trying your code means that what you have done does not meet the requirement . . .

 

"where is the TP & SL placed ?  where is the ticket number printed, . . .