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 Balage0922, Today, 07:38 AM
            0 responses
            3 views
            0 likes
            Last Post Balage0922  
            Started by JoMoon2024, Today, 06:56 AM
            0 responses
            6 views
            0 likes
            Last Post JoMoon2024  
            Started by Haiasi, 04-25-2024, 06:53 PM
            2 responses
            19 views
            0 likes
            Last Post Massinisa  
            Started by Creamers, Today, 05:32 AM
            0 responses
            6 views
            0 likes
            Last Post Creamers  
            Started by Segwin, 05-07-2018, 02:15 PM
            12 responses
            1,786 views
            0 likes
            Last Post Leafcutter  
            Working...
            X