[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 167

 
borilunad:
Of course, in a textbook and documentation, but you can get ready-made ones at Work or do you intend to run an advisor without knowledge of the language? Very risky and reckless, and if you have a lot of money, buy a lottery, it's more profitable and you don't need to study!

I wonder then why to create a forum at all, if all questions can be answered, that everything is in a textbook and in documentation? What I intend to do with the EA and how to manage it -- with or without knowledge of the language, sorry, that's my own business. Advice to buy a lottery, as well as others of the same series keep it to yourself.
 
Magnifique:

I wonder then why create a forum at all, if all questions can be answered that everything is in the tutorial and documentation? What I intend to do with the EA and how to manage it -- with or without knowledge of the language, I'm sorry, that's my own business. Advice to buy a lottery, as well as others of the same series keep it to yourself.

This forum was created to discuss programming issues, but you want tips that will serve you poorly, because, again, without knowledge even a great Expert Advisor without daily debugging, tweaking and searching for solutions suitable to constantly changing market conditions, will one sad day wipe out the deposit. Of course, the forum helps newbies when they have already done something and are experiencing difficulties, but not because of laziness, but because of problems that arose during the programming process. So "without work... " and you can't go anywhere without knowledge!

 
Magnifique:

I wonder then why create a forum at all, if all questions can be answered, that everything is in the tutorial and documentation? What I intend to do with the EA and how to manage it -- with or without knowledge of the language, I'm sorry, that's my own business. Advice to buy a lottery, as well as others of the same series keep it to yourself.

Victoria, you have set yourself quite a normal task to master EA writing. Start on your own and post the code you get along with the questions, and others will help. This thread exists primarily for this purpose; moreover, it is the newbies, who are the most enjoyable to communicate with. Let's keep the learning atmosphere.

 
I would like to know if there is such a module or what it is called for MT4 that would allow to automatically load and check parameters after optimization in an unfamiliar area. It means the automated search of the best parameters found by the optimizer, as in MT5 it is optimized first, and then searches among them the best ones
 
T-G:
I would like to know if there is such a module or what it is called for MT4 that would allow to automatically load and check parameters after optimization in an unfamiliar area. It means the automated search of the best parameters found by the optimizer, like in MT5 where it is optimized first and then searches for the best ones
I do not remember exactly, but try searching for "auto optimizer" and "testcommander
 
Why does a script run in the terminal sometimes bring up a "do you want to attach the script to this chart" window, although normally such a window does not appear when the script runs...? ?
 

Good afternoon!

I cannot solve the following problem:

          if (Minute()>0 && Minute()<30)
         {m=Minute();}
         if (Minute()>30 && Minute()<60)
         {m=Minute()-30;}
         if (Minute()==0 || Minute()==30)
         {m=0;}
         price=iOpen(Symb, timeP4, m);
         price_1=iOpen(Symb, timeP4, m+30);

When the Expert Advisor works, it takes data from the zero bar (which I need), then from the next bar. Sometimes I get the 30th bar (which I need), then 29, then 32, then 34... And prices are taken from these bars accordingly.

Can you advise whether you can specify the Expert Advisor a bar from which I want to get the price without shifting the bars, and specify the time?

I have a very good Expert Advisor, thank you.

 
Egori4:

Good afternoon!

I cannot solve the following problem:

So, when the Expert Advisor works, it takes data from zero bar (which I need), then from the next bar. Sometimes I get the 30th bar (which I need), then 29, then 32, then 34... And prices are taken from these bars accordingly.

Can you advise whether you can specify the Expert Advisor a bar from which I want to get the price without shifting the bars, and specify the time?

I have a very good Expert Advisor, thank you.


This should help.
 

Hello all...

Help with the following problem ...

There are 3 MA, When a predefined situation occurs e.g. (MA1>MA2 && MA2<MA3) there is a buy or sell, also I write it in the comment.

double MA1 = NormalizeDouble(iMA(NULL,PERIOD_M5,period_1,0,0,0,0),5);
double MA2 = NormalizeDouble(iMA(NULL,PERIOD_M5,period_2,0,0,0,0),5);
double MA3 = NormalizeDouble(iMA(NULL,PERIOD_M5,period_3,0,0,0,0),5);

if(ptm5!=pt1m5 && ptm5=="123")
    {
      OrderSelect(OrdersTotal()-1,SELECT_BY_POS,MODE_TRADES);
           if(OrderOpenTime()<Time[3])
              {
              if (MA1>MA2 && MA2<MA3)tochka="123"; 
                  TimeBar=Time[0];
                   OrderSend(Symbol(),OP_BUY, LOT,NormalizeDouble(Ask,Digits),3,Bid-SL*Point,Ask+TP*Point,tochka,Magic,0,Blue);
              }
   }

But at the end of EA before completion I write everything to csv file.

Handle1=FileOpen("Points"+Symbol()+a+".csv",FILE_CSV |FILE_WRITE|FILE_READ,';');
FileSeek(Handle1,0,SEEK_SET);

for (int i=1; i<=OrdersHistoryTotal(); i++)       //Цикл по всем ордерам,..
     {                                        //отражённым в терминале
      if(OrderSelect(i-1,SELECT_BY_POS,MODE_HISTORY)==true)//Если есть следующий
        {    
    string var1=TimeToStr(OrderOpenTime(),TIME_DATE|TIME_MINUTES);
     string var2=TimeToStr(OrderCloseTime(),TIME_DATE|TIME_MINUTES);
     string varr;
        if (OrderType()==OP_BUY)varr="buy";else varr="sell";
      double oroppr1,orclpr1;
      oroppr1=OrderOpenPrice();
      orclpr1=OrderClosePrice();
      string oroppr=DoubleToStr(oroppr1, 4);
      string orclpr=DoubleToStr(orclpr1, 4);
  
      datetime some_time1, some_time2;   
      some_time1=StrToTime(var1);
      some_time2=StrToTime(var2);     
      int shift1=iBarShift(Symbol(),0,some_time1);
      int shift2=iBarShift(Symbol(),0,some_time2);
      
      int shift3=iBarShift(Symbol(),PERIOD_M5,some_time1);


double MA01 = NormalizeDouble(iMA(NULL,PERIOD_M5,period_1,0,0,0,shift3),5);
double MA02 = NormalizeDouble(iMA(NULL,PERIOD_M5,period_2,0,0,0,shift3),5);
double MA03 = NormalizeDouble(iMA(NULL,PERIOD_M5,period_3,0,0,0,shift3),5);

if (MA01>MA02 && MA02<MA03)pt0="123";
FileWrite(Handle1,var1,var2,varr,OrderSymbol(),OrderTicket(),OrderLots(),oroppr,orclpr,OrderTakeProfit(),OrderStopLoss(),OrderProfit(),OrderComment(),max,min,g,pt0,g,a,b);
        }
     }                                  
     FileClose(Handle1);   

I can see from the code that I take the date and time of order opening, look for a bar and write all MA values for this bar;

And the essence of the problem sometimes the data in the csv do not coincide with the recorded data... (only for my timeframe)

comment="123" pt0="213";

PS. bool exact=false

I have changed these values to both false and true, the result is the same.

PS2. To those who like picking on commas and parentheses. I may have missed something since the code is big, so I took only what I needed.

 

I venture to repeat my question:

Такой вопрос. Советник открывает ордер, устанавливая определенное значение magic. Затем MetaTrader закрывается. Есть ли возможность после повторного открытия MT (или, что то же самое) при открытии MT на другой машине восстановить magic? Только что столкнулся: был открыт ордер, после чего добрый дядя из ДЦ перегрузил виртуалку. В результате: все расчеты в топку.


That is, the gist of the question: are magic's saved after closing the terminal/expert and is there any way to restore them?