Download MetaTrader 5
To add comments, please log in or register
Find and download Code Base apps via MetaTrader. It is fast!
senthil
12
senthil 2015.06.25 07:03 
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..



whroeder1
13641
whroeder1 2015.06.25 11:54  
  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.
JD4
1101
JD4 2015.06.27 03:56  
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.
whroeder1
13641
whroeder1 2015.06.27 11:50  
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.
JD4
1101
JD4 2015.06.27 17:51  
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.
senthil
12
senthil 2015.07.10 18:44  
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;
            }
            
                          
         }
      }

   }
senthil
12
senthil 2015.07.10 18:46  

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..
/
To add comments, please log in or register