Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Change order size when sharp ratio is above 1.5

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

    Change order size when sharp ratio is above 1.5

    how can i tell ninjatrader to trade 2 contracts when the sharp ratio for the strategy is above 0.5 and trade only 1 contract when its bellow 0.5
    Last edited by wallsteetking; 04-03-2014, 08:58 PM.

    #2
    wallstreetking, you could access the SharpeRatio in NinjaScript and therefore adjust the qty used in your Enter() calls accordingly - http://www.ninjatrader.com/support/h...harperatio.htm

    The call above is using a zero risk free return, if you wish to supply a custom one, use this call -

    Comment


      #3
      This is what I have so far. The issue I have is, I have no idea how to tell ninjatrader to go long 2 CONTRACTS when sharp ratio is above .4 and trade only 1 contract when its bellow 0.4.Can you please guide/help me on the right direction. Furthemore, this has multiple strategies running at the same time, thats why I have Strat1.....etc on here.

      Important: when i run the strategy with 1000 days back i get 500 trades but when i run the strategy with 6000 days back i get only 80 trades executed????? What going on?
      Code:
      if ((Strat1 + Strat2 + Strat3 + Strat4 + Strat5>= myInt) Bars.BarsSinceSession <=150 && Bars.BarsSinceSession >=1 && [COLOR="Blue"][B]P[B]erformance.AllTrades.Count >= 1 && Performance.AllTrades.TradesPerformance.SharpeRatio >= 0.4[/B] )
      
      {	
      EnterLong(DefaultQuantity, "");
      }[/B][/COLOR]

      Comment


        #4
        Correct, right now you just use the DefaultQuantity as your quantity in the EnterLong call, you would need to make that conditional based on the outcome you get from the SharpeRatio call. Either use your own qty variable that changes depending on the sharpe or multiply your DefaultQuantity then by 2 for situations where it's > 0.4.

        As for the different trade groupings you see in backtesting, would not know - I would suggest to isolate out and run for example a single strategy only and checking out when the issue would be thrown exactly so you can fix.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        115 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        161 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        83 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        127 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        87 views
        0 likes
        Last Post PaulMohn  
        Working...
        X