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

 

Question for you. My account does not open on my phone. I mean, it opens on my computer but on my phone it says wrong activation.

 
Vinin:

You should do the cycle backwards. You are using old data.

I've learned how to set flags, but I'm not very good with cycles yet.

Tried as advised below.

Still doesn't fill in the sections. What could be wrong?


int start()
  {
    int counted_bars=IndicatorCounted(),                      
    limit;
    double
    raznica,raznica_static,MA_1_t,MA_2_t;
    
  if(counted_bars>0)
      counted_bars--;
   limit=Bars-counted_bars;
   static double MA_otshet;  //здесь хранится информация по MA_otshet
   for (int i=limit-1; i>=0; i--)
   {  
      MA_1_t=iMA(NULL,0,7,0,MODE_EMA,PRICE_CLOSE,i+0);  
      MA_2_t=iMA(NULL,0,7,0,MODE_EMA,PRICE_CLOSE,i+1); 
      raznica=MA_1_t-MA_2_t; //разница между сегодня и вчера по скользящей средней
      raznica_static=MA_1_t-MA_otshet; //разница между сегодня и MA_otshet
      RefreshRates();   
      if(raznica > -0.003 && raznica < 0.003 && flag) // если raznica не превышает заданное число 
          {
          MA_otshet=MA_2_t; // записываем значение MA_otshet
          ExtMapBuffer1[i]=MA_otshet; //рисуем значение индикатора, как и вчера
          flag=false; // устанавливаем флаг запрета дальнейших расчетов
          }
      if(raznica_static > -0.003 && raznica_static < 0.003) //если raznica_static не превышает заданное число
          {
          ExtMapBuffer1[i]=MA_otshet;  // то рисуем значение индикатора, как записанный MA_otshet
          }
      if((raznica > 0.003) || (raznica < -0.003)) // если raznica превышает заданное число
          {
          ExtMapBuffer1[i]=MA_1_t; // то рисуем значение по текущей цене
          flag=true; // разрешаем дальнейшие вычисления для расчета в диапазоне от -0.0035 до 0.0035
          }
   }  
   return(0);
  }
//+------------------------------------------------------------------+
 
Forexman77:

I've learned how to set flags, but I'm not very good with cycles yet.

Can you tell me approximately how to do this?



 
int    i, k=OrdersTotal();
 
  for (i=0; i<k; i++) // Прямая
     {
     }

  for (i=k-1; i>=0; i--) // наоборот
     {
     }
 
thinker7:
Hi all! How do I write an EA to open several pending orders simultaneously in both directions with the same sl and different tp.
Try stop using AccountBalans and take profit using AccountFreeMargin.
 

Hi! Can you tell me what's wrong here? It doesn't put the stops.

double SL1 = High [iHighest (Symbol(),0,MODE_HIGH,3,1)];

OrderSend (Symbol(),OP_SELL,Lot,Bid,SL1,0,0,"",Magic,0,Blue);


 
question cleared)
 

I don't know who invented mathematics. The devil probably did. Definitely not my science.

Can you give me a hint, please, if you're good at it? I need to derive a relationship from the table below. I can't work out a formula for the dependence of the lot on the deposit increment in percent:

2000+00% = 2000/2000=1.0 ---> 0.01
2000+10% = 2200/2000=1.1 ---> 0.02
2000+20% = 2400/2000=1.2 ---> 0.03
2000+30% = 2600/2000=1.3 ---> 0.04
2000+40% = 2800/2000=1.4 ---> 0.05
2000+50% = 3000/2000=1.5 ---> 0.06
2000+60% = 3200/2000=1.6 ---> 0.07
2000+70% = 3400/2000=1.7 ---> 0.08
2000+80% = 3600/2000=1.8 ---> 0.09
2000+90% = 3800/2000=1.9 ---> 0.10
2000+100% = 4000/2000=2.0 ---> 0.11
2000+110% = 4200/2000=2.1 ---> 0.12
2000+120% = 4400/2000=2.2 ---> 0.13
2000+130% = 4600/2000=2.3 ---> 0.14
2000+140% = 4800/2000=2.4 ---> 0.15
2000+150% = 5000/2000=2.5 ---> 0.16

And so on. Eyes see, and the formula can not make. I sat up all night. Logic does not want to do. Help me out here.

 
artmedia70:

I don't know who invented mathematics. The devil probably did. Definitely not my science.

Can you give me a hint, please, if you're good at it? I need to derive a relationship from the table below. I can't work out a formula for the ratio of lot to deposit growth as a percentage:

2000+00% = 2000/2000=1.0 ---> 0.01
2000+10% = 2200/2000=1.1 ---> 0.02
2000+20% = 2400/2000=1.2 ---> 0.03
2000+30% = 2600/2000=1.3 ---> 0.04
2000+40% = 2800/2000=1.4 ---> 0.05
2000+50% = 3000/2000=1.5 ---> 0.06
2000+60% = 3200/2000=1.6 ---> 0.07
2000+70% = 3400/2000=1.7 ---> 0.08
2000+80% = 3600/2000=1.8 ---> 0.09
2000+90% = 3800/2000=1.9 ---> 0.10
2000+100% = 4000/2000=2.0 ---> 0.11
2000+110% = 4200/2000=2.1 ---> 0.12
2000+120% = 4400/2000=2.2 ---> 0.13
2000+130% = 4600/2000=2.3 ---> 0.14
2000+140% = 4800/2000=2.4 ---> 0.15
2000+150% = 5000/2000=2.5 ---> 0.16

And so on. I can see with my eyes, but I cannot make up a formula. I was up all night. I don't want to use logic. Please, help me.

Somehow.
Files:
 
Like code:
//+---------------------------------------------------------+
#property indicator_separate_window
#property indicator_buffers 1
#property indicator_color1 blue
double Buf_0[];
int init()
{
SetIndexBuffer(0,Buf_0);
SetIndexStyle(0,DRAW_LINE,STYLE_SOLID,3);
}
return;
int start()
{
double A, B;
bool C;
A = 1;
B = 3;
C = A + B;

return; }

//+---------------------------------------------------------+

How do I assign the buffer to the line output?

 
Thank you to those who helped me yesterday to find out about the existence of the MQ4 programming guide!
Reason: