[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 921

 
Nilog:
I tried it that way. Only one signal comes out anyway. :((((((((((

if (Balance < Loss)
{
switch(Delta) {

case 1: PlaySound("LossLimitReached.wav"); Sleep (1000); break;

case 2: PlaySound("LossLimitReached.wav"); Sleep (1000); break;

case 3: PlaySound("LossLimitReached.wav"); Sleep (1000); break;

case 4: PlaySound("LossLimitReached.wav"); Sleep (1000); break;

case 5: PlaySound("LossLimitReached.wav"); Sleep (1000); break;

}

} Maybe so then, I don't have any other options for sure,).

 
gheka:

if (Balance < Loss)
{
switch(Delta)

Nope.

OK, I had a custom turkey made two years ago that rang the right number of times, you could set how many. I'm gonna go through the mail, see if I can find it.

 
gheka:
Necron:
it means there are already open positions in the account
I have not touched my account yet,

I opened a new demo account, i never touched the deposit.

NormalizeDouble(), check for maximum/minimum lot limit, if five digits - increase stop and profit by 10 times.
 

Hello!!

Can anyone suggest an indicator that shows the remaining time of a candle or bar?

I couldn't find it in the code base .....

 
igrok2008:

Hello!!

Can anyone suggest an indicator that shows the remaining time of a candle or bar?

I couldn't find it in the code base .....

There's a lot of different ones.

https://www.forex-tsd.com/indicators-metatrader-4/9487-candle-time.html

Here's one.

Files:
 

One more question.

Expert Advisor compares a candle (closed) black or white.... Black when open>close white when closed... The chart is 60 min. I want to compare and closed candlestick on 30 min chart.

Please advise who can do what. Here is the code

//+------------------------------------------------------------------+
//|                                                   e_po_baram.mq4 |
//|                      Copyright © 2009, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2009, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"

//---- input parameters
extern double    Lots=0.01;
extern int       StopLoss=1500;
extern int       TakeProfit=100;
extern int       MagicNumber=123456;
//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
  
bool CheckOrders(int Type)
{
 bool Result=True;
 for(int i=0;i<OrdersTotal();i++)
  if(OrderSelect(i,SELECT_BY_POS))
   if(OrderMagicNumber()==MagicNumber && OrderSymbol() == Symbol())
      if(OrderType()==Type)
        {
         if(Type==OP_BUY)
           if(!OrderClose(OrderTicket(),OrderLots(),Bid,0))
             Result=False;
         if(Type==OP_SELL)
           if(!OrderClose(OrderTicket(),OrderLots(),Ask,0))
             Result=False;
         } 
        else Result=False;
 return(Result); 
}
  
  
  
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start()
  {
    // Узнаем уровень стопов и спрэд
    int Spread = MarketInfo(Symbol(), MODE_SPREAD);
    int StopLevel = MarketInfo(Symbol(), MODE_STOPLEVEL);

        
   //-------------открытие позиции Buy покупка----------------- 
    if(
    (Open[i]>Close[i])&& //проверка свечи белая или чёрная для 60 мин
    () //проверка свечи белая или чёрная для 30 мин
    ) //торговое условие на покупку
     if(CheckOrders(OP_SELL))
      {
       if(StopLoss <= StopLevel+Spread)
         double SL = 0;
        else
         SL = Ask - StopLoss*Point;
       if(TakeProfit <= StopLevel-Spread)
         double TP = 0;
        else
         TP = Ask + TakeProfit*Point;
       if(!OrderSend(Symbol(), OP_BUY, Lots, Ask, 10, SL, TP, NULL, MagicNumber))
         Print("Не открыт ордер Buy. Ошибка №", GetLastError()); 
       }
    //-------------------Конец блока покупки -------------------
    
    //-------------Открытие позиции Sell продажа----------------  
    if(
    (Open[i]<Close[i])&& //проверка свечи белая или чёрная для 60 мин
    () //проверка свечи белая или чёрная для 30 мин
    )//торговое условие на продажу
     if(CheckOrders(OP_BUY))
      {
       if(StopLoss <= StopLevel+Spread)
         SL = 0;
        else
         SL = Bid + StopLoss*Point;
       if(TakeProfit <= StopLevel-Spread)
         TP = 0;
        else
         TP = Bid - TakeProfit*Point;
       if(!OrderSend(Symbol(), OP_SELL, Lots, Bid, 10, SL, TP, NULL, MagicNumber))
         Print("Не открыт ордер Sell. Ошибка №", GetLastError()); 
       }

//-----------------конец блока продажи ----------------------
   return(0);
  }
//+------------------------------------------------------------------+
 
Nilog:

There are lots of different ones

https://www.forex-tsd.com/indicators-metatrader-4/9487-candle-time.html

Thank you
 
How can I tell if there are any open orders?
 
Necron:
Do normalize (NormalizeDouble()), check for maximum/minimum lot limit, if five digits - increase stop and profit by 10 times.

double NormalizeDouble( double value, int digits)

value - Floating point value. --- what is it?
digits - Precision format, the number of digits after the decimal point (0-8). --- like 1.29800 is 5 digits, right?

 
How do I identify the type of order that is open?