increase TakeProfit after get stoplose..

 
void CheckIfOrderEarned()
   {
  
   int i=OrdersHistoryTotal()-1;
   //----
   OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
      {                                    
      OT = OrderType();
      OL = OrderLots();
      SL = OrderStopLoss();
      TP = OrderTakeProfit();
      _symbol = OrderSymbol();
      double OP = OrderProfit();
       double OOP = OrderOpenPrice();

     
      if (OrderMagicNumber() == Magic)
         {
    
  

     if (OrderProfit() <0 && OrderLots() < NormalizeDouble(templots*3,2))
     {
  
     if (OrderLots()==Lots && MathAbs((TP-OOP)/Point) <= TempProfit*3 )
     {
   
          TakeProfit = MathAbs((TP-OOP)/Point)+TempProfit;
      
         }   
        
              
    }
         

else
            {
          //  TakeProfit= 20;
            Lots = templots;
            TakeProfit = TempProfit;
            }
            
                          
         }
      }

   }



i want condition like this:

1 first open using lot 0.1 and tp 20 pips, get sl..

2. open second still using lot 0.1, but tp increase be 40, get sl..

3. open third still using lot 0.1, tp be 60, get sl.

4. because have 5 times get sl, & increase tp


5.........


i can increase lot double every get sl, and profit double every get sl..

but i can not make every lot have 3 level tp incerement..

because that code i make, that result increase lot and tp together when get sl..


what should i change the code?
thx..



 
  1. Don't paste code
    Play video
    Please edit your post.
    For large amounts of code, attach it.

  2. 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.
 
From my side, it looks like they did use the SRC button, or did a mod put that in the box?  Not speaking to specific details of what you want the program to do, because IDK MQL all that much, but from a coder/programmer standpoint, you might want to make sure the code you post is aligned properly (i.e. opening and closing braces are not further indented than the code they are enclosing).  It helps other people follow your program and spot possible errors easier.
 
JD4: From my side, it looks like they did use the SRC button, or did a mod put that in the box? 
Edited after my post.
 
WHRoeder:
JD4: From my side, it looks like they did use the SRC button, or did a mod put that in the box? 
Edited after my post.

Ah.
 
void CheckIfOrderEarned()
   {
  
   int i=OrdersHistoryTotal()-1;
   //----
   OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
      {                                    
      OT = OrderType();
      OL = OrderLots();
      SL = OrderStopLoss();
      TP = OrderTakeProfit();
      _symbol = OrderSymbol();
      double OP = OrderProfit();
       double OOP = OrderOpenPrice();

     
      if (OrderMagicNumber() == Magic)
         {
    
  

     if (OrderProfit() <0 && OrderLots() < NormalizeDouble(templots*3,2))
     {
  
     if (OrderLots()==Lots && MathAbs((TP-OOP)/Point) <= TempProfit*3 )
     {
   
          TakeProfit = MathAbs((TP-OOP)/Point)+TempProfit;
      
         }   
        
              
    }
         

else
            {
          //  TakeProfit= 20;
            Lots = templots;
            TakeProfit = TempProfit;
            }
            
                          
         }
      }

   }
 

i want condition like this:

1 first open using lot 0.1 and tp 20 pips, get sl..

2. open second still using lot 0.1, but tp increase be 40, get sl..

3. open third still using lot 0.1, tp be 60, get sl.

4. because have 5 times get sl, & increase tp


5.........


i can increase lot double every get sl, and profit double every get sl..

but i can not make every lot have 3 level tp incerement..

because that code i make, that result increase lot and tp together when get sl..


what should i change the code?
thx..
Reason: