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

 

Read the code of a simple EA in the tutorial - https://book.mql4.com/ru/samples/expert

I don't understand how the value of Total variable changes

In block "Entering orders" its value might change, for example, it might become 1.

When the order is closed, the value of Total variable does not change in the block "Close Orders", though I think it should be zeroed out (if the order is closed successfully).

The question - how in this case new orders will be opened (in the block "Order opening" - if (Total==0 && Opn_B==true) ), if the program still thinks that there are orders that are not closed? Or maybe the program cannot close one order and open another order in one go? Then I don't understand why it says that option b of the trade criteria ratio is used in the example?

 
fevrall:

Good day to all forum members!

Couldn't find answers to the following questions.

1. Two terminals are running on different machines (first one at work, second one at home), on the same real account.

If one Expert Advisor on one and the same currency pair is running on these terminals, on the same currency pair,

is it equivalent to running the same EA on the same pair in different windows of the same terminal?

2. If I prohibit the operation of EAs in one of these terminals (by using the appropriate button), how will this

affect another terminal?

(Thank you in advance!)

1) Two different terminals are two different terminals.)

Even if you have two different mt4 on one machine, working on one account - they will not intersect. They might intersect by accident, if the order magics coincide, then the active EA will perceive the order as "its own".

2. If we disable trading on one terminal, the other one will continue working, because this EA is a programme running on this computer in the given MT4, not on the server of the dealing centre. The same, if you turn off the computer, the Expert Advisor will not trade. But there is a nuance - if before the EA was switched off, it placed any pending orders, they will be executed on the market, even when the EA is switched off.

 
Techno:
You can set a ban for 1 or 2 bars. It cannot be thinner.

Techno, why do you insist on a temporary solution to this problem?

Is there no way to solve it logically? Your method might lead to a solution to my problem, but it's an indirect way of solving it...

 

obla4ko, thank you!

 
obla4ko:

I remember :), your advice is good, but "it's all about nuances", as PapaYozh puts it !

When working with averages every bar counts - statistics, you know! :)) - so i have to look for other, more subtle solutions....

If I understood your problem correctly, then you should not be guided by the order closing time. You should start at the time of the bar that gave the signal to open the position. What I would do, personally, is the following:

1) create a variable of datetime type where I would enter the value Time[0] if the order is successfully placed;

2) in the init() function, initialize this variable with value "0". I prefer an explicit initialization, since it is more clear when reviewing the code;

3) when conditions for opening a position appear, before sending OrderSend(...) request, compare the value of this variable with the value Time[0] and if they aren't equal, send a request.

4) if the position opened, it would store the value of Time[0] in that very variable.

---

I don't know if I explained it well, but I tried my best.

Of course, this is the most primitive approach, because the EA might actually reinitialize on the bar where the order was opened and we should consider such situations when writing the EA. But the variant I have described will do for you at the initial stage as well.

 

Good afternoon everyone!

People programmers and amateurs need your help! The essence is the need for a simple indicator that would show the horizontal line, ie give him a level from which he danced (down or up, no difference) and it after a certain number of points to draw the line again, and so on to the specified level. For example, the level from 1.2500 to 1.3400, a new line every 50 points ...


Thanks in advance to everyone who responds...

 

It's interesting how girls dance... :)

I'm back on the "pranks" of my DC...

How is that possible?

... ...it's interesting how poses opened up in the air... Demo account.

How is it possible?

My understanding is that if positions opened before the gap, they should be standing where they opened, not hovering in the sky...
... Well, if they were moved, why not to the bar after the gap, but somewhere in the air... Miracles... :)

 

artmedia70, it's a slippage on a gap) Change your dtz )) fuck it ))
 
artmedia70:

... interesting how the poses opened up in the air ... Demo account.


Don't forget that on the chart the price is Bid, buy orders (it looks like you have them) open on Ask.
 
PapaYozh:

Don't forget that on the chart the price is Bid, the buy orders (it looks like you have them) open on Ask.
Aren't we opening a Buy at Ask ???????? And the spread cannot be 60 pips (it has to be after the gap), and if it is before the gap, the 325 pips spread on the EUR is unbelievable. :)
Reason: