Variable assignment only after actual execution of the order

Questions about MultiCharts .NET and user contributed studies.
tesiag
Posts: 6
Joined: 11 Jan 2014
Has thanked: 1 time

Variable assignment only after actual execution of the order

Postby tesiag » 29 Mar 2014

is there a way to get a given variable to be assigned ONLY WHEN fired orders are actually executed?

with a code like this:

if (PublicFunctions.DoubleGreater(Bars.High[0], Bars.High[1])){
variable = true;
buy_order.Send(Bars.High[1],Bars.High[1],pos_size);
}

when condition is true the order is fired and the variable is assigned to true.

But it may happen that the order is not executed at the end and in this case I would like not to have the variable assigned.

How can I do this?

Thank you

User avatar
Henry MultiСharts
Posts: 9165
Joined: 25 Aug 2011
Has thanked: 1264 times
Been thanked: 2957 times

Re: Variable assignment only after actual execution of the o

Postby Henry MultiСharts » 31 Mar 2014

Hello tesiag,

That is possible to assign the variable only after the actual position for the instrument changes.
Please check OnBrokerPositionChange, OnBrokerStategyOrderFilled


Return to “MultiCharts .NET”