Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 542

 

Hello. Can you tell me how to bring - set the StopLoss price for the second and subsequent orders to the same price as the StopLoss of the first open market order?

This is how I send - I open the first market order

  if (TimePrev == Time[0]) return(0);   
  TimePrev = Time[0];

  int TradeSignal = GetSignal();
  
  //новая покупка
  if (TotalBuyOrders == 0 && NewTradeBuy && TradeSignal > 0 && (DualTrade == true || TotalSellOrders == 0))
    SendMarketOrder(OP_BUY, GetStartLot(), StaticTakeProfit, StopLoss, MagicNumberBuy, TimeCurrent() + "|"); 

This is how I send the second order, I average on the peaks within a reasonable range.

//ещё покупаю 
TotalBuyOrders = CountOfOrders(MagicNumberBuy);
  if(TotalBuyOrders > 0 && TotalBuyOrders < MaxTrades)
  {
    OrderSended = -1;
    LastBuyPrice = FindLastOrderParameter(MagicNumberBuy, "price");

    if(LastBuyPrice - Ask >= GetPipstepForStep(TotalBuyOrders + 1) * vPoint)
    {
      BLot   = GetLotForStep(MagicNumberBuy, TotalBuyOrders);
      BComment = StringSubstr(LastOrderComment, 0, StringFind(LastOrderComment, "|", 0)) + "|";
      OrderSended = SendMarketOrder(OP_BUY, BLot, 0, StopLoss, MagicNumberBuy, BComment); // как отправить приказ с таким же стопом как у первого открытого ордера
    }
  }
 
tatianati:

Hello. Can you tell me how to bring - set the StopLoss price for the second and subsequent orders to the same price as the StopLoss of the first open market order?

This is how I send - I open the first market order

This is how I send the second order, I average on the peaks within a reasonable range.

Show the place where StopLoss is calculated.
 
tatianati:

Hello. Can you tell me how to bring - set the StopLoss price for the second and subsequent orders to the same price as the StopLoss of the first open market order?

This is how I set it - I open the first market order

This is how I send the second order and average it on reasonable peaks.

Declare a variable on the global level, assign its value to it when the first order is opened and use it when opening the averaging orders.

The next time the first order is opened, the variable is overwritten.

 
Greetings. There is a good indicator (https://www.mql5.com/ru/code/7304)Ind-Fractals-1. But it only uses M15, H1, H4, D1. I think it would be good if there were both W1 and MN. I am not so good at indicator programming. But logically, it is probably not difficult to add to the code. Unless, of course, there are any limitations. I did so.

But if(Period()==D1)P=15*Point;
if(Period()==H4)P=7*Point;
if(Period()==H1)P=4*Point;
if(Period()==30)P=3*Point;
if(Period()==M15)P=2*Point;
if(Period()==5)P=1*Point;
if(Period()==1)P=0.5*Point;
for(int shift=B;shift>0;shift--)

This is my thinking: there are two ways out.

1. You can add missing parts and get an indicator with fractals from M15 to MN.

If it is not technically possible, then we can make an indicator based on it with H4, D1, W1, MN fractals.


Please advise how to make, who is in the subject.
 
Hi all!

When I migrated to new version 610 of MT4 some indicators do not work anymore, on recompilation I get error event handling function not found 1 1 !

Please advise how to remove it?

Search on the forum did not give anything, and inet too, silence!

 
Hello, in which topic can I post this?
 
niktron:
Hi, where can I put this?

"Grail."
 
Vinin:

In "Graal".

didn't find one.))
 
niktron:

(I couldn't find one.))

Weird, there seem to be a lot
 

https://www.mql4.com/ru/search#!keyword=%D0%B3%D1%80%D0%B0%D0%B0%D0%BB%D1%8C&module=mql4_module_forum

It'll take until retirement to disassemble... :-)))