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

 
Artemis is super!!!
 
Roman.:


1. Just in case - read all the information on my links from post 7 of this page.

2. Look at the trailer for a walkthrough of your question. The second file is my example of working with the strategy optimizer and the dependence, currently on the graph, of the stop and profit values of the TS obtained as a result of optimization from the Recovery Factor. I am using it recently myself - I'm still working it out myself, so all questions to its authors. Look at their website through the page.

3. All, IMHO.


Ooh, cool!!! Isn't that program called Excel? How do you use it, how do you save in it?
 

I am a total beginner at this, but please help me write an EA that works this way, first just open a buy order and put a take profit and stop loss, then if this order is closed when take profit is triggered, then opens the same order to buy, and if closed when triggered stop loss is to sell
 
How do I save the results in excel? In the tester I clicked save everything, found and opened excel, clicked paste on a white background, nothing happened. Maybe my brother will come soon and push me out, because of the computer.
 
dkfl.zrjdktdbx:
How do I save the results in excel? In the tester I clicked save everything, found and opened excel, clicked paste on a white background, nothing happened. Maybe my brother will come soon and push me out, because of the computer.
Maybe I should get a second computer.
 
Someday...
 
dkfl.zrjdktdbx:
How do I save the results in excel? In the tester I clicked save everything, found and opened excel, clicked paste on a white background, nothing happened. Maybe my brother will come soon and push me out, because of the computer.

Copy everything and paste, only the name of the columns myself have to write, and profitability translates into months at me.
 
dkfl.zrjdktdbx:

Ooh, cool!!! Isn't that program called Excel? How to use it, how to save in it?

Read its help and MicrosoftOffice-excel documentation... :-)
 

Comrades, I recently asked a question about the fact that the EA works differently on a real account than it does in the strategy tester. You said that without the code of the EA itself there is no way to figure it out. Here is the code:

In a nutshell, the EA works on Martingale principle, i.e. it opens with double lot if the previous trade was not successful. If it is wrong more than 3 times, then I assume that a flat started and change the sizes of lots and stops, but proportionally as if the EA is still opening in the other direction with double lot.

