Using OrderSelect() to find the text that i have printed to a log file

Back to topics list To post a new topic, please log in or register
avatar
14
FXBulldog 2015.03.25 08:16
 
{
   bool   Result;
   int    i,Pos,Error;
   int    Total=OrdersTotal();
   
   if(Total>0)
   {for(i=Total-1; i>=0; i--) 
     {if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES) == TRUE && //what do I put in the code here to find the Print text in the log?=="my logged print text")
       {EA instruction once the OrderSelect is TRUE;}
       
//-----------------------
       if(Result!=true){Error=GetLastError();Print("LastError = ",Error);}
        else Error=0; 
//-----------------------
       }//if
     }//for
   }//if

Perhaps a silly question, but I can't seem to find the answer:


My EA is using the Print() function to print a line of text to the log file when a specific condition is met, but leaves the Order open.  I then want to find the printed line of text using the OrderSelect() function and tell the EA to do something with that order. Please see my OrderSelect() code below and advise how to find the printed text that i am looking for (see the bit that i have called //what do I put in the code here to find the Print text in the log?=="my logged print text") :


avatar
12985
WHRoeder 2015.03.25 13:57 #
 
FXBulldog: print a line of text to the log file when a specific condition is met, but leaves the Order open.  I then want to find the printed line of text using the OrderSelect() function
  1. Selecting an order has nothing to do with what is in the log file.
  2. Remember the ticket number. Later select by ticket and verify that it isn't already closed.
  3. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.
avatar
14
FXBulldog 2015.03.25 22:22 #
 
Thanks for your comment WHRoeder.  However, I am not sure how to use an EA to identify/remember a ticket number when a specific condition is met, such that I can then get the EA to retrieve the Order (if it is still open) relevant for the ticket number.  I am sure that I can code the OrderSelect() once the ticket number is known, but I do not have any idea how to tell the EA to identify/remember the ticket number.  Please would you point me in the right direction...
avatar
12985
WHRoeder 2015.03.26 14:49 #
 
If the power fails, OS crashes, terminal or chart is accidentally closed, the next tick, the ticket variable will be lost. You will have an open order but don't know it, so the EA will never try to close it, trail SL, etc. How are you going to recover? Use a orderSelect loop no recovery, or persistent storage (GV/file) of ticket numbers required.
Back to topics list  

To add comments, please log in or register