Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Not Printing Out Statistics Of Trades

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

    Not Printing Out Statistics Of Trades

    I have written a ninjascript code with using the strategy wizard so the statistics of my trades are not being displayed. Also i am referencing an ATM Strategy with my current strategy conditions which might explain some of the noise. I have made a couple attempts at this and references to the help guide and seems to still not be working. I am a beginner at programming so it might be something simple that i missed. I have the script attached below i was wondering if anyone could assist me in this. I am looking for the basic stats now realized, unrealized, postion, avg. price and exit time.

    Thank You
    Attached Files

    #2
    Hello RColtelli,

    Unfortunately the built in trade performance class cannot be used with NS > ATM strategies. There are dedicated methods for accessing a lot of this, but it does require working in code and a strong familiarity with the SampleAtmStrategy in order to integrate it. See the ATM based methods (ATM Strategy Monitoring section) at the link below:
    Ryan M.NinjaTrader Customer Service

    Comment


      #3
      After reading the link you provided i added a code of

      protectedoverridevoid OnBarUpdate()
      {

      {
      Print(
      "Unrealized PnL is " + GetAtmStrategyUnrealizedProfitLoss("id").ToString());
      Print(
      "PnL is " + GetAtmStrategyRealizedProfitLoss("id").ToString());

      }

      This seems to still not work is there something i am missing or something that i might not have labeled right?
      Thank You

      Comment


        #4
        RColtelli,

        I am happy to assist you.

        Most likely this is wrong : GetAtmStrategyUnrealizedProfitLoss("id") <--- The "id" part.

        This needs to be the unique ID generated for your active ATM strategy. In your case I believe its : atmStrategyId

        So this is what you want :

        Code:
        protectedoverridevoid OnBarUpdate()
        {
        
        Print("Unrealized PnL is " + GetAtmStrategyUnrealizedProfitLossatmStrategyId).ToString());
        Print("PnL is " + GetAtmStrategyRealizedProfitLoss(atmStrategyId).ToString());
        
        }
        Please let me know if I may assist further.
        Adam P.NinjaTrader Customer Service

        Comment


          #5
          I copied and pasted the code you suggested in lines 47-52 saved and compiled it again and reset the strategy and still no results are showing.

          Comment


            #6
            To see a working example of this: click Tools > Edit NinjaScript > Strategy > SampleAtmStrategy. Lines 86-96 are used print these values to the output window.
            Ryan M.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by fx.practic, 10-15-2013, 12:53 AM
            5 responses
            5,404 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by Shai Samuel, 07-02-2022, 02:46 PM
            4 responses
            95 views
            0 likes
            Last Post Bidder
            by Bidder
             
            Started by DJ888, Yesterday, 10:57 PM
            0 responses
            8 views
            0 likes
            Last Post DJ888
            by DJ888
             
            Started by MacDad, 02-25-2024, 11:48 PM
            7 responses
            159 views
            0 likes
            Last Post loganjarosz123  
            Started by Belfortbucks, Yesterday, 09:29 PM
            0 responses
            8 views
            0 likes
            Last Post Belfortbucks  
            Working...
            X