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

CumProfit on NT6.5 and NT7

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

    CumProfit on NT6.5 and NT7

    Hello.
    The following code working in NT6,5 but does not work in NT7:

    Code:
    protected override void OnBarUpdate()
            {
    			if (BarsInProgress == 1)
    		    {			
    			if (Bars.FirstBarOfSession)				
    			    {
    				// Store the strategy's prior cumulated realized profit and number of trades
    				priorTradesCumProfit = Performance.AllTrades.TradesPerformance.Currency.CumProfit;
    			    }				
    		    }		
            }
    		/// <summary>
            /// Called on each incoming execution
            /// </summary>
            protected override void OnExecution(IExecution execution)
            {
              if (BarsInProgress == 1)
    		{
    			if (Performance.AllTrades.TradesPerformance.Currency.CumProfit > priorTradesCumProfit )
    			   {blokadaPierwszegoWybicia = true;}
    							   
    			if (Performance.AllTrades.TradesPerformance.Currency.CumProfit <= priorTradesCumProfit)
    			   {blokadaPierwszegoWybicia = false;}			   
    		 }
    		}
    In NT6.5 flag change state:
    8/11/2010 8:11:00 AMprofit =11742.5
    8/11/2010 8:11:00 AMblokadaPierwszegoWybicia =False
    8/11/2010 8:11:00 AMpriorTradesCumProfit =11742.5
    8/11/2010 8:12:00 AMprofit =15242.5
    8/11/2010 8:12:00 AMblokadaPierwszegoWybicia =True
    8/11/2010 8:12:00 AMpriorTradesCumProfit =11742.5

    In NT7 flag do not change state:
    8/11/2010 8:11:00 AMprofit =11237.5
    8/11/2010 8:11:00 AMblokadaPierwszegoWybicia =False
    8/11/2010 8:11:00 AMpriorTradesCumProfit =11237.5
    8/11/2010 8:12:00 AMprofit =19382.5
    8/11/2010 8:12:00 AMblokadaPierwszegoWybicia =False
    8/11/2010 8:12:00 AMpriorTradesCumProfit =11237.5

    How to fix this problem.
    Rgds
    Czarek.

    #2
    Hi Czarek, please add prints to see if your custom logic is called at all to change the flag, is there an execution to trigger it?
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Bertrand.
      Here is output from:
      Ninja 6.5 where flag blokadaPierwszegoWybicia change state for True:
      Code:
      8/11/2010 8:11:00 AMprofit =11742.5
      8/11/2010 8:11:00 AMblokadaPierwszegoWybicia =False
      8/11/2010 8:11:00 AMpriorTradesCumProfit =11742.5
      8/11/2010 8:11:00 AM Entered internal PlaceOrder() method at 8/11/2010 8:11:00 AM: Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='2ExitLong1' FromEntrySignal=''
      8/11/2010 8:12:00 AMprofit =14657.5
      8/11/2010 8:12:00 AMblokadaPierwszegoWybicia =True
      8/11/2010 8:12:00 AMpriorTradesCumProfit =11742.5
      Here is output from
      Ninja 7 where blokadaPierwszegoWybicia do not change state and stay False:
      Code:
      8/11/2010 8:11:00 AMprofit =11237.5
      8/11/2010 8:11:00 AMblokadaPierwszegoWybicia =False
      8/11/2010 8:11:00 AMpriorTradesCumProfit =11237.5
      8/11/2010 8:11:00 AM Entered internal PlaceOrder() method at 8/11/2010 8:11:00 AM: BarsInProgress=1 Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='ExitLong1' FromEntrySignal=''
      8/11/2010 8:12:00 AMprofit =19382.5
      8/11/2010 8:12:00 AMblokadaPierwszegoWybicia =False
      8/11/2010 8:12:00 AMpriorTradesCumProfit =11237.5
      8/11/2010 8:12:00 AM Entered internal PlaceOrder() method at 8/11/2010 8:12:00 AM: BarsInProgress=1 Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='ExitLong1' FromEntrySignal=''
      8/11/2010 8:12:00 AM Ignored PlaceOrder() method: Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='ExitLong1' FromEntrySignal='' Reason='This was an exit order but no position exists to exit'
      8/11/2010 8:13:00 AMprofit =19382.5
      8/11/2010 8:13:00 AMblokadaPierwszegoWybicia =False
      8/11/2010 8:13:00 AMpriorTradesCumProfit =11237.5
      8/11/2010 8:13:00 AM Entered internal PlaceOrder() method at 8/11/2010 8:13:00 AM: BarsInProgress=1 Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='ExitLong1' FromEntrySignal=''
      8/11/2010 8:13:00 AM Ignored PlaceOrder() method: Action=Sell OrderType=Market Quantity=0 LimitPrice=0 StopPrice=0 SignalName='ExitLong1' FromEntrySignal='' Reason='This was an exit order but no position exists to exit'
      8/11/2010 8:14:00 AMprofit =19382.5
      Czarek.

      Comment


        #4
        Czarek, can you please attach or send to support at ninjatrader dot com the full code you run so I can run comparisons on my end here?

        Thanks
        BertrandNinjaTrader Customer Service

        Comment


          #5
          I've just send you email.
          Subject "For Bertrand Re: CumProfit on NT6.5 and NT7 from forum."

          Czarek.

          Comment


            #6
            Ok, thanks - will take a look Czarek.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by gentlebenthebear, Today, 01:30 AM
            2 responses
            13 views
            0 likes
            Last Post gentlebenthebear  
            Started by Kaledus, Today, 01:29 PM
            2 responses
            8 views
            0 likes
            Last Post Kaledus
            by Kaledus
             
            Started by frankthearm, Yesterday, 09:08 AM
            13 responses
            46 views
            0 likes
            Last Post frankthearm  
            Started by PaulMohn, Today, 12:36 PM
            2 responses
            16 views
            0 likes
            Last Post PaulMohn  
            Started by Conceptzx, 10-11-2022, 06:38 AM
            2 responses
            56 views
            0 likes
            Last Post PhillT
            by PhillT
             
            Working...
            X