[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 587

 
gawrik:

easy to say... :) is it possible for someone with little knowledge to do so?

Did you look carefully at the link you were given? I quote: e-CloseByProfit.rar The Expert Advisor closes all positions when they reach a specified total profit or loss level in pips .
 

Question,

Is the value of the ticket of the pending order and the ticket after the execution of this pending order the same?

 
DOCTORS:

Question,

Is the value of the ticket of the pending order and the ticket after the execution of this pending order the same?


No
 
PapaYozh:

No
Yes, the ticket does not change.
 
alsu:
Yes, the ticket does not change.
The only exception is that the broker might execute your pending order as several market orders (for example, dividing the volume of 7.5 lots into 5.0 + 2.5). Then the ticket of one market order will coincide with that of the pending order, and the other ones will be different. This situation really happened to me, I had to handle it. Check with your broker/DC.
 
alsu:
The only exception, the broker can execute your pending order as a few market orders (for example, dividing the volume of 7.5 lots into 5.0 + 2.5). Then the ticket of one market order will coincide with that of the pending order, and the other ones will be different. This situation really happened to me, I had to handle it. Check with your broker/DC.

OK, thanks for the answer!

I'll draw two helpers for two different directions then.

Question - how to define a ticket order without cycle?

I am confused... Can you suggest a function?

 

Forum members, here's a question:

Why, if you test in the strategy tester the same Expert Advisor, on the same date, there are different results every time. Why does this happen?

 

Hello. I am not at all good at programming. Therefore, I am asking for help, please help me add StopLoss and TrailingStop to my code. The Expert Advisor is not mine, but the strategy is not bad, so trial and error remaking the EA for myself - and to be honest, I`m already blowing my mind, and there is not much time - work. I have already tried and tested it and, frankly, I have no time to waste - I have to work. And here is what I do with it:



//+------------------------------------------------------------------+
//|                                             stohastic_system.mq4 |
//|                                                    Анатолий      |                                                                  |
//+------------------------------------------------------------------+

extern double Lots=0.4;
extern int TakeProfit=50;
extern int NWave=2;
extern int K=9;
extern int D=3;
extern int slowing=5;
extern int Average_method=2;
extern int price_field=0;

int K_level=0;
int down=0;
int up=0;


int init()
  {

   return(0);
  }

int deinit()
  {

   return(0);
  }

int start()
  {
    int ticket=0;
    double stoch_1=iStochastic(NULL,0,K,D,slowing,Average_method,price_field,MODE_MAIN,1);
    double stoch_2=iStochastic(NULL,0,K,D,slowing,Average_method,price_field,MODE_MAIN,2);
    double stoch_3=iStochastic(NULL,0,K,D,slowing,Average_method,price_field,MODE_MAIN,3);
    int Hour_curr=TimeHour(TimeCurrent());
    
    if ((stoch_1>90)&&(stoch_2>70)) K_level=90;
    if ((stoch_1<10)&&(stoch_2<30)) K_level=10;  
    if(OrdersTotal()<1)
      {        
        if((Hour_curr>=1)&&(Hour_curr<24))//проверка сигналов только в этот промежуток времени
          {
            if((K_level==10)&&(stoch_1>10))//сигнал на покупку
              {
                RefreshRates();
                Print("Сигнал на покупку. stoch_1=",stoch_1," stoch_2=",stoch_2);
                ticket=OrderSend(Symbol(),OP_BUY,Lots,Ask,10,0,Ask+TakeProfit*Point,"buy_order1",1,0,Blue);
                
                K_level=10; 
                down=0;               
              }
            if((K_level==90)&&(stoch_1<90))//сигнал на продажу
              {
                RefreshRates();
                Print("Сигнал на продажу. stoch_1=",stoch_1," stoch_2=",stoch_2);
                ticket=OrderSend(Symbol(),OP_SELL,Lots,Bid,10,0,Ask-TakeProfit*Point,"sell_order1",1,0,Red);
               
                K_level=90;
                up=0; 
              }
          }
      }
    
   
   
    return(0);
  }
   
Files:
 
link1:

Forum members, here's a question:

Why, if you test in the strategy tester the same Expert Advisor, on the same date, there are different results every time. Why does this happen?

Alternatively, the spread used in testing changes
 
ilunga:
Alternatively, the spread used in testing is changed

the date is the same, from February 15 to February 16