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!
See more
See less

Partner 728x90

Collapse

Looking for most efficient code to record signal performance (per signal)

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

    Looking for most efficient code to record signal performance (per signal)

    Hi I am looking for the most efficient way to record performance of each signal,

    my signals are pushed as an enum value which is stored as _TradeSignal

    I also store a value for _LastSignals[0] as a list, so that I can look up what signals my last trades were...

    I was previously storing a pubic double for each signal type and then using the following formula to keep updating the performance history of each signal, whenever a trade had been closed

    MySignalPerformance = MySignalPerformance + (SystemPerformance.AllTrades.TradesPerformance.Tic ks.CumProfit - lastbalance);

    i feel like there is a more efficient way maybe a list or a way of storing values in the method? I haven't been programming long and I want this template to be as efficient as possible moving forward so I am using it as a learning opportunity... I am just converting my last strategy in to a template for other strategies and tidying up the concepts and making them more efficient and easy to read, it is bit of an unmanaged mode for managed mode, trying to get the best of both worlds for rithmic connections.

    curious how an experienced programmer would approach this problem?

    i want to store a bunch of performance metrics for evaluation so being efficient as possible is crucial

    i am not sure if there is an efficient way to this without having a bunch of repeating code for each signal... i figure there is...

    maybe autogenerate a list of doubles for each enum value and delete the list on termination?

    is it possible to generate the list using a for each loop? so that enum 0 is list item [0]?

    another idea would be to create an output method for performance like private static Performance(profit profit, winrate winrate, etc etc)

    I have only just got my head around creating my own methods and lists...
    Attached Files
    Last edited by BurnOutTrader; 07-20-2022, 01:57 AM.

    #2
    Hi BurnOutTrader, thanks for posting. Adding items to lists is not an inefficient operation, and lists can hold huge amounts of data. The best place to record new trades is in OnPositionUpdate when the position changes from flat to long/short or back. The SystemPerformance class already holds various lists of winning and losing trades and you can get performance data directly from those lists as well:



    Kind regards,
    -ChrisL
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Originally posted by NinjaTrader_ChrisL View Post
      Hi BurnOutTrader, thanks for posting. Adding items to lists is not an inefficient operation, and lists can hold huge amounts of data. The best place to record new trades is in OnPositionUpdate when the position changes from flat to long/short or back. The SystemPerformance class already holds various lists of winning and losing trades and you can get performance data directly from those lists as well:



      Kind regards,
      -ChrisL
      nice i never noticed the system performance class thankyou.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by helpwanted, Today, 03:06 AM
      0 responses
      3 views
      0 likes
      Last Post helpwanted  
      Started by Brevo, Today, 01:45 AM
      0 responses
      7 views
      0 likes
      Last Post Brevo
      by Brevo
       
      Started by aussugardefender, Today, 01:07 AM
      0 responses
      5 views
      0 likes
      Last Post aussugardefender  
      Started by pvincent, 06-23-2022, 12:53 PM
      14 responses
      242 views
      0 likes
      Last Post Nyman
      by Nyman
       
      Started by TraderG23, 12-08-2023, 07:56 AM
      9 responses
      384 views
      1 like
      Last Post Gavini
      by Gavini
       
      Working...
      X