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

 
Vinin:

Apparently you haven't phrased your question correctly.

What should I specify to fully clarify the situation? How about posting an advisor?
 
vovan-gogan:

What should I specify to fully clarify the situation? How about posting an advisor?

What Roman suggested is fully relevant to the question you asked. You seem to need to know something else. But what is it?
 
Vinin:

What Roman suggested is perfectly in line with the question he asked. You seem to need to know something else. But what?

I just want to understand what can cause that at each iteration the global variable is not assigned a new value obtained as a result of calculations in the body of one of the operators.
 
The previous question seems to be sorted out somehow. Now I would like some hints: how can I perform operations with a variable of datetime type? For example, I want to set up a time filter that will allow my EA to trade only 2 hours after the current time when the order is opened. In other words, how to "add" the time correctly?
 
vovan-gogan:
The previous question seems to be sorted out somehow. Now I would like some hints: how can I perform operations with a variable of datetime type? For example, I want to set up a time filter that will allow my EA to trade only 2 hours after the current time when the order is opened. In other words, how to "add" the time correctly?


the time is set in seconds
two hours is 2*60*60

a chart timeframe is specified in minutes https://docs.mql4.com/ru/constants/timeframes
two hour timeframes are 2*PERIOD_H1*60

 
abolk:


the time is set in seconds
two hours is 2*60*60

chart timeframe is set in minutes https://docs.mql4.com/ru/constants/timeframes
two hour timeframes are 2*PERIOD_H1*60


Thank you
 
vovan-gogan:

People, with all these global and local variables, I'm about to start running around barefoot and blowing sparrows. Man, I don't understand why there's so much headache in the middle of nowhere!

As far as I know from MQL4 tutorial, now the new value of global variable Orders should equal 1. The next iteration should be 2, then 3. Then 4. And so on, until the Expert Advisor places pending orders. But I do not understand why the EA does not place pending orders! After placing another pending SELLSTOP order, every time I see only one message: Orders = 1! What is the reason? Can it be because of MetaEditor?
          if (OrdersTotal()>= 1) 
              return(0);               //Если ордеров больше 1, уходим.

the reason is in this line, as soon as you have one order the program quits the function and does not allow to increase the counter
 

How to change Stop Out level from % to absolute value?


avatar
109
borilunad 08.08.2011 11:03

I apologize to the moderators if this question is not worth opening a new thread! But I can not litter other threads with off-topic questions!

If it is the server, then I will dance from %, and the branch can be deleted. But still I hope to change this Mode to 1 (absolute value) with the help of experienced programmers. Thanks to those who responded to my request!

 

EA Features


avatar
17
darsey 08.08.2011 12:40
Hello. Is it possible to program an EA in mql4, so it would adjust the lot every 15-30 seconds?
 
darsey.08.2011 12:40

Good afternoon. Is it possible to program an EA on mql4 to adjust the lot every 15-30 seconds?

Aren't you afraid of getting into frequent requests? After all, every 15-30 seconds you will have to either open new positions in addition to ones you already have, or delete ones you already have.

You can't change the volume of an open position. So you have to split it into several positions.