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

 

Friends, I've run into a simple problem, but I can't seem to solve it. The essence is as follows. When certain conditions are met, a trade opens (let's call it a lead trade). And I need to open another trade (repeat) within the next 3 bars, if this condition is repeated. If within the next three bars the condition I need is not met, then a trade should not open again until the next time the trade will be opened again. And so on. I have, for some reason, reopen only one time (I mean, when all conditions are met in general the first time - it opens, but hereafter, when after the new leading position appears condition of opening a repeat trade - it is not opened). Help, please.

//условие открытия повторной сделки
for (povtor_up=1;povtor_up<4;povtor_up++)
if ((povtor_buy==1) && (adx_cont==1)&&(sb==1))
{
  CL = iClose(NULL,0,1);
  stop = CL - SLP*Point;
  raz_up = (CL - frac_down);
  take_1 = 0;
  take_2 = 0;
  if (CL<(frac_up-FR_OVER*Point))
  take_1 = (CL + raz_up*MNP_1);
  if (CL>=(frac_up-FR_OVER*Point))
  take_2 = (CL + raz_up*MNP_2);
  if (take_1>0)
  {
  take_1n = NormalizeDouble(take_1,5);
  take = take_1n;
  }
  if (take_2>0)
  {
  take_2n = NormalizeDouble(take_2,5);
  take = take_2n;
  }

    if(!IsTradeAllowed())
      {
      Alert("занят торговый поток, повторим попытку buy");
      return(-1);
      }
  ticket_buy_cont=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,stop,take,com,Magic,0,Yellow);
    if(ticket_buy_cont == -1)
    {
    Alert(Symbol(),"ошибка:buy", GetLastError());
    return(-1);
    }
    if(ticket_buy_cont > 1)
    {Alert (Symbol(),"buy повтор - ок !");
    povtor_buy=0;
    povtor_up=0;
    }

}
else 
    povtor_buy=0;
    povtor_up=0;


//условие открытия ведущей сделки
if ((adx_ts==1) && (sb==1) && (FLAG==0))
{
  CL = iClose(NULL,0,1);
  stop = CL - SL*Point;
  raz_up = (CL - frac_down);
  take_1 = 0;
  take_2 = 0;
  if (CL<(frac_up-FR_OVER*Point))
  take_1 = (CL + raz_up*MN_1);
  if (CL>=(frac_up-FR_OVER*Point))
  take_2 = (CL + raz_up*MN_2);
  if (take_1>0)
  {
  take_1n = NormalizeDouble(take_1,5);
  take = take_1n;
  }
  if (take_2>0)
  {
  take_2n = NormalizeDouble(take_2,5);
  take = take_2n;
  }

    if(!IsTradeAllowed())
      {
      Alert("занят торговый поток, повторим попытку buy");
      return(-1);
      }
  ticket_buy=OrderSend(Symbol(),OP_BUY,Lots,Ask,Slippage,stop,take,com,Magic,0,Yellow);
    if(ticket_buy == -1)
    {
    Alert(Symbol(),"ошибка:buy", GetLastError());
    return(-1);
    }
    if(ticket_buy > 1)
    {Alert (Symbol(),"buy при начале - ок !");
    FLAG=1;
    povtor_up=1;
    povtor_buy=1;
    }

}
 
Big_Bo:

