Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 6. - page 325

 
alexey1979621:
Hello all! Please advise how to solve the following problem (I am interested in the order of opening and accounting of orders). I am opening a sell order and I need to place an OP_BUYSTOP order instead of a Stop Loss after a certain amount of pips. There is no problem with opening one order at all, but to open two at once......... Surely someone has done similar solutions. Thanks in advance.


I don't see any problems:

1) check the condition to open a sell order

2) open a sell order

3) check if the Sell order is really opened and all conditions to open OP_BUYSTOP are met (flag it)

4) check the flag to open OP_BUYSTOP and open OP_BUYSTOP

5) check or would really like to open the order OP_BUYSTOP

 
borilunad:

Yes I just tried it, was it long, it was interesting! I looked at the spread in Visual, it changes with every tick, in Real it's not so frequent and sharp, but it can be adjusted by the formula and conditions. I cannot do without stop orders only, I open by market price during market moves and cannot do without limit orders when reversal is imminent.

It's too early to thank you for the pancakes. I'm not so keen on Skype, almost like in Krylov: "He sees a pancake, but he has a grudge"! Or like the Fox at the Crane! Especially in Virtual, it's not the same! Someday or other, everything may happen on occasion! The main thing is that we and your kitty are healthy!

Thanks. Health is definitely a good thing :) Only I have a cat. I don't like cats for some reason. They don't taste good...
 
ALXIMIKS:


I don't see any problems:

1) check the condition to open a sell order

2) open a sell order

3) check if the Sell order is really opened and all conditions to open OP_BUYSTOP are met (flag it)

4) check the flag to open OP_BUYSTOP and open OP_BUYSTOP

5) check if the order OP_BUYSTOP would really open

Don't need a flag. The flag can be lost in abnormal situations. It is better to check if there is an open position and if so - further
 
tara:

Be careful - women don't feed him for some reason.

And spread modelling is a thankless task, I wouldn't recommend it to my enemy.

This... Is it just me... or did I really hear something about food?

You have to worry about yourself. It just so happens...

 

I have an interesting question, how do I check if there is a connection to the server to trade?

A normal connection was clearly there, because ticks were coming in, and for each tick a request to open an order was sent.

But in the log we see the following picture... Please explain what happened and why? Or maybe the connection was magically lost at this minute?

 
There is no need to check the connection. No connection - no ticks, EA does nothing. If the connection is sometimes lost for a short time, this is normal.
 
Integer:
No need to check the connection. No connection - no ticks, the Expert Advisor does nothing. The fact that the connection is sometimes lost for a short time is a normal phenomenon.


Once again, I will clarify that there were ticks and there was no open trade flow, at the very moment when there was a signal to open an order, 9 ticks passed in the logs during which there was a signal but the trade flow was busy.

That's what I want to know, was it an accident or not:)

Only one EA is trading in the terminal, so there couldn't have been a fight to use the flow.

 
mzk_3om6u:


Once again, the ticks were there, not an open trade thread, the exact moment there was a signal to open an order, there were 9 ticks in the logs during which there was a signal, but the trade thread was busy.

That's what I want to know, was it an accident or not:)

Only one EA is trading in the terminal, so there could not have been a fight to use the flow.



It wasn't the ticks, it was the terminal trying to log in.
 
Integer:


It wasn't the ticks, it was the terminal trying to log in.

Well, every tick, new information goes through, every tick the buy signal goes through, but the server is trying to log in at that moment (during the ticks).
 
mzk_3om6u:

Well, every tick, new information goes through, every tick the buy signal goes through, but the server tries to log in at that moment (during the ticks).


So, let it be, what's wrong with it?

But if anything, there is an IsConnected() function;