Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Lock in Profit for Trading Day

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

    Lock in Profit for Trading Day

    Hi,

    I currently have a few stratergies and I want to do the following:

    Each day the strategy will trade as required per trade and when there is a total cumulative profit of 10 ticks for the day it will lock this in by only placing valid trades with the extra ticks.

    For example:

    Trade 1: +6 ticks
    Trade 2 : +15 ticks

    Total = 21 ticks.

    The stratergy will now have 11 ticks to play with until it disables and locks this last 10 ticks for the day.

    I do not think this has been done before, I cannot find a way to backtest this.

    Thanks

    #2
    Hello twitch,
    Thanks for your post.

    Unfortunately there are no native way to do it. You have to custom code your own NinjaScript strategy to do it.
    JoydeepNinjaTrader Customer Service

    Comment


      #3
      Hi Joydeep,

      That is a shame. How would I be able to track the profit/loss that was made in each trade?

      Is there a way that I can call on the entry and the exit to get the difference?

      Thanks

      Comment


        #4
        Hello twitch,
        Thanks for the clarification.

        You can use the TradeCollection class to do it. Please refer to our help guide to know more
        JoydeepNinjaTrader Customer Service

        Comment


          #5
          It seems you cannot record the profit/loss in ticks per trade from backtesting? Only in real time record the currency value?

          I have tried to set a profit counter and once it gets over the currency value of 10 ticks to stop trading until the next day. This is done by resetting the profit counter to 0 when the time hits 2am for the next day.

          However it is not working at present.

          profitCount = The Performance.AllTrades.TradesPerformance.GrossProfi t + Performance.AllTrades.TradesPerformance.GrossLoss seems to not work as it does not want to reset to 0.

          Comment


            #6
            Hello twitch,
            The trade collection will return value for individual trades in backtesting too.

            A sample code will be like:
            Code:
            foreach (Trade trade in this.Performance.AllTrades)
            {
            	Print(trade.Entry.Price - trade.Exit.Price);
            }

            You may also refer to this sample code
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by proptrade13, Today, 11:06 AM
            0 responses
            1 view
            0 likes
            Last Post proptrade13  
            Started by kulwinder73, Today, 10:31 AM
            1 response
            10 views
            0 likes
            Last Post NinjaTrader_Erick  
            Started by RookieTrader, Today, 09:37 AM
            3 responses
            15 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by terofs, Yesterday, 04:18 PM
            1 response
            24 views
            0 likes
            Last Post terofs
            by terofs
             
            Started by CommonWhale, Today, 09:55 AM
            1 response
            6 views
            0 likes
            Last Post NinjaTrader_Erick  
            Working...
            X