Account.Balance.ToString() not working
Account.Balance.ToString() not working
13 Dec 2013, 20:03
Hi,
I added plenty of Print(...) in my robot for the debug purposes.
The prints help me to monitor the robots operation.
What I noticed that the Account.Balance.ToString() and Account.Equity.ToString() don't work.
Code for example:
protected override void OnTick() { ... ... if(......) { Print("Account.Balance before the trade is ", Account.Balance.ToString()); Print("Account.Equity before the trade is ", Account.Equity.ToString()); } ... ... }
What I get in the prints is only:
13/12/2013 17:18:18.501 | Account.Balance before the trade is
13/12/2013 17:18:18.501 | Account.Equity before the trade is
As you see, no value is shown.
I am using a demo account. Not sure if it matters.
Can anyone explain what is wrong?
Thanks
UVX
Replies
Hyperloop
13 Dec 2013, 23:31
RE:
uvx_01 said:
Just tested again.
Print("Account.Balance before the trade is {0} ", Account.Balance);is showing the numbers, while the
Print("Account.Balance before the trade is ", Account.Balance.ToString());isn't.
Of course the second wouldn't.
Print("Account.Balance before the trade is " + Account.Balance.ToString());
This would though.
@Hyperloop
uvx_01
13 Dec 2013, 23:35
I just realized how stupid my question was.
I was pretty tired when I wrote this line of code :)
It should have been:
Print("Account.Balance before the trade is " + Account.Balance.ToString());
or
string msg = "Account.Balance before the trade is " + Account.Balance.ToString(); Print(msg);
LOL
@uvx_01
Hyperloop
13 Dec 2013, 23:35
Reason your code isn't working isn't because of the To.String(), it's because you're use of string concatenation is incorrect.
@Hyperloop
Cerunnos
13 Dec 2013, 20:20
You have to add {0}
@Cerunnos