Next position 1.70 more than the previous position ???

 

Hello to all professors

I want the second position to be 1.70% higher than the first position

I also wrote this code, but it is wrong and the second position does not open

Can you tell me where the wrong code is?

double lot3()
{
double lotsi = NormalizeDouble(FindLastSellLot() * 1.70 / 100, 2);

return(lotsi);
}
//+------------------------------------------------------------------+
double FindLastSellLot() 
{
   double LastSellLot;
   int LastOrder=0;
   double unused=0;
   for(int i=OrdersTotal()-1; i>=0; i--)
   {
      OrderSelect(i, SELECT_BY_POS, MODE_TRADES);
      
      unused=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
      if(OrderSymbol()!=Symbol() || OrderMagicNumber()!=Magic8) continue;
      if(OrderSymbol()==Symbol() && OrderMagicNumber()==Magic8 && OrderType()==OP_SELL) 
      {
         if (OrderTicket()>LastOrder)
         {
            LastSellLot=OrderLots();
            LastOrder=OrderTicket();
         }
      }         
   }
   return (LastSellLot);
}
 
ghobar:

Hello to all professors

I want the second position to be 1.70% higher than the first position

I also wrote this code, but it is wrong and the second position does not open

Can you tell me where the wrong code is?

70 pips or 70% which one?

Example GBPJPY if price is 150.000 70 Pips = 150.700,

If 70% = 150 * 70% = 225

Which one do you want?

 
ghobar:

Hello to all professors

I want the second position to be 1.70% higher than the first position

I also wrote this code, but it is wrong and the second position does not open

Can you tell me where the wrong code is?

double lotsi = NormalizeDouble(FindLastSellLot() * 1.70 / 100, 2);

should be ????

double lotsi = NormalizeDouble(FindLastSellLot() * 1.70, 2);

I am assuming that you mean to multiply the lots by 1.70

 
Keith Watford:

should be ????

I am assuming that you mean to multiply the lots by 1.70

Thanks dear,

Its working.