• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Martingale Bet Sizing

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

    #16
    Martingale in Ninjtrader 8

    I see there is some Martingale code samples and snipits for ninjatrader 7 but I cant find anything for Ninjtrader 8, Anyone have a code sample of doubling down a limited number of times which I know isn't a pure Martingale. Anything to get me started in the right direction would be appreciated.

    Thanks Quantismo

    Comment


      #17
      Hello quantismo,

      Thank you for the question.

      The NT7 syntax and concepts should mostly translate into valid NT8 syntax with the exceptions of some naming. You can find the code-breaking changes guide here, this is helpful if you will be converting the NT7 code to NT8:

      It looks like the previous samples in this thread are all fairly simple, aside from the structure of the file and some naming it should also work in nt8 with some modification.

      The only items I can see from the sample in this post would be Performance is now SystemPerformance: https://ninjatrader.com/support/help...ub=Performance

      And the file structure has changed some in NT8. To get the right file structure, you could generate a new strategy in NT8 and then copy and paste the OnBarUpdate code into the new empty OnBarUpdate of the new file. Additionally, the private variables would need to be copied.

      I look forward to being of further assistance.
      JesseNinjaTrader Customer Service

      Comment


        #18
        Is there a way to reset the losing trade count to zero ? to make a loop for example: if you have two loosing trades the counter would enter a long postion and also reset to zero after two loosing trades

        if (SystemPerformance.AllTrades.LosingTrades.Count == 2)
        Thanks Quantismo

        Comment


          #19
          Hello,

          Thank you for the reply.

          There is not a way to reset the value, but you could store a variable and reset that based on the current value of the property.

          We have a sample that does something similar to check PnL across multiple sessions. you could use a similar approach to set variables to the performance values. A second set of variables could be used to get the current count minus the stored amount. The difference would be that instead of using the first bar of the session, you would reset the variables at your timing.

          https://ninjatrader.com/support/help...nce_statis.htm

          I look forward to being of further assistance.
          JesseNinjaTrader Customer Service

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by diver, Today, 02:07 PM
          0 responses
          0 views
          0 likes
          Last Post diver
          by diver
           
          Started by remorim, Today, 12:52 PM
          1 response
          1 view
          0 likes
          Last Post remorim
          by remorim
           
          Started by PN720, Today, 12:28 PM
          0 responses
          0 views
          0 likes
          Last Post PN720
          by PN720
           
          Started by TraderYoda, Today, 11:40 AM
          0 responses
          3 views
          0 likes
          Last Post TraderYoda  
          Started by aslane, Today, 10:54 AM
          0 responses
          7 views
          0 likes
          Last Post aslane
          by aslane
           
          Working...
          X