Navigation

    Backtrader Community

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

    Alligator Strategy

    Indicators/Strategies/Analyzers
    2
    2
    561
    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
      camizulub last edited by camizulub

      Hello, I am trying to achive an strategy based on the alligator indicator. I'm constructing the indicator in the init function:

      params = dict(lrperiod=89,jaw_wind=13,teeth_wind=8,lips_wind=5,)
      
      def __init__(self):
              hi_lo_avg = (self.data1.high + self.data1.low) / 2.0
              jaw = btind.SmoothedMovingAverage(hi_lo_avg, period=self.params.jaw_wind, plotname='Jaw')(8)
              teeth = btind.SmoothedMovingAverage(hi_lo_avg, period=self.params.teeth_wind, plotname='Lips')(5)
              lips = btind.SmoothedMovingAverage(hi_lo_avg, period=self.params.lips_wind, plotname='Teeth')(3)
      

      But when I'm running the strategy using multiple Data (2 Time Frames) is not doing any trade and is not ploting the indicator. I look further and looks like is not getting the correct data feed for the indicator.

      I see in multi_example that they iterates the indicator over the datas[i] but my first data is seconds (I don't want tha calculate anything there) just in the second data feed (hourly data).

      1 Reply Last reply Reply Quote 0
      • B
        backtrader administrators last edited by

        I would argue your problem is in how you call the indicator. But it is a long shot, given that part isn't shown.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        • First post
          Last post
        Copyright © 2016, 2017, 2018, 2019, 2020, 2021 NodeBB Forums | Contributors