Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Get P/L for the day in ninjascript
Collapse
X
-
JoshDance, you could check into - http://www.ninjatrader.com/support/h...countvalue.htmBertrandNinjaTrader Customer Service
-
Bertrand,
Please forgive my ignorance, and I have not programmed a strategy before. I have CalculateOnClose set to false, and my OnBarUpdate() is a single line:
Code:protected override void OnBarUpdate() { Print("account value is: " + GetAccountValue(AccountItem.CashValue)); }
Comment
-
Originally posted by NinjaTrader_Bertrand View PostWhat connection / account are you running the strategy off? Does the CashValue show as expected in your Accounts tab in the Control Center?
Thanks,
By the way, my broker uses TT -- this feed does not allow me to see cash value, etc., so does that mean that even if I get this working that it will not be usable with TT?
Comment
-
Correct for TT, you can only access value offered through the connected API with this method. Your strategy though could keep track itself of per session PnL then, but this would only reflect PnL for this very strategy instance :
For your print - are you sure the strategy is enabled? So showing 'green' in your Strategies tab in the Control Center?BertrandNinjaTrader Customer Service
Comment
-
Originally posted by NinjaTrader_Bertrand View PostCorrect for TT, you can only access value offered through the connected API with this method. Your strategy though could keep track itself of per session PnL then, but this would only reflect PnL for this very strategy instance :
For your print - are you sure the strategy is enabled? So showing 'green' in your Strategies tab in the Control Center?
Comment
-
Originally posted by NinjaTrader_Bertrand View PostYour strategy though could keep track itself of per session PnL then, but this would only reflect PnL for this very strategy instance :
Comment
-
Correct, it would be only knowing the Pnl for the specific strategy instance then, not for your manual trading. If your TT account would not offer this info to retrieve via GetAccountValue then you would not be able to set up a monitor script for this task.BertrandNinjaTrader Customer Service
Comment
-
So, knowing everything you know about the NT code, can you help me find a way to do what I'm looking to do? I don't mind even manually entering an account balance into an indicator every day if it can't be retrieved programatically. How about reading the log file? Anything to get this working... there's always a way, and this seems not too far out of the box.
Comment
-
Originally posted by NinjaTrader_Bertrand View PostJoshDance, an untested approach would be - enter start account balance as input to calculate with and add your RealizedPnl that NT would calculate for a TT based account, this would be 'gettable' as well via GetAccountValue.
Comment
-
Originally posted by NinjaTrader_Bertrand View PostDon't close the trade with the 'Close' button on ChartTrader or DOM. This would cancel working orders and close the position and running strategies on that instrument / account.
Comment
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by rocketman7, Today, 09:41 AM
|
4 responses
15 views
0 likes
|
Last Post
by rocketman7
Today, 02:56 PM
|
||
Started by selu72, Today, 02:01 PM
|
1 response
9 views
0 likes
|
Last Post Today, 02:17 PM | ||
Started by WHICKED, Today, 02:02 PM
|
2 responses
12 views
0 likes
|
Last Post
by WHICKED
Today, 02:15 PM
|
||
Started by f.saeidi, Today, 12:14 PM
|
8 responses
21 views
0 likes
|
Last Post
by f.saeidi
Today, 01:55 PM
|
||
Started by Mikey_, 03-23-2024, 05:59 PM
|
3 responses
56 views
0 likes
|
Last Post
by Sam2515
Today, 01:47 PM
|
Comment