C# to Revise Orders

Login or Register

Please login or register in order to view and post in the Forum.

3 posts / 0 new
Last post
_adam
Last seen: 1 week 4 days ago
Joined: 12/10/2017 - 14:44
C# to Revise Orders

Hi,

I want to revise a limit order / target based on a price I have put into C#1, however am unable to. In the screenshot I've attached, where "V#1" is for "Limit", if I put "C#1" there I get an error when a revision order tries to execute.

I am able to do this no problem with V#1, and I am confident that I am correctly setting the desired price I am looking for to C#1, as I have put an annotation on the chart for %C#1 - looks good.

The error I'm getting in the trade log is "Invalid Order ID Number. Cannot Cancel / Revise Order. Error Code -325".

Any ideas why I am unable to do this for C#1 the same way I am for V#1?

Thanks.

0
Eddy
Last seen: 1 day 15 hours ago
Joined: 03/01/2024 - 15:25
Use of C# , V# and T# variables inside trading order definition

Hello Adam,

C# variables are related to a specific Chart, not a specific instrument, ie you could change the main instrument of a given chart, the C#1 value attached to that chart will remain unchanged. This also means that, outside of a specific chart environment, the value stored in a C# is not "linked" anymore to a given instrument. 

Therefore, for a revise order action, the corresponding input price (a limit price in your case), that will be transmitted to the order routing system, really needs to be "associated" with an instrument. This is why the only possible "input" for the Limit Price is a V# variable, as these variables are storing a value specific to a given instrument.

I guess you are either using a SET(C#1,xx) type of statement or maybe a button to calculate your C#1 value. It should be possible to use instead a SET(V#10,xx) type of statement or switch to a Button storing a V#10 Variable. 

Let us know if you are using another method to define your C#1, but in all cases, one needs to use V# Variable as input price for any kind of trading order actions.

Cheers

Eddy

Notes :

a) for example, it is impossible to include any C# variable into a scan or standalone backtest runs (with the C# variables possibly appearing inside custom indicator definitions or in a SET statement). All user variables have to be V# (or T#) variables. 

b) It is possible in a trading order definition to use T# variable for the OrderID reference. In your above definition, you are using the "default" Order ID (of a resting Sell Limit order), which is perfectly fine (as long as you have a single resting limit Sell order). For the record, if you would develop one day a system that would manage multiple resting Sell Limit orders, you would have to use T# variables for storing the specific IDs of each Limit order (at the time of their creation) so that you could reference (each of them) later in possible Revise price (and/or Qty) actions....

_adam
Last seen: 1 week 4 days ago
Joined: 12/10/2017 - 14:44
Hey Eddy,

Hey Eddy,

Thanks for the quick reply and great info.

The last thing you said, "b", is exactly what I'm trying to do - and why I was opting for C# as opposed to V#. I figured I'd have two open charts running 2 different systems on the same instrument, and be able to revise orders to corresponding C# values. However, what you said and why that won't work makes sense.

I'm guessing it would be something like SET(T#1, TR_SELL_LMT) for "System 1" and SET(T#2, #TR_#2SELL_LMT) for "System #2?

My concern with this would be if System 2 fires off before System 1 - then this wouldn't work (in this instance, the order would be #TR_SELL_LMT, not #TR_#2SELL_LMT). Or, if ONLY System #2 is in a position, then TR_#2SELL_LMT wouldn't be correct either?

Maybe this is much easier than I'm trying to make it. Curious your thoughts, and thanks again for the help.