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
        http://www.ninjatrader.com/support/h...collection.htm
        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
            http://ninjatrader.com/support/forum...ead.php?t=4084
            JoydeepNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by MonteK, Yesterday, 09:31 PM
            0 responses
            23 views
            0 likes
            Last Post MonteK
            by MonteK
             
            Started by nkhoi, Yesterday, 09:27 PM
            1 response
            11 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by SuperDude123, Yesterday, 03:52 PM
            4 responses
            26 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by ErikY, Yesterday, 01:16 PM
            1 response
            25 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Started by BullyWig Trader, Yesterday, 12:42 PM
            1 response
            16 views
            0 likes
            Last Post NinjaTrader_ChelseaB  
            Working...
            X