[ARCHIVE!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Can't go anywhere without you - 4. - page 336

 
It's not quite clear how you want to add a stop loss to the trailing order. Maybe you mean like this: you place an order, on the next tick you modify it by setting a stop loss, then you connect a trailing order to it, which modifies the order by changing the stop loss. This process can be used. If for some reason at some point you do not like where the trailing stop loss has moved, you modify the stop loss of the order.
 
I have a lot of experience in this area... I'm having trouble with this, but I'm having trouble finding it... If I can't figure out how to get it to work, I'll have to ask my question... I've been trying for a long time but i can't get anything done....if you're not hard, tell me who knows...
 

Are there any developers here, please comment:


Or should you ask the DC about it?


void start()
  {
  double tickvalue = MarketInfo(Symbol(), MODE_TICKVALUE);

  for(int i = OrdersHistoryTotal()-1; i >= 0;i--)
    {
    if(!OrderSelect(i,SELECT_BY_POS,MODE_HISTORY )) continue;
    if(OrderSymbol()!=Symbol() || OrderType() >= 2) continue;
    if(OrderType() == 0)
      {
      Alert((OrderClosePrice() - OrderOpenPrice())/Point*tickvalue*OrderLots()," <-Buy history-> ",OrderProfit());
      }
    if(OrderType() == 1)
      {
      Alert((OrderOpenPrice() - OrderClosePrice())/Point*tickvalue*OrderLots()," <-Sell history-> ",OrderProfit());
      }
    }
  }
 
fore-x:

Are there any developers here, please comment:


Or should you ask your brokerage company about it?



About rounding in tenths of cents or kopecks (what is your deposit amount) even schoolchildren will answer you.

 
P_I_R_A_T_E:
Could you please tell me which code to paste into my EA to make it open 2 buy and sell orders at once after a certain amount of points ...
You cannot. The buy and sell orders have different prices, so you cannot open them at one price at once, i.e. open them at one price. In fact, a single-threaded MT4 cannot open orders by the market simultaneously, even with different prices.
 
Reshetov:
There is no way. The buy and sell orders have different prices so we will not be able to open them at one price at once. In fact, a single-threaded MT4 cannot open orders by the market simultaneously, even with different prices.

Thanks for the reply... what if I open pending stop orders? with a grid both up and down? with a fixed lot is it realistic to do the same? when a pair opens, a new pair opens in an empty space before the newly opened one?

 
Roll:


Even schoolchildren can tell you how to round off a tenth of a cent or a kopeck (whatever your deposit is).

If it was rounded, I would not ask. Look at the screenshot, you cannot round some values, in short, the results are different. Here you go, round it up:


double profit;
bool norm = false;

void start()
  {
  double tickvalue = MarketInfo(Symbol(), MODE_TICKVALUE);

  for(int i = OrdersHistoryTotal()-1; i >= 0;i--)
    {
    if(!OrderSelect(i,SELECT_BY_POS,MODE_HISTORY )) continue;
    if(OrderSymbol()!=Symbol() || OrderType() >= 2) continue;
    if(OrderType() == 0)
      {
      profit = (Normalize(1, norm) - Normalize(2, norm))/Point*tickvalue*Normalize(3, norm);
      Alert(Normalize(4, norm)," <-Buy history-> ",OrderProfit());
      }
    if(OrderType() == 1)
      {
      profit = (Normalize(2, norm) - Normalize(1, norm))/Point*tickvalue*Normalize(3, norm);
      Alert(Normalize(4, norm)," <-Sell history-> ",OrderProfit());
      }
    }
  }
  
double Normalize(int x, bool z)
  {
  if(z == true)
    {
    if(x == 1) return(NormalizeDouble(OrderClosePrice(),Digits));
    if(x == 2) return(NormalizeDouble(OrderOpenPrice() ,Digits));
    if(x == 3) return(NormalizeDouble(OrderLots() ,2));
    if(x == 4) return(NormalizeDouble(profit ,2));
    }
  
  if(z == false)
    {
    if(x == 1) return(OrderClosePrice());
    if(x == 2) return(OrderOpenPrice());
    if(x == 3) return(OrderLots());
    if(x == 4) return(profit);
    }
  
  }

 
fore-x:

Are there any developers here, please comment:


Or should you ask the DC about it?


Alert and Comment round off the numbers when they are displayed, although they are actually more accurate.
 
BeerGod:
Alert and Comment round off the numbers when they are displayed, although they are actually more accurate.
They only round up if the number doesn't fit, four decimal places are allowed, and I only have three at the most!
 
What are you shouting about?
Reason: