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

 
artmedia70:
:) Impatience is usually trained in another office... :)


You don't need to train my patience for that. I'm very patient.

Sorry. I just have a big workload and don't want to waste my time at all.

And I'm even more sorry, because the author of the topic probably does not know about it. Probably a schoolboy.

 
Vinin:


There is no need to train my patience for that. I am very patient.

I'm sorry. I just have a big workload and don't want to waste my time at all.

And I'm even more sorry, because the author of the topic probably does not know about it. Probably a schoolboy.

I think a lot of people realise that being a moderator is thankless in many ways. You do something, you try, you keep things in order, and the list of dissatisfied people doesn't get any smaller. People...
Sorry about the offtops.
ZS. My daughter is a schoolgirl and she understands a lot... :)
 
FoxUA:

It still opens this order in a batch.
Here's how I set the variables in my Expert Advisor.
and here's the order opening

It's hard not to agree with artmedia70 about the layout of your code. It is very hard to read, you have to look at it for a long time to understand anything, and then you have to put brackets, spaces, and indents correctly. Please watch your style and avoid chaos in writing code, even though it is composed of different blocks, different authors. You should bring it in one, your own style, so it will be easier to work with it in the future and modernize it.

//+------------------------------------------------------------------+
extern int TakeProfit=18;
extern int StopLoss=18;
extern double Lot=1;
extern int StartTime=0;
//+------------------------------------------------------------------+
int Today=0;
int h=10;
int h1=26;
int mag=777;
bool b=0,s=0, //соответственно бай или селл  
bs=0,// если закрытие по стоплоссу ордера бай
ss=0,// если закрытие по стоплоссу ордера sell
bt=0,
st=0;//      то же по ТП
double bl=0,sl=0; // лоты соответсвенно для бай и селл

//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
int start(){

   if(DayOfWeek()==0 || DayOfWeek()==6) return(0); // в выходные не работаем
   if(!IsTradeAllowed()) return(0); // пропустим тик если терминал занят
   int total = OrdersTotal();
   
   if(total == 0){
      NewOrder1(OP_BUY,Lot);
      NewOrder1(OP_SELL,Lot);
      NewOrder1(OP_BUYLIMIT,Lot);
      NewOrder1(OP_SELLLIMIT,Lot);
      NewOrder1(OP_BUYSTOP,Lot);
      NewOrder1(OP_SELLSTOP,Lot);
      Today=TimeDay(TimeCurrent());
   }
   
   for(int cnt=OrdersHistoryTotal();cnt>0;cnt--){
      OrderSelect(cnt, SELECT_BY_POS, MODE_HISTORY);
      if(OrderMagicNumber()== mag && OrderSymbol()==Symbol()){
         if(OrderType() == OP_BUY ){
            b=1;
            if(OrderClosePrice()==OrderTakeProfit())bt=1;
            if(OrderClosePrice()==OrderStopLoss())bs=1;
            bl=OrderLots()*100;
            break;
         }
         if(OrderType() == OP_SELL){
            s=1;
            if(OrderClosePrice()==OrderTakeProfit())st=1; 
            if(OrderClosePrice()==OrderStopLoss())ss=1;
            sl=OrderLots()*100;
            break;
         }
      }
   }

   if(bs==1||bl==1){   
      NewOrder1(OP_BUYLIMIT,Lot);
      Today=TimeDay(TimeCurrent());
   }
}    
//+------------------------------------------------------------------+
//| NewOrder1 function                                               |
//+------------------------------------------------------------------+
int NewOrder1(int Cmd,double Lot){
   double TP=0; //тейкпрофит
   double SL=0; //стоплосс
   double PR=0; //Цена
   double LT=0; //Лот
   int tic1;
   
   while(!IsTradeAllowed()) Sleep(100);
   
   if(Cmd==OP_BUYLIMIT){
      PR=Ask-Point*h;
      if(TakeProfit>0)TP=PR+TakeProfit*Point;
      if(StopLoss>0)SL=PR-StopLoss*Point;
      if(Lot>0)LT=3*Lot;
      
       tic1 = OrderSend(Symbol(),Cmd,LT,PR,3,SL,TP,0,mag,0,CLR_NONE);   
   }
   
   if(tic1<0)Print(GetLastError());

   if(tic1>0){
      b=0;s=0; //соответственно бай или селл  
      bs=0;// если закрытие по стоплоссу ордера бай
      ss=0;// если закрытие по стоплоссу ордера sell
      bt=0;
      st=0;//      то же по ТП
      bl=0;sl=0; // лоты соответсвенно для бай и селл
   }
   
   return(tic1);
}
//+------------------------------------------------------------------+

I tried it in the tester, it seems to open only one pending order (BUYLIMIT), but I really don't know what else it should do and under what circumstances.

 
ToLik_SRGV:

It's hard not to agree with artmedia70 about the layout of your code. It is very hard to read, you have to look at it for a long time to understand anything, and then you have to put brackets, spaces, and indents correctly. Please watch your style and avoid chaos in writing code, even though it is composed of different blocks, different authors. Bring it into one, your, style, so that later it will be easier for you to work with it and modernize.

I have tried it in the tester, it seems to open only one pending order (BUYLIMIT), but I really don't know what else it should do and under what circumstances.

Anatoly! Bravo! I was beginning to think I'd have to abandon everything and start cleaning up. Even a cursory glance at the appearance of the code is thought-provoking... ...and most importantly, it doesn't strain the eye or repel it. Respect!
 

How do I calculate the amount of recent losing trades !!!

Thank you...

 
itum:

How do I calculate the amount of last losing trades !!!

Thanks...

How many recent ones? ... exactly in grams... :)

Do a loop on closed orders of the terminal, check the profit of the order and, if it is minus, increase the counter of the number of losing orders closed, or, if you want the amount in money, not the number of losing orders, then add its profit (which is minus) to the last value of variable double, in which you have stored the amount of lots in money...

 
artmedia70:

Must be really needed... :) Or my mouse is stuck...

MT4/logs location folder

MT4\tester\logs location folder

I've got it right here:

D:\Program Files\MetaTrader - E-Global TFG account-1654729\logs

D:\Program Files\MetaTrader - E-Global TFG account-1654729\tester\logs


Thank you very much for the reply, and apologies for the many posts of the same type, I wanted to do the cleaning myself but I got caught up in the market today. Thanks again everyone .
 
LAIT123:
Thank you very much for the reply, and apologies for the many posts of the same type, I wanted to do the cleaning myself but I got caught up in the market today. Thanks again everyone .
You'll have to go to Victor to bow... :) Just kidding... He understands everything...
 
Hi all! Dear artmedia70, drknn, Abzasc, the day before yesterday using your advice I dropped the missing Wingdings font file to the Windows folder and in the terminal Fractals appeared normally. Thanks a lot to all of you guys. Regards Furkat.
 
trader265:
Hi all! Dear artmedia70, drknn, Abzasc, the day before yesterday using your advice I dropped the missing Wingdings font file to the Windows folder and in the terminal Fractals appeared normally. Thanks a lot to all of you guys. Regards Furkat.
You are welcome. It wasn't that hard to guess, and then it's a matter of technique... :)
Reason: