Errors, bugs, questions - page 1921

 

Compilation error

template<typename T1, typename T2>
void f( T2 t )
{
        Print( typename( T1 ), ":", typename( T2 ), ":", t );
}
void OnStart()
{
        char ch = 5;
        f<int>( ch ); //(1) //error: 'f' - wrong template parameters count
}

A record is compiled

         f<int,char>( ch ); //(2)
which contains redundant information and moreover ambiguity if ch is not char. Moreover, in macros information about ch type is generally not available (depends on context)
 
A100:

Error during compilation

Is it possible to do this in the pros?

 
Комбинатор:

Is it allowed in the pluses?

C++ compiles both variants, but (1) seems more correct and intuitive. In (2), we have to keep in mind types too, which is inconvenient and instead of simplification we get excessive complication, which is clearly seen if <> has several typename
 

no alerts disappear, tried everything, read everything, no alerts on μl website only on the terminal...


 
Vladimir Pastushak:

The alerts won't go away, I've tried everything, I've read everything, there are no alerts on the μl website, only on the terminal...

This has been the case since the beginning.

There was a thread here that found out which file to delete to make them tick as read. But then the "ghosts" still appear.

 
Hello. Can you tell me why the gold quotes on the demo are increasingly missing?
 

The .log files %AppData%\MetaQuotes\Terminal\...\MQL5\Logs\YYYYMMDD.log are not updated promptly

The update only happens: after restarting the terminal or selecting View menu. If you don't restart or click Preview, the corresponding file will be empty.

Everything used to work before (even the YYYYYMMDD.log file opened in MetaEditor would be updated in a few seconds after displaying rows in Experts tab) and no extra non-obvious actions had to be performed

 

Good night! My Expert Advisor has RSI and STO, but I can not make a buy or sell signal open on a new candle, and not on the current one!

the code is like this:

void OnTick(){

for (int i=0; i<OrdersTotal(); i++)

if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
if (OrderSymbol()==Symbol() && Magic==OrderMagicNumber())
return;

double RSI0 = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, 0);
double RSI1 = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, 1);

double STO0=iStochastic(NULL, 0, KPeriod, DPeriod, Slowing, MODE_SMA, STO_LOWHIGH, MODE_MAIN, 0);
double STO1=iStochastic(NULL, 0, KPeriod, DPeriod, Slowing, MODE_SMA, STO_LOWHIGH, MODE_MAIN, 1);

double STO2 = iStochastic(NULL, 0, KPeriod, DPeriod, Slowing, MODE_SMA, STO_LOWHIGH, MODE_SIGNAL, 0);
double STO3 = iStochastic(NULL, 0, KPeriod, DPeriod, Slowing, MODE_SMA, STO_LOWHIGH, MODE_SIGNAL, 1);

double SL=0,TP=0;

if (RSI1 < RSIDownLevel && RSIDownLevel < RSI0 && STO2 < STO0){

if (takeprofit!=0) TP = NormalizeDouble(Ask + takeprofit*Point,Digits);
if (stoploss!=0) SL = NormalizeDouble(Ask - stoploss* Point,Digits);
if (OrderSend(Symbol(),OP_BUY, Lot,NormalizeDouble(Ask,Digits),slippage,SL,TP,NUL L,Magic)==-1) Print(GetLastError())
}

if (RSI1 > RSIUpLevel && RSIUpLevel > RSI0 && STO3 > STO1){

if (takeprofit!=0) TP = NormalizeDouble(Bid - takeprofit*Point,Digits);
if (stoploss!=0) SL = NormalizeDouble(Bid + stoploss* Point,Digits);
if (OrderSend(Symbol(),OP_SELL,Lot,NormalizeDouble(Bi d,Digits),slippage,SL,TP,NULL,Magic)==-1) Print(GetLastError())
}

return(0);
}


Again, I have to repeat that my order is triggered by opening on the current candle, and I need the order to open on the next! Please help me!!!

 
sviter-pro:

Goodnight! My Expert Advisor has RSI and STO, but I cannot make it open on a new candle when a buy or sell signal goes off, and not on the current one!

Again, my order is triggered on the current candle, but I need the order to open on the next one!!! Help please!!!


//+------------------------------------------------------------------+
void OnTick()
  {

   for(int i=0; i<OrdersTotal(); i++)
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES))
         if(OrderSymbol()==Symbol() && Magic==OrderMagicNumber())
            return;

   double RSI0 = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, 0);
   double RSI1 = iRSI(NULL, 0, RSIPeriod, PRICE_CLOSE, 1);

   double STO0=iStochastic(NULL, 0, KPeriod, DPeriod, Slowing, MODE_SMA, STO_LOWHIGH, MODE_MAIN, 0);
   double STO1=iStochastic(NULL, 0, KPeriod, DPeriod, Slowing, MODE_SMA, STO_LOWHIGH, MODE_MAIN, 1);

   double STO2 = iStochastic(NULL, 0, KPeriod, DPeriod, Slowing, MODE_SMA, STO_LOWHIGH, MODE_SIGNAL, 0);
   double STO3 = iStochastic(NULL, 0, KPeriod, DPeriod, Slowing, MODE_SMA, STO_LOWHIGH, MODE_SIGNAL, 1);

   double SL=0,TP=0;
   
   if(NewBar())
     {
      if(RSI1<RSIDownLevel && RSIDownLevel<RSI0 && STO2<STO0)
        {

         if(takeprofit!=0) TP=NormalizeDouble(Ask+takeprofit*Point,Digits);
         if(stoploss!=0) SL=NormalizeDouble(Ask-stoploss *Point,Digits);
         if(OrderSend(Symbol(),OP_BUY,Lot,NormalizeDouble(Ask,Digits),slippage,SL,TP,NUL L,Magic)==-1) Print(GetLastError());
        }

      if(RSI1>RSIUpLevel && RSIUpLevel>RSI0 && STO3>STO1)
        {

         if(takeprofit!=0) TP=NormalizeDouble(Bid-takeprofit*Point,Digits);
         if(stoploss!=0) SL=NormalizeDouble(Bid+stoploss *Point,Digits);
         if(OrderSend(Symbol(),OP_SELL,Lot,NormalizeDouble(Bi d,Digits),slippage,SL,TP,NULL,Magic)==-1) Print(GetLastError());
        }
     }

   return(0);
  }
//+------------------------------------------------------------------+
bool NewBar()
  {
   static datetime time=0;
   if(time==0)
     {
      time=Time[0];
      return false;
     }
   if(time!=Time[0])
     {
      time=Time[0];
      return true;
     }
   return false;
  }
//+------------------------------------------------------------------+
 
sviter-pro:

Good night! My Expert Advisor has RSI and STO, but I cannot make it so, that when a buy or sell signal is triggered, it opens on a new candle, and not on the current one!

the code is like this:

Again, I have to repeat that my order is triggered by opening on the current candle, and I need the order to open on the next! Please help me!!!

You take the indicator values from bars 0 and 1.

Instead of 0 and 1 take the values from 1 and 2 respectively.