For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/

Based my code on Quickstart: would like to self.log the minutes



  • Hello there,
    My data are minute based. What I changed in the code in order to do so is the following:
    timeframe=bt.TimeFrame.Minutes
    dtformat=('%Y-%m-%d %H:%M:%S')

    What I would like now is, when I run the script, it print the date, hour, minute at each stage. I should change something in the log function (
    dt = dt or self.datas[0].datetime.date(0)
    print('%s, %s' % (dt.isoformat(), txt)))

    But I am not sure what, any help? Thanks!



  • This works for me

    def log(self, txt, dt=None, doprint=False):
        ''' Logging function fot this strategy'''
        if self.params.printlog or doprint:
    
            dt = dt or self.datas[0].datetime.datetime(0)
            print('%s, %s' % (dt.isoformat(), txt))

Log in to reply
 

});