Account information

Questions about MultiCharts .NET and user contributed studies.
tradetree
Posts: 81
Joined: 29 Apr 2013
Location: www.threefoldmarkets.com
Has thanked: 12 times
Been thanked: 16 times
Contact:

Account information

Postby tradetree » 15 Dec 2013

From .NET signal code I'm trying to get several pieces of information. Any parts that I'm missing would be appreciated:
Needed as strings: Account name, Account balance, Number of contracts, Base instrument.

My attempt at some of these:

Code: Select all

string equity = InitialCapital.ToString() + ", " + NetProfit.ToString();
string status = "Acct: " + Account.ToString() + TradeManager.TradingData.Accounts.ToString() + Profile + " Bal: " + equity + " Cont: " + Contracts.Default.ToString() + " Inst: ";
Note that I could find nothing at all for the base instrument, so it has nothing after "Inst". I can also see in the debugger that the Contracts.Default does not give me the number of contracts, so I know that is wrong as well. Most of this is wrong, I just can't find the values through the documentation.

tradetree
Posts: 81
Joined: 29 Apr 2013
Location: www.threefoldmarkets.com
Has thanked: 12 times
Been thanked: 16 times
Contact:

Re: Account information

Postby tradetree » 15 Dec 2013

I think this is now correct:

Code: Select all

string equity = InitialCapital.ToString() + ", Net:" + NetProfit.ToString();
string status = "Inst: " + Bars.Info.Name.ToString() + ", " + Bars.Info.Resolution.Size.ToString()
+ " min, Exp: " + Bars.Info.Expiration.ToString() + " Cont: " + Contracts.Default.Contract.ToString() + " Acct: "
+ Account.ToString() + " " + Profile + " Bal: " + equity;

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

Re: Account information

Postby Henry MultiСharts » 16 Dec 2013

Hello tradetree,

Contracts.Default is used in order constructor to tell the signal to use the amount of contracts specified in Format->Strategy Properties->Properties->Trade size.
An alternative to that is to specify the amount of contracts in the code with Contracts.UserSpecified. Example here.

Contracts.Default does not return the Trade size value from Strategy Properties into the code.

tradetree
Posts: 81
Joined: 29 Apr 2013
Location: www.threefoldmarkets.com
Has thanked: 12 times
Been thanked: 16 times
Contact:

Re: Account information

Postby tradetree » 19 Dec 2013

So is there no way to find out within the code how many contracts are being traded? This is a problem for risk management calculations and partial exit strategies. I guess what that would mean is that I'd have to use an input to give the number of contracts, and then use the API within the code to set the contracts, thus overriding the default?

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

Re: Account information

Postby Henry MultiСharts » 20 Dec 2013

tradetree,

You can use CurrentPosition.OpenLots – the amount of not closed contracts in the position.
Please see Strategy Performance for more information.


Return to “MultiCharts .NET”