Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to determine daily profit / loss

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • michaelsh
    replied
    Thank you Chris, this helped

    Leave a comment:


  • NinjaTrader_ChrisL
    replied
    Hello michaelsh, thanks for your reply.

    There is not a supported way of getting historical executions from the database. There is an example in NinjaTrader 7 here that reads an SQL database:

    https://ninjatrader.com/support/foru...sample?t=10296

    You would need to target the NinjaTrader.sdf in Documents\NinjaTrader 8\db for the execution database. Unfortunately, I have never attempted this so I have no example to give.

    Please let me know if there's anything else I can help with.


    Leave a comment:


  • michaelsh
    replied
    Chris,

    I appreciate your prompt reply.
    Just to confirm: Is there any way I can request list of trades from the Account object?
    Thank you

    Leave a comment:


  • NinjaTrader_ChrisL
    replied
    Hello michaelsh, thanks for your reply.

    If the strategy can not get trades from the historical data run you will need to design your own way of getting performance values. Either record the trades and performance metrics to a .txt file or custom database as they happen in real time for future use, or find a way for the external signal generator to work in the historical state. We have an example of reading and writing to a file here:

    https://ninjatrader.com/support/help..._propertie.htm

    Please let me know if I can assist any further.

    Leave a comment:


  • michaelsh
    replied
    Hi Chris,
    Thank you for your answer.
    The SystemPerformance class will build up historical trade values as the script runs through the Historical State
    My strategy is obtaining real time trading signals from external resources, so I can't use historical state.
    My goal is to manage risk by setting maximum daily loss. I can use either Strategy or Account statistics. How would I achieve that?
    Thanks.

    Leave a comment:


  • NinjaTrader_ChrisL
    replied
    Hello michaelsh, thanks for writing in.

    The SystemPerformance class will build up historical trade values as the script runs through the Historical State.

    e.g. These prints will display the number of trades taken by the strategy and the net profit from all the "Virtual" trades taken by the strategy.

    Print("The strategy has taken " + SystemPerformance.AllTrades.Count + " trades.");
    Print("Net profit is: " + SystemPerformance.AllTrades.TradesPerformance.NetP rofit);

    Could you test this on your strategy and let me know if you see any differences?

    I look forward to hearing from you.

    Leave a comment:


  • michaelsh
    started a topic How to determine daily profit / loss

    How to determine daily profit / loss

    Hello,

    I need to find out daily profit / loss of the strategy for risk management purposes, regardless if strategy was restarted.
    However, SystemPerformance seems to start from scratch every time strategy restarts
    I use IncludeTradeHistoryInBacktest = true;

Latest Posts

Collapse

Topics Statistics Last Post
Started by cjanau, Today, 11:07 AM
0 responses
7 views
0 likes
Last Post cjanau
by cjanau
 
Started by TrendFollowingCapital, Today, 05:53 AM
0 responses
10 views
0 likes
Last Post TrendFollowingCapital  
Started by TrendFollowingCapital, Today, 05:38 AM
0 responses
7 views
0 likes
Last Post TrendFollowingCapital  
Started by John Bogui, Today, 03:57 AM
2 responses
41 views
0 likes
Last Post John Bogui  
Started by Dolfan, 12-30-2020, 12:04 PM
9 responses
72 views
0 likes
Last Post timko
by timko
 
Working...
X