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

 
Dimka-novitsek:

I read ivandurak's post and immediately realized that after each tick only the start is triggered, so if you open the variable globally, it seems to save the value.

So it must be so.

So, the compiler categorically does not accept the line int KolBars=Bars; it says 'Bars' - initialization expected C:\Program Files (x86)\Alpari ÌÒ4\experts\Áëù.mq4 (8, 13)

Amazing!!!!! Normal variable declaration. But never mind.

I'll ask the main thing - how to debug an EA at the weekend, if the ticks don't go?????


//| Бред.mq4 |
//| Copyright © 2010, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
int KolBars=Bars;
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
KolBars=Bars;

return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{int r;
r=Bars- KolBars
//----
for( r>0 )
int k;

KolBars=Bars;

//----
return(0);
}
//+------------------------------------------------------------------+ 
What's the tester for?
 

ABOUT THE GENETIC ALGORITHM!!!

In my case, weights for the neural network are selected. If you run optimization without genetic algorithm, it will take a VERY long time.

There are no pseudo-randomness in the code.

Although the gene algorithm also tries a lot of variants, it also acts according to a certain program (in one and the same interval and under one and the same conditions). Why then we get different results I do not UNDERSTAND.

By the way nobody asked the question to test the work of the GEN ALGORITHM. Exactly: run two times optimization and compare results.... Try.

 
Stepan241:

ABOUT THE GENETIC ALGORITHM!!!

In my case, weights for the neural network are selected. If you run optimization without genetic algorithm, it will take a VERY long time.

There are no pseudo-randomness in the code.

Although the gene algorithm also tries a lot of variants, it also acts according to a certain program (in one and the same interval and under one and the same conditions). Why then we get different results I do not UNDERSTAND.

By the way nobody asked the question to test the work of the GEN ALGORITHM. Exactly: run the optimization two times and compare the results....A try it.


Help yourself.

https://www.mql5.com/ru/articles/1409https://www.mql5.com/ru/articles/1408 https://www.mql5.com/ru/articles/1511

 

Dear Experts! Please tell me the function which changes the lot and the number of orders depending on the balance value.

 
Stepan241:

ABOUT THE GENETIC ALGORITHM!!!

By the way, no one has asked the question to TEST the work of the GENE ALGORITHM. Exactly: run the optimization two times and compare the results....A try it.

You have been working with mql for a long time, as I understand it, gen. alg. uses pseudo random numbers to trace the initial setup packages, and only then starts considering by given definitions where and what to look for.

https://www.mql5.com/ru/articles/1408

The scheme of genetic algorithm functioning

1.Initiate the initial time moment t=0. Randomly form an initial population, consisting of k individuals. B0 = {A1,A2,...,Ak)

2. ...

 
fanat:

Dear Experts! Please tell me the function which changes the lot and the number of orders depending on the balance value.


https://www.mql5.com/ru/code/8192

The author uses dynamic lot and maximum number of options.

MaxOrders_Desc = "if 0 the number of simultaneously opened positions is not limited to 1-3";
MaxOrders = 1;

Lots_Desc = "If 0 Apply Dynamic Lot";

Lots = 1;

 

Please advise if it is possible to open orders of different currency pairs in one cycle while after checking the entry condition, an error 4051 keeps popping up

while(true)

{
if (Total==0 && Opn_B==true && Total1==0 && Opn_S1==true) // no open orders for the first and second currency pairs + there is an open criteria
{

RefreshRates(); // Update data
double bid = MarketInfo(Symb2,MODE_BID);
Alert("Trying to open Buy and Sell. Waiting for reply.");
Ticket=OrderSend(Symb1,OP_BUY,Lts,Ask,2,0,0); //open Buy
Ticket1=OrderSend(Symb2,OP_SELL,Lts,bid,2,0,0);
if (Ticket > 0 && Ticket1 > 0) // It worked :)
{
Alert ("Buy and Sell order opened ",Ticket,Ticket1);
return; // Exit start()
}
if (Fun_Error(GetLastError())==1) // Error handling
continue; // Retry
return; // Exit start()
}

 
Dimka-novitsek:

So, the compiler categorically does not accept the line int KolBars=Bars; it says 'Bars' - initialization expected C:\Program Files (x86)\Alpari ÌÒ4\experts\Áåë.mq4 (8, 13)

I will ask the main thing - how to debug an EA at the weekend, if the ticks do not go?????

1.
//| Бред.mq4 |
//| Copyright © 2010, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2010, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
int KolBars;//=барс нельзя переменную присвоить вне функций




//| expert initialization function 
|

int init()
{
KolBars=Bars; //один раз при инициализ.

return(0);
}
...
2. On the strategy test ;).
 

Good afternoon!!! LOL!!!!!! ''for'' - too complex expression C:\Program Files (x86)\Alpari MT4\experts\bred.mq4 (34, 1)

''for'' - too complex expression C:\Program Files (x86)\Alpari ??4\experts\???????.mq4 (34, 1)

Is it possible to debug an EA in testing mode during the weekend in the same way as when receiving ticks on the platform, getting responses from the Comment,Alert, functions?

 
xxxslavaxxx:

Please advise if it is possible to open orders of different currency pairs in one cycle while after checking the entry condition, an error 4051 keeps popping up

while(true)

{
if (Total==0 && Opn_B==true && Total1==0 && Opn_S1==true) // no open orders for the first and second currency pairs + there are open criteria
{

RefreshRates(); // Refresh data
double bid = MarketInfo(Symb2,MODE_BID);
Alert("Trying to open Buy and Sell. Waiting for reply...");
Ticket=OrderSend(Symb1,OP_BUY,Lts,Ask,2,0,0);//open Buy
if(GetLastError()==4051)Alert("Symb1"+Symb1+" Lts "+Lts+" Ask "+Ask);
//if(Ticket>0)Sleep(50);else continue;

Ticket1=OrderSend(Symb2,OP_SELL,Lts,bid,2,0,0);
if(GetLastError()==4051)Alert("Symb2"+Symb2+" Lts "+Lts+" bid "+bid);


if (Ticket > 0 && Ticket1 > 0) // It worked :)
{
Alert ("Opened Buy or Sell order ",Ticket,Ticket1);
return; // Exit
}
if (Fun_Error(GetLastError())==1) // Error handling
continue; // retry
return; // Exit from start()
}

Reason: