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

 

Alp:

I apologise for the silly question, but still.

I cannot understand it. Suppose I buy (i.e., make a buy deal) for $1,000,000 or any other amount of EURUSD, so that the chart noticeably jumps.

And the question is, where will it go after such a deal - up or down (a single jump from my deal)? I think it will go up. Am I thinking correctly?

Dimka-novitsek:

Yes, I see it that way. Because let's say you bought the eur, and there is less of it on the market, because some of it stays in your locker. That means that the market price for them will go up!

Then it becomes even more unclear. Let's say I buy EUR for 1 000 000 (1kk) dollars (broker multiplies this by 100 as a result the deal goes for 100k) chart jumps 100 points upwards and immediately sell them and I am on the plus side for 10 000 dollars well there commission broker and spread as a result 6000$ net in my pocket. (Well it is clear that after the sale, it will fall again by 100 points.) This is nonsense!!!! Maybe it will fall to the bottom after all? Otherwise very big players would make billions, doing essentially nothing.

 
Roman.:

Guys, can you advise on this question?

Here's a script to find the maximum size of the zig-zag backlash from crenfx - see here:

I throw it on the chart of the instrument on M5 - it works fine with the default timeframe

it is the maximum depth of history for the symbol in the Alpari office when loading it with F2 - I checked it, i.e. it looks like the content of the "Experts" tab of the client terminal - it seems to be true:

When using the same script design in my EA on the same time interval on the same M5 chart period it doesn't count correctly, i.e.

it calculates quite different (smaller than in the script) numbers or 0. What may be the error or it may be some kind of history inconsistency? Thank you.

I.e., I start in the tester with owl after the estimated time for finding a failsafe, in theory all is normal and the numbers at the end of the script and owl should be the same... What could be the error?


Check the number of bars in the tester. At start it should be 1000, if it is present of course
 
Vinin:

Check the number of bars in the tester. At start it should be 1000, if it is present of course.

How can this be checked?
 
Print("Bars=", Bars);
 
Vinin:
Print("Bars=", Bars);

Got it. Thank you. I will check it.
 
Gentlemen, could you give me an example of the function which moves an open position to breakeven (work on tick), my Expert Advisor has a trawl, the start of this trawl is only after the function of rollover to buy. I would like to use this article as an example for such an EA.
 

Please tell me why in this piece of code the external variable Lots111 keeps increasing its value, multiplies it by an unknown number, and becomes 4354354664450000000000000000.

The Lots111 variable is not used anywhere else besides this code fragment. Lots111 equals 0.01, while variable dcou equals 2-3. To be more exact, I've noticed that it increases with every new bar; I can't understand why. How is it possible that an external variable that is not used anywhere else retains its value and increases on every bar, most likely multiplied by 2.

double fGetLots(int a_cmd_0) {
   int dcou;
   dcou = AccountBalance()/2000;
   Lots111 = Lots111*dcou;
   int i11;
   int orders;
   
   for(i11=0;i11<OrdersTotal();i11++)
     {
     if(OrderSelect(i11,SELECT_BY_POS,MODE_TRADES) == true)
       {
       if(OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber)
         {
         orders++;
         }
       }
     }
   static double Lots2;
   
   if(orders == 0)
     {
     Lots2 = Lots111;
     }
   Comment(Lots111,"\n",Lots2,"\n",orders,"\n",dcou);
   double l_lots_4;
   int l_datetime_12;
   switch (gi_256) {
   case 0:
      l_lots_4 = Lots2;
      break;
   case 1:
      l_lots_4 = NormalizeDouble(Lots2 * MathPow(MultiLotsFactor, gi_360), gd_240);
      break;
   case 2:
      l_datetime_12 = 0;
      l_lots_4 = Lots2;
      for (int l_pos_20 = OrdersHistoryTotal() - 1; l_pos_20 >= 0; l_pos_20--) {
         if (OrderSelect(l_pos_20, SELECT_BY_POS, MODE_HISTORY)) {
            if (OrderSymbol() == Symbol() && OrderMagicNumber() == MagicNumber) {
               if (l_datetime_12 < OrderCloseTime()) {
                  l_datetime_12 = OrderCloseTime();
                  if (OrderProfit() < 0.0) l_lots_4 = NormalizeDouble(OrderLots() * MultiLotsFactor, gd_240);
                  else l_lots_4 = Lots2;
               }
            }
         } else return (-3);
      }
   }
   if (AccountFreeMarginCheck(Symbol(), a_cmd_0, l_lots_4) <= 0.0) return (-1);
   if (GetLastError() == 134/* NOT_ENOUGH_MONEY */) return (-2);
   return (l_lots_4);
}
 
sss2019:

Please tell me why in this piece of code the external variable Lots111 keeps increasing its value, multiplies it by an unknown number, and becomes 4354354664450000000000000000.

The Lots111 variable is not used anywhere else besides this code fragment. I have Lots111 equal to 0.01 and variable dcou equal to 2-3.

Try to initialize the variables sometimes. Sometimes it helps. Especially when they are used by default. That is, the value is not exactly defined, and they are multiplied, divided by them. You can also earn division by zero in the same way
 
Vinin:
Try initialising the variables sometimes. Sometimes it helps. Especially when they are used by default. That is, the value is not exactly defined, and they are multiplied, divided by them. You can also earn division by zero in the same way


Can you explain this in more detail? Oh well, I think I got it, I set all the variables to their original values, but the problem persists.
 
sss2019:

This is to do, please explain in more detail. I think I've got it, I've set all the variables to their original values but the problem persists.

You ripped out code from some EA (having hacked it before), but it's not important (at least you tried to understand it). But you should have created your own on its basis, which you would have easily navigated. And then you wouldn't have had any problems. Work with your head.