Original Pending Order Price - where is it?

 

Hey traders,

Is there a way to get the Orders original Pending Price?

 
hkjonus:

Hey traders,

Is there a way to get the Orders original Pending Price?

For example store it in the comment of the order.

Cheers

 
ggekko:

For example store it in the comment of the order.

Cheers


Is that field updatable? how? I only know you can use the OrderComment() function to retrieve the value. How to change it?

 
hkjonus:

Is that field updatable? how? I only know you can use the OrderComment() function to retrieve the value. How to change it?


You said original price. Original is original, not changes.

If you want to change that value, you have to use a variable for this.

 
ggekko:

You said original price. Original is original, not changes.

If you want to change that value, you have to use a variable for this.

dude,

when i enter a pending order at price=1.2000, It doesnt mean my OPENING PRICE will be 1.2000. I may get say 1.2003 or some other price and that number will be reflected as the OpenPrice.

but I need to know what the ORIGINAL Pending Order Price was. Are you clear on this?

now, please tell me how to set or make changes to the OrderComment field.

thank you!

 
hkjonus:

dude,

when i enter a pending order at price=1.2000, It doesnt mean my OPENING PRICE will be 1.2000. I may get say 1.2003 or some other price and that number will be reflected as the OpenPrice.

but I need to know what the ORIGINAL Pending Order Price was. Are you clear on this?

now, please tell me how to set or make changes to the OrderComment field.

thank you!

AFAIK you can't change the order comment after the initial OrderSend(). However, I guess that ggekko's point is that you know the price you're requesting at the time you do the OrderSend(), therefore you can put it in the comment. Broadly speaking, something like the following:


double RequestedPrice = <whatever>

OrderSend(Symbol(), OP_BUYLIMIT, 0.01, RequestedPrice, 999, 0, 0, "Requested " + DoubleToStr(RequestedPrice, MarketInfo(Symbol(), MODE_DIGITS)));


But, if you change the requested price after the initial send, you can't then update the comment. AFAIK.


And there's a further problem: brokers can and do change order comments themselves under certain conditions. They're not really suitable as a "tag". As ggekko's also said, the only fully reliable way is to track such order metadata in variables, and to persist it outside the EA across restarts as necessary.

 
jjc:

AFAIK you can't change the order comment after the initial OrderSend(). However, I guess that ggekko's point is that you know the price you're requesting at the time you do the OrderSend(), therefore you can put it in the comment. Broadly speaking, something like the following:


double RequestedPrice = <whatever>

OrderSend(Symbol(), OP_BUYLIMIT, 0.01, RequestedPrice, 999, 0, 0, "Requested " + DoubleToStr(RequestedPrice, MarketInfo(Symbol(), MODE_DIGITS)));


But, if you change the requested price after the initial send, you can't then update the comment. AFAIK.


And there's a further problem: brokers can and do change order comments themselves under certain conditions. They're not really suitable as a "tag". As ggekko's also said, the only fully reliable way is to track such order metadata in variables, and to persist it outside the EA across restarts as necessary.


Yes I see. I guess an inherint weakness of this environment is the inability to tag the orders with some useful info (on the servers data side) and track them. Ive decided to use Labels on the chart to post the Original Price and also the current Level of the trade (for closing partials). Ive noticed these are persistent across restarts. Thats good enough for my purposes. I dont want to get involved in reading & writing local datafiles.


Thanks jjc

 
hkjonus:

dude,

...

dude,

You can use global variables as well. They are persistent across restarts.

 
ggekko:

dude,

You can use global variables as well. They are persistent across restarts.

Yes, looks like I will have to use Globals since there is a ObjectSetText but NO ObjectGetText !

What the hell would I do if I need to store some TEXT information somewhere? Global Variables are type Double only.

 
hkjonus:

Yes, looks like I will have to use Globals since there is a ObjectSetText but NO ObjectGetText ! 

See ObjectDescription()

 
hkjonus wrote >>

Yes I see. I guess an inherint weakness of this environment is the inability to tag the orders with some useful info (on the servers data side) and track them.

Actually.... Dude,

You can use the Magic Number to track orders. Each order can have an individual Magic Number - if you wish. Then, in an array or whatever, you can tie whatever information you want to that Magic Number and hence that order. You just have to manage your assignment of Magic Numbers across all of your EA's that run on a particular account.

Reason: