Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

TradesPerformance

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

    TradesPerformance

    I am running 6.5.1000.1 and using this sample code.

    It does not pickup any PnL in Market Replay nor real time feed. My cs is making trades and this code just prints 0 for TradesCumProfit

    TradesCumProfit =
    Performance.AllTrades.TradesPerformance.Currency.C umProfit
    + Position.GetProfitLoss(Close[0], PerformanceUnit.Currency);

    Print ( TradesCumProfit = "+TradesCumProfit );

    #2
    Josh will double check by tomorrow.
    RayNinjaTrader Customer Service

    Comment


      #3
      thanks Ray

      Possibly related....prior to NT 6.5.1000.1 my cs would detect is a trade was 'Stopped' via the ControlCenter/Strategy tab... by using the code:

      if ( atmStrategyIdBreak.Length > 0
      && GetAtmStrategyMarketPosition(atmStrategyIdBreak) == Cbi.MarketPosition.Flat )

      today I closed an atm strategy (which was initiated via my cs) via the strategies tab and the cs still thinks it has a trade on (i.e. it keeps updating unrealizedPnL as if the trade is still active)...therefore, Length must still be > 0 and position is not flat....even though in Strategies tab and Positions tab show the strategy and position closed.

      was something changed in this area since Beta 10?....as I have not changed my code

      thanks.
      Last edited by ATI user; 04-09-2008, 09:11 AM.

      Comment


        #4
        Hi ATI_User,

        I am not sure if your code is correct because it does not compile. When I use an alternate code snippet I get PnL responses that are the ones that you would expect.

        Please try my attached test sample.

        About your atmstrategy question: Can you provide a simple as possible sample that demonstrates what you are seeing? Thanks.
        Attached Files
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Hey Josh

          I ran your strategy and of course it prints PnL properly.

          I copied your code into my strategy (even though the code I was using is identical) and although my cs places trades, your code still prints zero.

          The only difference I can see is that you use Enter Long/Enter Short and my cs uses:

          AtmStrategyCreate(Action.Sell, OrderType.Market, 0, 0, TimeInForce.Day, orderIdBreak, AtmTemplateM, atmStrategyIdBreak);

          could this be the difference? i.e. the code only picks up PnL for backtesting?

          In other words, do I need to pass IDs to TradesPerformance somehow?

          Thanks

          ATI

          ps...my code in the initial post did not compile as a " was left out of the print statement.
          Last edited by ATI user; 04-09-2008, 09:34 PM.

          Comment


            #6
            Josh

            Plug this in to your sample and your will see it only prints 0

            Note: you will need to create an atm strategy named "AutoATM" of course.


            if (CrossAbove(SMA(Fast), SMA(Slow), 1))
            {
            Print(Time[0] + " Submit Long");
            BackColor = Color.Green;
            // EnterLong();
            AtmStrategyCreate(Action.Buy, OrderType.Market, 0, 0, TimeInForce.Day, GetAtmStrategyUniqueId(),"AutoATM", GetAtmStrategyUniqueId());
            }
            else if (CrossBelow(SMA(Fast), SMA(Slow), 1))
            {
            Print(Time[0] + " Submit Short");
            BackColor = Color.Red;
            // EnterShort();
            AtmStrategyCreate(Action.Sell, OrderType.Market, 0, 0, TimeInForce.Day, GetAtmStrategyUniqueId(),"AutoATM", GetAtmStrategyUniqueId());
            }
            TradesCumProfit = Performance.AllTrades.TradesPerformance.Currency.C umProfit + Position.GetProfitLoss(Close[0], PerformanceUnit.Currency);
            Print(Time[0] + " " + TradesCumProfit);

            Comment


              #7
              Yup the TradesPerformance is not designed to work with ATMs. You will want to use these instead: http://www.ninjatrader-support.com/H...izedProfitLoss
              Josh P.NinjaTrader Customer Service

              Comment


                #8
                Right...that is what I have been using.

                Thought maybe the other one might work better.

                Thanks anyway.

                Comment


                  #9
                  I use a strategy what creates ATM strategies, which are only valid for one trade.

                  Follow up trades show up under the Strategie Tab as separate ATM strategies.

                  In my case how can I read CumProf or Account Cash Value via Script?

                  I understand TradesPerformance does not work ?
                  Last edited by makra081; 03-01-2009, 03:44 PM.

                  Comment


                    #10
                    You have to be tracking it manually for each of your ATM strategies and aggregate a total.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      TY for your reply

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      558 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      324 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      101 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      545 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      547 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X