Navigation

    Quantiacs Community

    • Register
    • Login
    • Search
    • Categories
    • News
    • Recent
    • Tags
    • Popular
    • Users
    • Groups

    Why Sharp ratios is not inverted ?

    Strategy help
    2
    4
    333
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • C
      cyan.gloom last edited by

      Hi,
      I'm so confused with this subtitle.

      def simple_strategy(data):
          close = data.sel(field='close')
          open = data.sel(field='open')
          is_liquid = data.sel(field='is_liquid')
          rtrn = close / open 
          rtrn_d = rtrn.quantile(0.05, dim='asset')
          rtrn_u = rtrn.quantile(0.95, dim='asset')
          strategy_1 = xr.where(rtrn > rtrn_u,1,0) 
          strategy_2 = xr.where(rtrn < rtrn_d,-1,0)
          weights = strategy_1 + strategy_2
          weights = weights * is_liquid
          weights = weights / abs(weights).sum('asset')
          return weights
      
      weights = simple_strategy(data)
      
      qnout.write(weights)
      weights = qnout.clean(weights, data, "stocks_nasdaq100")
      qnout.check(weights, data, "stocks_nasdaq100")
      

      If I changed the position like 1 to -1, -1 to 1, Sharp ratios does not invert.

      Why?

      Best regards,

      support 1 Reply Last reply Reply Quote 0
      • support
        support @cyan.gloom last edited by

        This post is deleted!
        1 Reply Last reply Reply Quote 0
        • support
          support last edited by

          @cyan-gloom The backtester automatically subtracts slippage to each trade, so when you swap long and short positions you should not expect to get the same result multiplied by -1; slippage is subtracted to profits and losses. This means that profits will be converted to losses, but losses could still be losses because of slippage (if they were small losses for example).

          C 1 Reply Last reply Reply Quote 0
          • C
            cyan.gloom @support last edited by

            @support
            Thanks a lot !

            1 Reply Last reply Reply Quote 0
            • First post
              Last post
            Powered by NodeBB | Contributors
            • Documentation
            • About
            • Career
            • My account
            • Privacy policy
            • Terms and Conditions
            • Cookies policy
            Home
            Copyright © 2014 - 2021 Quantiacs LLC.
            Powered by NodeBB | Contributors