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

 
Alexandr24:

Dear forum users, help with the code

How to find the time of the bar by condition, ie what should stand in place of (time1=D'00:00';). The price crosses the line and the arrow should be drawn on the bar that crossed the line.


Maybe this will help: https://docs.mql4.com/ru/convert/StrToTime
 
volshebnik:

OpenFrv Up=79.215 SL=77.855 TP=79.445 STOPLEVEL=200

Revv Up=78.065 SL=76.705 TP=78.295 STOPLEVEL=200


and what is the Ask price ?

Is there 200 pips from it to OpenFrw Up ?

And what is the spread?

 
Alexandr24:
You can put Time[0] instead of time1 but it will be in real time mode. And if you want to throw to "history" then how can you find the time of the bar which crossed the line?
https://docs.mql4.com/ru/series/iTime
 
Alexandr24:
You can put Time[0] instead of time1 but it will be in real time mode. And if you want to throw to "history" then how can you find the time of the bar which crossed the line?
If we know the number of the bar where the crossing occurred, then Time[bar number]
 
 
Dimka-novitsek:


Please contact and make people happy here, and keep your Viennese forest tales and Madrid court secrets to yourself.... (read "puzzles" in the absence of a "concrete and detailed" question).
 

Yeah, got it. if (OrdersTotal( ) !=0 {

How to correctly prescribe the OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES );OrderDelete(ticket,Red);Alert ("OrderDelete error", GetLastError());
// OrderClose( ticket, Lots, Bid, 5, 0 ); Alert ("OrderClose error", GetLastError()); }

 
Dimka-novitsek:

Here's a tip.

There's a cool trick in the editor - the F1 hint.

Highlight the function you're quashing and press F1.

Help will open, and you should carefully study what the parameters of the function should be.

Don't miss the quantity and quality of parameters fed into the function.

 
Dimka-novitsek:

Yeah, got it. if (OrdersTotal( ) !=0 {

How to correctly rewrite the OrderSelect(ticket,SELECT_BY_TICKET,MODE_TRADES );OrderDelete(ticket,Red);Alert ("Error OrderDelete ", GetLastError();
// OrderClose( ticket, Lots, Bid, 5, 0 ); Alert ("OrderClose error", GetLastError()); }


Just read the workbook - it's all there - ... order select in a loop on the orders you are interested in... etc... These are standard 'pieces' of code...
 
PapaYozh:


What is the Ask price?

Is there 200 pips from it to the OpenFrw Up ?

And what is the spread ?

PapaYozh , thank you very much for messing with me! The problem turned out to be this Stop Level. Ask was closer than 200 units before the opening, so it didn't open. Everything is fine now, thanks !
Reason: