How to write code ..... when order " close " or order is " stop loss" do this

 

Helloo

Please help me 

i will open position and i want if this position Close or stop loss i want to open again trade and i write this code but can't run !!



"

  if(( OrderSelect(i,ORDER_SL)==true)|| OrderClosePrice() || OrderStopLoss () || ORDER_SL);

  


   {

                 

     file_handle=FileOpen("LossBuy"+_Symbol,FILE_READ|FILE_WRITE|FILE_CSV);FileWriteString(file_handle,"");FileClose(file_handle);

   }

 
  1. Please edit your (original) post and use the CODE button (Alt-S)! (For large amounts of code, attach it.)
              General rules and best pratices of the Forum. - General - MQL5 programming forum 2019.05.06
              Messages Editor

  2. Youssef Ibrahim Abbas Mohammed Saleh: i want if this position Close or stop loss
      if(( OrderSelect(i,ORDER_SL)==true)|| OrderClosePrice() || OrderStopLoss () || ORDER_SL);
  3. You opened a position? Then why are you trying to select an order? Are you using MT4?

    Why did you post your MT4 question in the MT5 General section instead of the MQL4 section, (bottom of the Root page)?
              General rules and best pratices of the Forum. - General - MQL5 programming forum?
    Next time post in the correct place. The moderators will likely move this thread there soon.

  4. An order can be open or closed.
  5. An order can not be Stop Loss — Stop Loss is a price.
  6. OrderClosePrice is a price — it is not a bool.
  7. OrderStopLoss is a price — it is not a bool.
  8. Select by ORDER_SL (what ever that is) is non-sense.

    Perhaps you should read the manual.
       How To Ask Questions The Smart Way. 2004
          How To Interpret Answers.
             RTFM and STFW: How To Tell You've Seriously Screwed Up.

  9. ORDER_SL may be a constant — it is not a bool.
  10. Find the last closed order. See if the close price is closer to the stop loss than the take profit.
 

Sorry ..... Thank you 

i now this is a wrong code .... but i need to correct

  if(( OrderSelect(i,ORDER_SL)==true)|| OrderClosePrice() || OrderStopLoss () || ORDER_SL);
 
Youssef Ibrahim Abbas Mohammed Saleh: i now this is a wrong code .... but i need to correct
  if(( OrderSelect(i,ORDER_SL)==true)|| OrderClosePrice() || OrderStopLoss () || ORDER_SL);

translation: “if selecting nonsense or close out price or sale price or nonsense.” PICNIC. You are posting babble.

You have only four choices:

  1. Search for it. Do you expect us to do your research for you?

  2. Beg at:

  3. MT4: Learn to code it.
    MT5: Begin learning to code it.

    If you don't learn MQL4/5, there is no common language for us to communicate. If we tell you what you need, you can't code it. If we give you the code, you don't know how to integrate it into your code.

  4. or pay (Freelance) someone to code it. Top of every page is the link Code Base.
              Hiring to write script - General - MQL5 programming forum 2019.08.21

We're not going to code it for you (although it could happen if you are lucky or the problem is interesting.) We are willing to help you when you post your attempt (using CODE button) and state the nature of your problem.
          No free help 2017.04.21