[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 371

 
avatara >> :

>> and what's the platform revision?

- >> Build 225

 
Vinin >> :

The indicator light should probably be thrown out. Or ask Father Christmas. It's New Year's Eve.


Well, what could have happened?! Magnetic storms, pressure or something... Nothing's changed, and then suddenly, the terminal freezes.
 
Fosfalugel писал(а) >>

Well, what could have happened?! Magnetic storms, pressure or something... Nothing's changed, and then suddenly the terminal freezes.

To do this, you should at least look at the indicator code. Although it may not be the case.

 
Fosfalugel >> :
Was working with one indicator, everything was fine, then when I switched timeframes the terminal started to hang, reinstalled windup, still hangs. Why(((((((((((((


Please give me the code. Let's see what might be glitching there.
 

Hello!

Please help me, if you are not a problem.

I need an EA to place BUYSTOP SELLSTOP pending orders, instead of opening positions immediately by the signal.

And when a pending order triggers, it removes pending orders that are not triggered.

I would like to ask you to review this code, it has not been written by professionals.

I want to ask you to review this code and explain why I should do it with my fingers (I don't know how to cook, I just don't know how to cook).

The code itself;

extern double lots=0.01;
extern double slippage=3;
extern int TP=5000;
extern int SL=5000;
extern int OrdersCount=1;  // Количество сделок, открываемых одновременно
extern int TrailingStop=0; // Коридор для стоп-лосса
extern int CCIPeriod=12;
extern bool AllowOpenBuy=true;
extern bool AllowOpenSell=true;

//extern int SL=1000;
int current, previous;

int ticket=0;

int BuyTickets[999];
int SellTickets[999];


int init()
{double Up, Dn;

      Up=iCustom(NULL,0, IndicatorName,0, Offset);
      Dn=iCustom(NULL,0, IndicatorName,1, Offset);
      if ( Up!=0) previous=1;
      if ( Dn!=0) previous=-1;

}

int start()
  {   
      double Up, Dn, cup, cdn, cci;
      Up=iCustom(NULL,0, IndicatorName,0, Offset);
      Dn=iCustom(NULL,0, IndicatorName,1, Offset);

      cup=iCustom(NULL,0, IndicatorName,0,0);
      cdn=iCustom(NULL,0, IndicatorName,1,0);
      
      
      //if (NewBar()==false) return (-1);
      //return (0);/*
      
      //cci=iCCI(NULL,0,CCIPeriod,MODE_CLOSE,0);
      
      if ( Up!=0) current=1;
      if ( Dn!=0) current=-1;
      
      TrailingStopControl();  // Выставление стоповых уровней
      
      if ( current!= previous){
      if ( current==1)
            {
                  OpenBuyOrders();
            }
      
      if ( current==-1)
            {
                  OpenSellOrders();
            }           
            previous= current;
            }
            
   return(0);
  }
  
void  TrailingStopControl()
{
  for(int cnt=0; cnt< OrdersCount; cnt++)
   {
         if (!OrderSelect( BuyTickets[ cnt], SELECT_BY_TICKET)) return(1);
      if(OrderSymbol()==Symbol())
      {
      if(OrderType()==OP_BUY)
         {
         if( TrailingStop>0
         && Bid-OrderOpenPrice()>Point* TrailingStop
         && OrderStopLoss()<Bid-Point* TrailingStop)
            {
            OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point* TrailingStop,OrderTakeProfit(),0);
            return(0);
            }
         }
      if(OrderType()==OP_SELL)
         {
         if( TrailingStop>0
         && OrderOpenPrice()-Ask>Point* TrailingStop
         && (OrderStopLoss()>Ask+Point* TrailingStop || OrderStopLoss()==0))
            {
            OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point* TrailingStop,OrderTakeProfit(),0);
            return(0);
            }
         }
      }

         if (!OrderSelect( SellTickets[ cnt], SELECT_BY_TICKET)) return(1);
   if(OrderSymbol()==Symbol())
      {
      if(OrderType()==OP_BUY)
         {
         if( TrailingStop>0
         && Bid-OrderOpenPrice()>Point* TrailingStop
         && OrderStopLoss()<Bid-Point* TrailingStop)
            {
            OrderModify(OrderTicket(),OrderOpenPrice(),Bid-Point* TrailingStop,OrderTakeProfit(),0);
            return(0);
            }
         }
      if(OrderType()==OP_SELL)
         {
         if( TrailingStop>0
         && OrderOpenPrice()-Ask>Point* TrailingStop
         && (OrderStopLoss()>Ask+Point* TrailingStop || OrderStopLoss()==0))
            {
            OrderModify(OrderTicket(),OrderOpenPrice(),Ask+Point* TrailingStop,OrderTakeProfit(),0);
            return(0);
            }
         }
      }
             
   }


}

bool NewBar()
  {
   static datetime dt=0;
   if (Time[0]!= dt)
     {
      dt=Time[0];
      return(true);
     }
   return(false);
  }
  
  
  void OpenBuyOrders()
  {
    for (int i=0; i< OrdersCount; i++)  
      OrderClose( SellTickets[ i], lots,Ask, slippage,Red);


   if (! AllowOpenBuy) return(1);
    for ( i=0; i< OrdersCount; i++)  
      BuyTickets[ i]=OrderSend(Symbol(),OP_BUY, lots,Ask, slippage,Ask-Point* SL,Ask+Point* TP,"",0,0,Green);

  }


  void OpenSellOrders()
  {
    for (int i=0; i< OrdersCount; i++)  
      OrderClose( BuyTickets[ i], lots,Bid, slippage,Red);

   if (! AllowOpenSell) return(1);
    for ( i=0; i< OrdersCount; i++)  
      SellTickets[ i]=OrderSend(Symbol(),OP_SELL, lots,Bid, slippage,Bid+Point* SL,Bid-Point* TP,"",0,0,Green);
  }
 
Happy New Year, Comrades !!!
Got the XMA indicator from Crunch http://https://www.mql5.com/en/code/9123
I tried to do with it
xxma = iCustom(NULL,15, "Xma",100,7,1,0,1,1,0);
It returns 0.
What's wrong? The turret is where it should be.
 
spm130275 писал(а) >>
Happy New Year, Comrades !!!
I have an XMA indicator from Crunch http://https://www.mql5.com/en/code/9123
I tried to do with it
xxma = iCustom(NULL,15, "Xma",100,7,1,0,1,1,0);
It returns 0.
What's wrong? Indy is where it should be.

xxma = iCustom(NULL,15, "Xma",100,7,1,0,1,0,0);

 

Thank you!

 

Please advise.

Suppose we have optimization results.

Is it possible to separate the flies from the cutlets by the Profit Trades (% of total) criterion?

 

I would like to prohibit the EA from trading in advance of important news, but not manually, but automatically (and without referring to news sites).

- What are the signs that could more or less reliably inform about possible news releases? (significant spread widening, strong price fluctuations in short periods of time), ...anything else?