Any questions from newcomers on MQL4 and MQL5, help and discussion on algorithms and codes - page 899

 
Good afternoon. I need help, because I don't know how to code, write or modify indicators myself. I will be brief.
Can you add a sound notification (Alert) when
CrossUpchanges from 0.00000 to -1.00000
CrossDown from -1.00000 to 0.00000.
Please help, I will be eternally grateful. Thank you.

Files:
 
S.P.I:
Hello. I need help, because I myself do not know anything about coding, writing or changing indicators. I will be brief.
Can you add an audible notification (Alert) when the
CrossUpchanges from 0.00000 to -1.00000
CrossDown from -1.00000 to 0.00000.
Help please, I would be eternally grateful. Thank you.

Wrong format, you need mq4

 
Alekseu Fedotov:

Wrong format, you need mq4

You can also do this with ex4 - resource it and read the buffers.

 
Artyom Trishkin:

It is possible to do this task with ex4 as well - to resources and read buffers.

Why? standard indicator call from indicator via iCustom(), I think it will take 15-20 minutes, let there be 2 indicator files

 
Igor Makanu:

Why? Standard indicator call from the indicator via iCustom(), I think it will take 15-20 minutes, let there be 2 indicator files

There is also iCustom() in resources, but there is one file.

I have two files - let it be two, let it be one. And there is the same amount of work.

 
Alekseu Fedotov:

That's right, do the math .

Yes, but it is already a percentage of profit, some construction should be done so that the variable drawdown is assigned a value at drawdown, and if the position is in profit, the value drawdown = 0.
 
nalyk:
Yes, but it is already a percentage of profit, some kind of a construction has to be invented, so that the variable drawdown is assigned a value at drawdown, and if the position is in profit, then the value drawdown = 0 .
   double drawdown=(AccountProfit()<0 ? AccountProfit()*100/AccountBalance() : 0);
   Comment("текущая просадка  = ",drawdown);
 

Hi, could you tell me how to correctly write the opening of orders from the last fractal. I tried to do it this way, but it doesn't open in the tester.

void CheckForOpen()
{
  
   double hai_candle = iHigh(NULL,TimeCandleTrade,0);
   double low_candle = iLow(NULL,TimeCandleTrade,0); 
   fr_down = iFractals (Symbol(), 0, MODE_LOWER,3);
   fr_up = iFractals(Symbol(),0,MODE_UPPER,3);
   double SL, TP;
  
 if (BuyCount()==0 )
   {
  
    if (fr_down>0 && low_candle<Low[fr_down])
   {
     
      SL = NormalizeDouble(Ask - StopLoss*Point,Digits);
      TP = NormalizeDouble(Ask + TakeProfit*Point,Digits);
      ticket = OrderSend(Symbol(),OP_BUY,Lots,NormalizeDouble(Ask,Digits),Slippage,SL,TP,NULL,magik,0,CLR_NONE);
      if (ticket <0)
       Print ("Не удалось открыть ордер на покупку",GetLastError());
   }
   
   }

int BuyCount()
  {
  int count = 0;
  for (int i=OrdersTotal()-1;i>=0;i--)
  {
    if (OrderSelect(i, SELECT_BY_POS,MODE_TRADES) == true && 
        OrderMagicNumber()== magik &&                        
        OrderType() == OP_BUY )                       
        {
        count ++;
        }
    }
}

 
Artyom Trishkin:
Thank you.
 
nelenaby:

Hi, could you tell me how to correctly write the opening of orders from the last fractal. I tried to do it this way, but it doesn't open in the tester.

You are looking for the fractal on the third bar, it may not be there. Look for the first fractal in the loop.

 
 for (int s=2; s<100; s++) 
     {
    fr_down=iFractals(Symbol(), 0, MODE_LOWER, s);
    if (f!=0) break;
     }