Display HIGH and LOW TP of all trades

 

I am battling to find a way to do something simple

I want to display the Highest TP and Lowest TP on my chart using two variables.

TPH (Take Profit High)

TPL  (Take Profit Low)

 

The end result will be an alert  that starts sounding 0.0010 before the TPH or TPL is hit.

 Its part of a scalping EA I am working, It opens more than 5 trades but I want only the highest TP and Lowest TP to display on the chart.

 Can anyone guide me to where I can find something like this 

Thanks! 

 
MichaelOxley: I am battling to find a way to do something simple
  1. OrdersSelect loop, extract, find min/max, Comment. Simple.
  2. You have only three choices: Search for it (unlikely,) learn to code it, or pay someone. We're not going to code it FOR you. We are willing to HELP you when you post your attempt (using SRC) and the nature of your problem.
 

lol ... its not like I have not been trying by myself Roe, I am a VB coder and don't know c++ that well ESP the loops that are so stupid.

Simple in vb looks similar to this:

Do while i < numberofopentrades

If type = 1

   BuyTp = OrderTakeProffit

else

 SellTp = OrderTakeProffit

end if 

        i++ 
        //or i = i +1 

Loop 

I knew it had to loop through records, ended up doing this and it worked for me. (Took two hours after I posted this question)

string TradeType;    
string BuyTP;
string SellTP; 


    
for (int i =0; i < OrdersTotal(); i++) {
    if(OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {
        
        TradeType = OrderType();
        
        if(TradeType == OP_BUY ){ BuyTP = OrderTakeProfit() ;}
        if(TradeType == OP_SELL ){ SellTP = OrderTakeProfit();}
        
    }
   }    

 

The idea was to get a fresh approach, Learn from the so called "Masters" out there, and it should be obvious like all my previous posts that I was trying to code it myself.
I know people take chances to let others do their work for them but I am not like that. 
I have paid many people on liveperson to do code for me on big projects when I am busy with other parts of a program and wont make a deadline, but this EA is not like all the others and I am not willing to share any code for someone else to insert certain things I needed like If statements or Loops.
Thus I have to code it myself and I only asked to point me to something, not a comment like "Learn to code" when I was doing that already for almost three hours, and telling me searching for it would give me little result or to pay someone to do it - makes a person feel very welcome to ask a question on this forum.
Wonder why this forum is here. IF I ever have another question I will post my code I am doing. 

Thanks anyway and sorry you wasted your precious time typing the obvious.

Reason: