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

 
Top2n:

Any other suggestions?

I connect a script to an offline graphic, the terminal hangs. Maybe it's possible to mount code in robot, then what to do with#import "user32.dll"

The script was just an example, no one said it should be put on the offline chart. It is usually run on a normal chart and specify the TF of the offline chart in the line

 int whdl=WindowHandle (Symbol(), period_renko);  

And #import "user32.dll" is not needed, it is called in WinUser32.mqh

In fact, there is an indicator "6MTH_Renko_Chart_Builder_Indi_Ver_02.mq4" that can emulate ticks on the created Renko chart. It works like this, the indicator is run on a regular chart, then it opens Renko chart which is updated in real time.


 
evillive:

The script was just an example, no one said it should be put on an offline chart. It is usually run on a normal chart and specify the TF of the offline chart in the line

And #import "user32.dll" is not needed, it is called in WinUser32.mqh

In fact, there is an indicator "6MTH_Renko_Chart_Builder_Indi_Ver_02.mq4" that can emulate ticks on the created Renko chart. It works like this, the indicator is run on a regular chart, then it opens Renko chart which is updated in real time.


Thank you!)
 

Hello, can you tell me how to do this?

There is a piece of code like this and it works. These are signals when approaching trading levels. Buy1_line is a level on the chart, buy1 is distance of price in pips from the corresponding level. The matter is that the code has ability to disable levels you don't need. In this case, the value of level buy1_line (0.00000) and distance - is displayed as a 6-digit number, which makes no sense in principle. (The level is disabled, you don't need to know the distance) Question! How to null the distance to the level - buy1, if the corresponding level is disabled? (or instead of this number write OFF ?)

string buy1_line=DoubleToStr(Price_Line,Digits);
string buy2_line=DoubleToStr(Price_Line2,Digits);
string buy1=     DoubleToStr((Price_Line-Bid)/Point,0);
string buy2=     DoubleToStr((Price_Line2-Bid)/Point,0);       

message=
 "buy_1 ("+buy1_line+"):"+(buy1>"0"?"+":"")+buy1+"   \n"+
 "buy_2 ("+buy2_line+"):"+(buy2>"0"?"+":"")+buy2+"   \n";

SendNotification(message);
 

Hi, could you please tell me if there is any way to get a ticket of a just sent order?

ticket = OrderSend(Symbol(), cmd, Lot((OOP-OSL)/Point),OOP,1,OSL, OTP,NULL, Expert_ID, 0);

then i check if ticket < 1, and now i want to get the OrderTicket() number without going through all open orders again, as there may be many, and i expect a problem if i send two almost identical orders with different stops at once

Thank you!

 
danik:

Hi, could you please tell me if there is any way to get a ticket of a just sent order?

ticket = OrderSend(Symbol(), cmd, Lot((OOP-OSL)/Point),OOP,1,OSL, OTP,NULL, Expert_ID, 0);

then i check if ticket < 1, and now i want to get the OrderTicket() number without going through all open orders again, as there may be many, and i expect a problem if i send two almost identical orders with different stops at once

Thank you!

And you don't need OrderSend(), to know the ticket of an order which is already open, you should select it using OrderSelect().

In the loop, you should scroll through all market orders, select each of them and if their type, symbol and magician match, write the ticket in the array.

Then sort the array in ascending order. The highest value of the ticket is the most recent order.

 
Yeah, I guess we'll have to do that. I was wondering if there was a trick or method to get a ticket for an order that's just been sent. Well there isn't, I'll have to do it the old fashioned way, too bad. thanks!
 
danik:
I thought there may be a way to get a ticket that has just been sent out. If not, I'll have to do it the old-fashioned way and that's a pity. Thanks!

Only the opened ticket will be as you wrote -ticket = OrderSend(Symbol(), cmd, Lot((OOP-OSL)/Point),OOP,1,OSL, OTP,NULL, Expert_ID, 0);

But it's provided that request was executed without errors, and such ticket is overwritten quickly.

 
danik:

Hi, could you please tell me if there is any way to get a ticket of a just sent order?

ticket = OrderSend(Symbol(), cmd, Lot((OOP-OSL)/Point),OOP,1,OSL, OTP,NULL, Expert_ID, 0);

then i check if ticket < 1, and now i want to get the OrderTicket() number without going through all open orders again, as there may be many, and i expect a problem if i send two almost identical orders with different stops at once

Thank you!

Why don't you like to declare tickets at global variable level?
 

The problem is that these tickets are more than one. maybe 4, I don't know exactly yet. that's why I created a class with ticket number and other information that is not stored by orderselect. so I wanted to have access to the ticket. but so far I can only create class objects and put them into CarrayObj and then get the index, compare the ticket and further analyze. But I've solved it, thanks. I blame myself elsewhere. GentlemenevilliveAlexeyVik - thank you for your prompt replies!

 

The problem is that these tickets are more than one. maybe 4, I don't know exactly yet. that's why I created a class with ticket number and other information that is not stored by orderselect. so I wanted to have access to the ticket. but so far I can only create class objects and put them into CarrayObj and then get the index, compare the ticket and further analyze. But I've solved it, thanks. I blame myself elsewhere. GentlemenevilliveAlexeyVik - thank you for your prompt replies!

Reason: