How to access Strategy Properties - Trade size - in code  [SOLVED]

Questions about MultiCharts .NET and user contributed studies.
EdL
Posts: 39
Joined: 18 Feb 2013
Has thanked: 22 times
Been thanked: 11 times

How to access Strategy Properties - Trade size - in code

Postby EdL » 04 Mar 2013

Hi,

I'm setting the Strategy Properties > Trade Size > Fixed Shares/Contracts.

How can I then access this value in code?

I've tried:

Code: Select all

Contracts.Default.Contract

but it returns 0.

I've also tried:

Code: Select all

_longMO = OrderCreator.MarketNextBar(new SOrderParameters(Contracts.Default, "LongMO", EOrderAction.Buy));

...

_longMO.Send();

...

_longMO.Info.Contracts.Contract
but that also returns 0.

Many thanks,

Ed

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

Re: How to access Strategy Properties - Trade size - in code  [SOLVED]

Postby Henry MultiСharts » 04 Mar 2013

Hello Edl,
I'm setting the Strategy Properties > Trade Size > Fixed Shares/Contracts.
How can I then access this value in code?
You cannot access that value from the code.
You can either specify the amount of contracts in the code or in the Properties tab.

Here is an example how to specify the amount in the code. If you do not specify the amount to buy/sell in the code then the value specified in Fixed Shares/Contracts of the Properties tab of the Strategy Properties would be used.

EdL
Posts: 39
Joined: 18 Feb 2013
Has thanked: 22 times
Been thanked: 11 times

Re: How to access Strategy Properties - Trade size - in code

Postby EdL » 04 Mar 2013

Thanks for clarifying that Henry. I'll define the number of contracts in code instead of using the strategy properties.

Ed


Return to “MultiCharts .NET”