If everything was good, it opens in the same direction with one lot. So here's the problem: In the Strategy Tester everything is working fine, but in my real account it's already opening 2nd trade with 0.24 lot (this number is set in switch function)... Help please ... I really want to try it on a real account, the problem keeps me in the demo account =(

//+------------------------------------------------------------------+ 
//| StMartin++.mq4 | 
//| Sergey Kodolov | 
//| 84232676421@mail.ru | 
//+------------------------------------------------------------------+ 
#property copyright "Sergey Kodolov" 
#property link "84232676421@mail.ru" 

    extern int TP = 1000; 
    extern int TS = 1000; 
    extern double lots = 0.1; 

    double volumz; 
    int ticket,total; 
    int slip = 3; 
    int Magic = 4; 


    static int CriticalTicket = 0; 

    int TicketArray[4]; //миссив с тикетами
    int CTicketArray[10]; //массив с критическими тикетами

    void FormTicket(int number) //объявил шаблон под функцию запоминания тикетов 
    { 
      for(int i=3;i>0;i--) 
      { 
         TicketArray[0] = ticket; 
         if(TicketArray[0]>0 && TicketArray[0] == TicketArray[1])break; 
         TicketArray[i] = TicketArray[i-1]; 
      } 
    } 
    
    void FormCriticalTicket(int number1) //сюда записываю критическме тикеты
    { 
      for(int i=9;i>0;i--) 
      { 
         CTicketArray[0] = CriticalTicket; 
         if(CTicketArray[0]>0 && CTicketArray[0] == CTicketArray[1])break; 
         CTicketArray[i] = CTicketArray[i-1]; 
      } 
    }  


//+------------------------------------------------------------------+ 
//| expert initialization function | 
//+------------------------------------------------------------------+ 
int init() 
  { 
//---- 
     if(OrdersHistoryTotal()==0) 
     { 
        ticket = OrderSend(Symbol(),OP_SELL,lots,Bid,slip,Ask+TS*Point,Ask-TP*Point,"First order",Magic,0,Yellow); //открываем первый ордер 
     } 
//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 
//| expert deinitialization function | 
//+------------------------------------------------------------------+ 
int deinit() 
  { 
//---- 

//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 
//| expert start function | 
//+------------------------------------------------------------------+ 
int start() 
  { 
//---- 
FormCriticalTicket(CriticalTicket); //вызываем функцию, что запоминала критические тикеты
int CritLot = crit(); //функция берет минимальное значение из массива критических тикетов
int OrderTimeCheck = check3(); //проверяем, закрыт ли ордер 
bool OrderCloseCheck = check2(OrderTimeCheck); //проверяем, закрылись ли ордера в минус 
FormTicket(ticket); //вызываем функцию, чтоб запоминала тикеты 
OrderOpenFunction(OrderCloseCheck,CritLot); //тут открываем ордера 

//---- 
   return(0); 
  } 
//+------------------------------------------------------------------+ 


int crit()
{
   return(ArrayMinimum(CTicketArray,6,1));
}

int check3() //проверяем, закрыт ли ордер 
{ 
   OrderSelect(TicketArray[1],SELECT_BY_TICKET); 
   if(OrderClosePrice()==OrderTakeProfit()) 
      { 
         CriticalTicket=0;
      } 
   if(OrderCloseTime()>0)return(100); 
} 

bool check2(int OrderTimeCheck) //проверяем, если ордер закрыт, то последние 3 закрытых ордера были ли убыточными? 
{ 
   if(OrderTimeCheck == 100) 
   { 
      bool flag = true; 
      for(int j=1;j<4;j++) 
      { 
         OrderSelect(TicketArray[j],SELECT_BY_TICKET); 
         if(OrdersHistoryTotal()>2) 
         { 
            if(OrderClosePrice()!=OrderStopLoss()) 
            { 
               flag = false; 
            } 
         } 
         if(OrdersHistoryTotal()<=2) 
         { 
            flag = false; 
         } 
      } 
      return(flag); 
   } 
   else
      return(false); 
} 

void OrderOpenFunction(bool OrderCloseCheck, int CritLot) 
{ 
   total = OrdersTotal();
   if(OrderCloseCheck==true)
   {
      int TP1,TS1;
      double m1,m2,m3,m4,m5,m6;
      m1=1.2;
      m2=1.25;
      m3=2.0;
      m4=1.0;
      m5=1.25;
      m6=1.0;
   
      OrderSelect(TicketArray[1],SELECT_BY_TICKET); 
      switch(CritLot)
      {
         case 1: volumz = (OrderLots()*2)*m1;
                  TP1=TP/m1;
                  TS1=TS/m1; 
                  break;
         case 2: volumz = (OrderLots()*2)*m2/m1;
                  TP1=TP/m2;
                  TS1=TS/m2; 
                  break;
         case 3: volumz = (OrderLots()*2)*m3/m2;
                  TP1=TP/m3;
                  TS1=TS/m3; 
                  break;
         case 4: volumz = (OrderLots()*2)*m4/m3;
                  TP1=TP/m4;
                  TS1=TS/m4;
                  break;
         case 5: volumz = (OrderLots()*2)*m5/m4;
                  TP1=TP/m5;
                  TS1=TS/m5;
                  break;
         case 6: volumz = (OrderLots()*2)*m6/m5;
                  TP1=TP/m6;
                  TS1=TS/m6;
                  break;
      }

      if(total < 1) 
      { 
         if(OrderType()==OP_SELL) 
         { 
            double lot3 = volumz; 
            ticket = OrderSend(Symbol(),OP_BUY,lot3,Ask,slip,Bid-TS1*Point,Bid+TP1*Point,0,Magic,0,Green); 

            if(ticket>0) 
            { 
               CriticalTicket = ticket; 
            } 
         } 
         if(OrderType()==OP_BUY) 
         { 
            OrderSelect(TicketArray[1],SELECT_BY_TICKET); 
            double lot4 = volumz; 
            ticket = OrderSend(Symbol(),OP_SELL,lot4,Bid,slip,Ask+TS1*Point,Ask-TP1*Point,0,Magic,0,Red); 

            if(ticket>0) 
            { 
               CriticalTicket = ticket; 
            } 
         } 
      } 
   }   
   if(OrderCloseCheck==false) 
   { 
      if(total < 1) 
      { 
         OrderSelect(TicketArray[1],SELECT_BY_TICKET); 
         volumz = OrderLots(); 
         if(OrderClosePrice() == OrderStopLoss()) 
         { 
            if(OrderType() == OP_BUY) 
            { 
               double lot1 = volumz*2; 
               ticket = OrderSend(Symbol(),OP_SELL,lot1,Bid,slip,Ask+TS*Point,Ask-TP*Point,0,Magic,0,Red); 
            } 
            if(OrderType() == OP_SELL) 
            { 
               double lot2 = volumz*2; 
               ticket = OrderSend(Symbol(),OP_BUY,lot2,Ask,slip,Bid-TS*Point,Bid+TP*Point,0,Magic,0,Green); 
            } 
         } 
         if(OrderClosePrice() == OrderTakeProfit()) 
         { 
            if(OrderType() == OP_BUY) 
            { 
               ticket = OrderSend(Symbol(),OP_BUY,lots,Ask,slip,Bid-TS*Point,Bid+TP*Point,0,Magic,0,Green); 
            } 
            if(OrderType() == OP_SELL) 
            { 
               ticket = OrderSend(Symbol(),OP_SELL,lots,Bid,slip,Ask+TS*Point,Ask-TP*Point,0,Magic,0,Red); 
            } 
         } 
      } 
   } 
} 

all the explanations are there... If you need more - happy to oblige.

 
Hello everyone, Happy New Year. I can't find any way to place an order only once, if the condition is fulfilled after which the order is placed, then if there is an order for the second time it will not be placed. If you can give an example.
Reason: