[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 66

 
sergeev:

right it pops up.

You have to take Bid and Ask from MarketInfo function

like - ask= MarketInfo(OrderSymbol(), MODE_ASK);

and do not forget to normalize
ask=NormalizeDouble(ask, MarketInfo(OrderSymbol(), MODE_DIGITS));


Thank you, let's continue to study the math :))
 
sergeev:

right it pops up.

You need to take the Bid and Ask from the MarketInfo function

like - ask= MarketInfo(OrderSymbol(), MODE_ASK);

and don't forget to normalize
ask=NormalizeDouble(ask, MarketInfo(OrderSymbol(), MODE_DIGITS))


Urrrrra!!!!! Got it!!!!!!!!! )))))))) The code looks like this:

void CloseAll_b(int Prosk){
string SMB=Symbol();
for (int i=OrdersTotal()-1;i>=0;i--){
if (!OrderSelect(i, SELECT_BY_POS, MODE_TRADES)){
Alert("Error ",GetLastError()," when order number is selected ",OrderTicket()," by pair ",Symbol());
}
else{
RefreshRates();
if(OrderType()==OP_BUY){
if(!OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),Prosk,CLR_NONE)){
Alert("Error ",GetLastError(),",OrderTicket(),",Symbol();
NormalizeDouble(Bid, MarketInfo(OrderSymbol(), MODE_DIGITS))
}
}
if(OrderType()==OP_SELL){
if(!OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(), MODE_ASK),Prosk,CLR_NONE)){
Alert("Error ",GetLastError(),",OrderTicket(),",Symbol();
NormalizeDouble(Ask, MarketInfo(OrderSymbol(), MODE_DIGITS));
}}}}}

Thank you very much!!!

 
nemo811:


Urrrrah!!!!! Got it!!!!!!!!! )))))))) The code looks like:


Just make it look nice, format it and make intermediate variables (for calculated values that are used more than twice).

or in a fortnight you'll be lost and forget what he's doing...

 
sergeev:

Just make it look nice, format it and make intermediate variables (for calculated values that are used more than twice).

or in a fortnight you'll be lost and forget what it does...



...This is already the ultimate aerobatics for me. I've only learned how to fly paper aeroplanes so far :))))
 

Can you please advise how to set a stop after an order is opened in an EA?

I have not found anything useful.

 
AAE:

Can you please advise how to set a stop after an order is opened in an EA?

I have not found anything useful.

do you mean your broker opens market orders without any stops?

for the tester version, you can execute OrderModify immediately after the order opens.

If you just need a delay, then you can do Sleep as previously advised.

 
AAE:

Can you please advise how to set a stop after an order is opened in an EA?

I have not found anything useful.


Put something like

Sleep(5000);

if that's you who needs a delay, not the broker who needs your money :))

 

Sorry for the insolence, but if I may, please advise:

How to implement that the orders opened manually on a given pair will be assigned the same MAGIC,

as the orders opened by the Expert Advisor itself. (MAGIC is not equal to 0)?

 
nemo811:

Sorry for the insolence, but if I may, please advise:

How to implement that the orders opened manually on a given pair will be assigned the same MAGIC,

as the orders opened by the Expert Advisor itself. (MAGIC is not equal to 0)?




question removed - I found in the manual, and I quote: "...when an order is set(a position is opened), it may be assigned a unique number, by which it can be distinguished later from the others. This feature makes no sense (and will never work) when trading manually, but it is irreplaceable when trading using an Expert Advisor".

We will have to look for another solution.

 
gince:

Thank you for seeing the post. I am attaching the indicator.

It needs a filter to filter out unnecessary arrows. The picture on page 56 shows it. Of all the arrows going the same way, only the first one is needed.

I also did this, but it's not right.



I'm sorry. I completely forgot.
Files:
cross1_1.mq4  4 kb
Reason: