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

 
neisseria:
Tried to create an EA based on a coin, heads buy, tails sell. But it doesn't work. When testing in a window there is an inscription: When opening the order error 131, in the application looked - it is not the correct volume. I looked carefully, I cannot find any error. There is a dot everywhere, to separate the integer part, not a comma. Please help. The code is in the file.
Does the account allow 0.01 lot? Maybe a minimum lot of 0.1?
 
neisseria:
Tried to create an EA, based on coin, eagle buy, tails sell. But it did not work. When testing, I got the following message in the window: Error 131 when opening order, I looked it up in the application, it is not correct volume. I looked carefully, I cannot find any error. There is a dot everywhere, to separate the integer part, not a comma. Please help. The code is in the file.


use:

MinLot= MarketInfo( symbol(),MODE_MINLOT )// Minimum possible lot size

StepLot= MarketInfo( symbol(),MODE_STEPLOT )// Minimum step of lot change

Lot should be >= MinLot and normalized using Lot=NormalizeDouble(Lot,Dig);

where Dig = Num_of_digits_after_pecimal point StepLota, i.e. StepLot=0.01 - Dig=2 ... StepLot=0.1 - Dig=1 .....

For example, with MinLot=0.1 and StepLot=0.01:

Lot can be 0.1, 0.11,0.12 etc. But it cannot be 0.99, 0.98 and it certainly cannot be 0.998,0.999, 0.111, 0.101.

 
Sepulca:


use:

MinLot= MarketInfo( symbol(),MODE_MINLOT )// Minimum possible lot size

StepLot= MarketInfo( symbol(),MODE_STEPLOT )// Minimum step of lot change

Lot should be >= MinLot and normalized using Lot=NormalizeDouble(Lot,Dig);

where Dig = Number of_digits_after_pecimal point StepLota, i.e. StepLot=0.01 - Dig=2 ... StepLot=0.1 - Dig=1 .....

For example, with MinLot=0.1 and StepLot=0.01:

Lot can be 0.1, 0.11,0.12 etc. But it cannot be 0.99, 0.98 and moreover it cannot be 0.998,0.999, 0.111, 0.101.


For example, with MinLot=0.1 and StepLot=0.01:

Lot can be 0.1,0.11,0.12 etc. But it cannot be 0.99, 0.98.

No way... really?

88 or 89 times increase the lot by the minimum step. For example - the lot of each subsequent position opened must be increased by the minimum step. I.e., bluntly add the minimum lot change step to the lot of the previous position. The 98th position to be opened will have the lot 0.98, respectively, the lot of the 99th position will be increased by a minimal step 0.98+0.01=0.99...

Doyou think DT will not let open with such a lot?

 
artmedia70:

For example with MinLot=0.1 and StepLot=0.01:

Lot can be 0.1, 0.11,0.12 etc. But it cannot be 0.99, 0.98

No way... really?

88 or 89 times increase the lot by the minimum step. For example - the lot of each subsequent position opened must be increased by the minimum step. I.e., bluntly add the minimum lot change step to the lot of the previous position. The 98th position to be opened will have the lot 0.98, respectively, the lot of the 99th position will be increased by a minimal step 0.98+0.01=0.99...

Do you think that brokerage companies will not allow opening with such a lot?


Damn it .... wrong of course. it can't be 0.09, 0.08.

And stupid or not stupid - is up to the EA writer to decide.

 
kellin:
No, of course I have to open with a buy or sell order at the opening of the next or one of the following bars. And I also plan to close by an order, assigning it by the number of points from the opening.

Later (at weekend) I will post here the code for opening market order - either buy or sell (at your choice), at opening of a new candle.
 
Sepulca:


use:

MinLot= MarketInfo( symbol(),MODE_MINLOT )// Minimum possible lot volume

StepLot= MarketInfo( symbol(),MODE_STEPLOT )// Minimum step of lot change

Lot should be >= MinLot and normalized using Lot=NormalizeDouble(Lot,Dig);

where Dig = Number of_digits_after_pecimal point StepLota, i.e. StepLot=0.01 - Dig=2 ... StepLot=0.1 - Dig=1 .....

For example, with MinLot=0.1 and StepLot=0.01:

Lot can be 0.1, 0.11,0.12 etc. But it can't be 0.99, 0.98 and much less 0.998,0.999, 0.111,0.101

I already know this information. In my broker's min lot 0.01, step 0.01. I changed it to 0.1 and 1 lot for conscience sake, nothing comes out, the error is in something else.
 

By the way, I don't intend to use this Expert Advisor, I'm just learning the programming language. In fact, I decided for fun to see how it will work on the tester, I just read that the random number generator does not give out such random numbers, as it repeats itself. The problem doesn't seem to be in the misspelling of the number but in the algorithm, just what is the problem?

 
T-G:
Help with a problem.
The question is this: I have an owl martin, opens knees after a given number of points, but with a new majik. It turns out the signal opens one or three orders with majic = 1, then minus the next knee on a signal2 open one or three orders with a majic 2 and so on.
So every knee goes on 1-3 orders with its own majic.

Now the point of the question is how to calculate in a loop the orders of each majic, for example, I tried to do it this way

How about this:

int Count() {
   int i, Сounts[100];
   
   for (i=0; i<OrdersTotal(); i++) {
      if (OrderSelect(i,SELECT_BY_POS)) {
         if (OrderMagicNumber()>Magic+100)   continue;
         if (OrderType()>1)                  continue;
         Сounts[OrderMagicNumber()]++;
         }
      }//for 
   Comment(10, Сounts[0] +"="+ Сounts[1] +"="+ Сounts[2]);
}

I didn't check it, I drafted it on my knee...

 
artmedia70:

How about this:

Didn't check it, just sketched it out on my knees...

It didn't work, but you gave me the right answer, I'm all set, thank you.
 
If anyone knows, I have a question: I need a looped script that would "press" the "Refresh" button once every 0.5 seconds in the current chart and re-initialize indicators. "I tried to make a looped script using WindowRedraw(). I tried to make a looped script using WindowRedraw() and Sleep(500), but indicators are not reinitialized.