Friends, I've run into a simple problem, but I can't seem to solve it. The essence is as follows. When certain conditions are met, a trade opens (let's call it a lead trade). And I need that within the next 3 bars, if this condition is repeated, another trade (repetition) is opened. If within the next three bars the condition I need is not met, then a trade should not open again until the next time the trade will be opened again. And so on. I have, for some reason, reopen only one time (I mean, when all conditions are met in general the first time - it opens, but hereafter, when after the new leading deal appears condition of opening a repeat trade - it is not opened). Help, please.

Do not forget (or get used to it - as you like) that the EA can be reloaded while working (if it is not a tester, of course), and that means that the values of flags LOSE if they are not written somewhere during deinitialization and not restored during initialization. It is easier to "keep track" of your orders. If there is a difference between the orders (in this case, a master and a slave), then they can be distinguished by different mags, or by a record in the comments, or the second slave opens after the 1st order (whatever your heart desires).

Separate the code into user-defined functions - so it is easier to read and understand: separately for opening (getting a signal), separately for getting STOP and separately for opening orders. The sense of this loop is absolutely unclear:

    for (povtor_up = 1; povtor_up < 4; povtor_up++)

If it is the mentioned check: "within the next 3 bars" - then I've missed something in this life...

You have an opening time of the first "master" order - use it as a guide.

 

Please help or advise on how to deal with the smooth running of EAs. The situation is as follows:

1. I ran a real micro account with 36 Expert Advisors on 21 symbols on TF D1, which do not switch off during 24 hours a trading week;

2. I have 58 more 58 Expert Advisors on demo accounts also on D1, which I am forced to switch off during 1-3 minutes, after they make trade decisions, starting from 00-00 server time of the DC every day, which takes a lot of time and nerves deep into the midnight;

3. 3. We have started a demo account on the H4 TF, which works on a permanent basis.

Question: How to run Expert Advisors in the step 2 on a permanent basis? I do not have enough virtual memory on my PC right now. What to do: to increase the RAM, change the computer to a dual-core or look for a more powerful laptop? Or maybe there is another organisational or software solution?

 
yosuf:

Please help or advise on how to deal with the smooth running of EAs. The situation is as follows:

1. I ran a real micro account with 36 Expert Advisors on 21 symbols on TF D1, which do not switch off during 24 hours a trading week;

2. I have 58 more 58 Expert Advisors on demo accounts also on D1, which I am forced to switch off during 1-3 minutes, after they make trade decisions, starting from 00-00 server time of the DC every day, which takes a lot of time and nerves deep into the midnight;

3. 3. We have started a demo account on H4, which works on a permanent basis.

Question: How to run Expert Advisors in the step 2 on a permanent basis? I do not have enough virtual memory on my PC right now. What to do: to increase the RAM, change the computer to a dual-core or look for a more powerful laptop? Or maybe there is another organisational or software solution?

I do not quite understand point 2 about reviving? Do you give them artificial respiration or make them sniff ammonia.

RAM accumulation is the cheapest and most effective method which I myself use when necessary. The more RAM, the faster everything moves. And also an upgrade of the rest of your hardware, if the old one does not do the trick anymore. Two cores for so many tasks on one computer will not be enough.

 
yosuf:

Please help or advise on how to deal with the smooth running of EAs. The situation is as follows:

1. I ran a real micro account with 36 Expert Advisors on 21 symbols on TF D1, which do not switch off during 24 hours a trading week;

2. I have 58 more 58 Expert Advisors on demo accounts also on D1, which I am forced to switch off during 1-3 minutes, after they make trade decisions, starting from 00-00 server time of the DC every day, which takes a lot of time and nerves deep into the midnight;

3. 3. We have started a demo account on H4, which works on a permanent basis.

Question: How to run the Expert Advisor in step 2 on a permanent basis? I do not have enough virtual memory on my PC right now. What to do: to increase the RAM, change the computer to a dual-core or look for a more powerful laptop? Or maybe there is another organisational or software solution?

Another organisational solution is a VPS (Virtual Privat Server).

Another software solution (if you have the same EA on different pairs) is to make a multi-currency EA out of your EA.

 
Reshetov:

I don't quite understand point 2 about resuscitation? Do you give them artificial respiration or make them sniff ammonia?

RAM boosting is the cheapest and most effective method, and I use it myself when necessary. The more RAM, the faster everything moves. And then you can upgrade the rest of your hardware, if the old one doesn't do the trick anymore.

I mean, they switch on one by one for 1 - 3 minutes, then switch off again for 1 day. If you switch them on at once, e.g. more than 10, computer starts glitching and time is lost more than one or two at a time. Thanks, I'll try to ramp up the RAM, but do I need to know how much to ramp it up to? Or proceed by trial and error?
 
TarasBY:

Another organisational solution is a VPS (Virtual Privat Server).

Another program solution (if the same EA is used on different pairs) is to make a multi-currency EA out of your EA.

1. Thank you, I will study this possibility.

2. Although the EA is the same, but the settings are different for different pairs, is it possible to create a multicurrency EA under these conditions? Besides, the accounts are different.

 
TarasBY:

Another organisational solution is a VPS (Virtual Privat Server).

Another software solution (if you have the same EA on different pairs) is to make a multi-currency EA out of your EA.

VPS is not the best solution, because it costs money and not all hosting providers work reliably.

Multicurrency is not the best solution either.

A more acceptable solution is to move the EAs from one account to different terminals in order to relieve the trade threads. But the more terminals are running simultaneously, the more RAM is needed.

 
yosuf:
Meaning - they are switched on one by one for 1 - 3 minutes, then switched off again for 1 day. If you switch them on at once, e.g. more than 10, the computer starts to glitch and more time is lost than one or two at a time. Thanks, I'll try to ramp up the RAM, but do I need to know how much to ramp it up to? Or proceed by trial and error?
RAM capacity depends on the operating system and hardware bit rate. Judging by the fact that your computer is single core, it means that your hardware is 32 bit and up to 3 Gigs of RAM can be built up. But it's better to check with your motherboard, because not all old computers can support more than 2 gigs.
 
Reshetov:

VPS is not the best solution as it costs money and not all hosting providers are reliable.

Multicurrency is not the best solution either.

A more acceptable solution is to move the Expert Advisors from one account to different terminals to relieve the trade threads. But the more terminals are running simultaneously, the more RAM is needed.

Is it possible to create a program which would switch EAs on and off by itself, say, for 10 minutes, alternately after 00.00 of the client terminal server?