Backtrader Community

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    1. Home
    2. rajanprabu
    For code/output blocks: Use ``` (aka backtick or grave accent) in a single line before and after the block. See: http://commonmark.org/help/
    R
    • Profile
    • Following 3
    • Followers 3
    • Topics 3
    • Posts 110
    • Best 41
    • Controversial 0
    • Groups 0

    rajanprabu

    @rajanprabu

    @Munich - DE

    63
    Reputation
    82
    Profile views
    110
    Posts
    3
    Followers
    3
    Following
    Joined Last Online
    Location Munich

    rajanprabu Unfollow Follow

    Best posts made by rajanprabu

    • RE: Multi-Timeframe works for compression=15 but fails for 16

      only a guess.. you may need to add a warm up period to your indicator

      class Dummy(Indicator):
          lines = ('l',)
          params = (('period', 16),)
      
          def __init__(self):
              self.addminperiod(self.params.period)
      
          def next(self):
              # Datetime of the latest completed bars in both Time-Frames
              print(self.data0.datetime.datetime(0), end=": ")
              print(self.data1.datetime.datetime(0))
              
      
      posted in General Code/Help
      R
      rajanprabu
    • RE: Uncoverted data remains error.

      @deltahedge

      its hard to answer without seeing the csv file. Possibly you may have timezone information along with time. If this doesn't work, please post few lines of csv.

      posted in General Code/Help
      R
      rajanprabu
    • RE: Facing issue with LineBuffer

      @xxx

      Have a look at the Platform Concepts. Init has a different purpose. One can print lines in using next() section.

      posted in General Discussion
      R
      rajanprabu
    • RE: Indicator on Indicator (EMA smoothing on RSI)

      hi @Jeffrey-C-F-Wong

      When you pass close to RSI indicator.. its self.data.close not self.close

      class RSI(bt.Strategy):
      
          params = (('period', 14),)
      
          def __init__(self):
              self.rsi = bt.indicators.RSI_Safe(self.data0.close, period=14)
              self.smooth_rsi = bt.indicators.ExpSmoothing(self.rsi, period=8)
      
      posted in Indicators/Strategies/Analyzers
      R
      rajanprabu
    • RE: Long Executed Price and Long Create Price is different

      BT is using adjusted close value to adjust other four values. Have a look at Data Feeds

      posted in General Code/Help
      R
      rajanprabu
    • RE: execution price for market order

      @pythonnoob

      You are reading from Yahoo finance which has a field Adj. Price this is used to adjust the open, high , low, close prices. Thats why you are seeing different price.

      posted in General Discussion
      R
      rajanprabu
    • RE: time data 'x' does not match format '%Y-%m-%d %H:%M:%S'

      Please check what are you printing. I did a quick test and it has time as well..

      posted in Indicators/Strategies/Analyzers
      R
      rajanprabu
    • RE: notify_order shows wrong calculations

      what about position size ??

      12.76 x (7079.00 - 7468.99 ) - 71.50 - 67.77

      posted in General Code/Help
      R
      rajanprabu
    • RE: Data Delay after launching live trading using backtrader

      @zuj

      Have a look here

      One can either request from broker or use the local date to backfill the required data.

      posted in General Discussion
      R
      rajanprabu
    • RE: Multi Asset position management

      @Ron-Aw said in Multi Asset position management:

      I'm under the impression that if I want to go long on an asset with a market order, I should be using self.buy(price = self.datas[i].close[0], size = (My Size Here)). Is this the right way to open a buy order for a particular asset?

      In Orders Doc there is a data parameter while sending the orders. So you can use that to send data specific orders.

      @Ron-Aw said in Multi Asset position management:

      Assume that I have 4 data feeds, if I want position details on the first asset, should I be using self.getposition(data = self.datas[0])?

      Yes I think so. Position

      @Ron-Aw said in Multi Asset position management:

      The object returned by self.getposition(data = self.datas[i]) has 2 attributes namely size and price. If there are no open positions on the asset, self.getposition(data = self.datas[0]) should therefore evaluate to False right?

      yes.. I normally use position.size it see long, short or no positions.

      @Ron-Aw said in Multi Asset position management:

      If I wish to close all positions, should I use a for loop to iterate over each data feeds and call self.close(self.datas[i]) on each iteration?

      this is what I do.. But I dont know if there is an elegant way.

      posted in General Code/Help
      R
      rajanprabu

    Latest posts made by rajanprabu

    • RE: Trade Basedon On Time Of Day

      @frenzyy

      please post what you have tried so far. Its much easier that way.

      At every next() check the new high and store it in a variable and a simple date time if condition before buy would do

      posted in General Code/Help
      R
      rajanprabu
    • RE: Multi store notifications.. how to mange ?

      @vladisld @run-out

      Any pointers on this ?

      posted in General Code/Help
      R
      rajanprabu
    • Multi store notifications.. how to mange ?

      Hi all,

      I wrote two stores for two different brokers, but I want to use data feed from one and broker from another. It works fine, but notify_store works only from the store that I subscribe the data. Store Notifications are not coming from the store that I add as a broker instance. My guess is that data store gets registered first as its the first thing that gets initialised.

      My question is it possible to get store notifications from both stores ? Following is the code that I use for both data and broker. Any help is highly appreciated.

      cerebro = bt.Cerebro(quicknotify=True)
          
      abstore = AngelStore(api_key= data['api_key'], access_token = data['Token'], angel_instruments_json=dir +'instruments.json')
      zbstore = ZerodhaStore(api_key = user_data['api_key'], token = user_data['token'],  zb_instruments_csv=dir + 'zb_inst.csv')
          
      cerebro.broker = abstore.getbroker()
      
      data0 = zbstore.getdata(dataname='STK-NSE-IDEA',
              timeframe=bt.TimeFrame.Ticks,  
              sessionstart=datetime.time(9, 15), 
              sessionend=datetime.time(15, 30)
          )
      
      posted in General Code/Help
      R
      rajanprabu
    • RE: Is this forum still active?

      @backtrader

      Thanks a lot Daniel. Very much appreciate it.

      posted in General Discussion
      R
      rajanprabu
    • RE: Is this forum still active?

      @python-trader

      Administrator is not active in the forum. we have to live with what it is..

      posted in General Discussion
      R
      rajanprabu
    • RE: Indicator on monthly data, trading on daily data

      @andi

      simply use datas[1] for monthly sma.

      sma_monthly = bt.SimpleMovingAverage(self.datas[1].close) 
      
      posted in Indicators/Strategies/Analyzers
      R
      rajanprabu
    • RE: Indicator on monthly data, trading on daily data

      @andi

      Cant you simply load daily candles and resample to monthly Timeframe.. trade can be done in daily timeframe while signal comes from monthly timeframe.

      posted in Indicators/Strategies/Analyzers
      R
      rajanprabu
    • RE: Multiple data feeds with duplicate output

      @vypy1

      By default BT assumes that you have timeframe Day. If its not daily timeframe give timeframe. That may fix your issue.. just a guess with what you posted.

      posted in General Code/Help
      R
      rajanprabu
    • RE: Question on resampledata with 1min data to 60 mins

      @bigchappa

      Backtrader works only when resampling interval is divided by session duration. meaning if session duration is 8 hours, one can resample them to 8 1h candles. I think your last 1 h candle will have only 30 minutes. So BT may not resample the way you expect.

      posted in General Code/Help
      R
      rajanprabu
    • RE: Many Strategies as individual Modules

      @vladisld

      Please ignore my last question. Of course notify_trade should be owned by owner as well as in the case of notify_order. I made a simple test case and it worked perfectly fine. Something must be wrong in my production script. I will have a look. Thanks for your time and effort.

      posted in General Code/Help
      R
      rajanprabu