Coder Social home page Coder Social logo

Comments (3)

kitmir avatar kitmir commented on May 23, 2024

I do not think this line is look ahead bias.
Generally speaking, the closing price of a candle is the opening price of the next candle.
But if you want to be sure you can change to:
current_price = self.df.loc[self.current_step-1, 'Close']
You will get the same result.

from rl-bitcoin-trading-bot.

MarshallPeng avatar MarshallPeng commented on May 23, 2024

No, this is most definitely look ahead bias.

At each time step the agent is able to see the closing price, while still being able to buy/sell at the open price. In a real trading scenario, this would never be possible. To make the environment more realistic, you would have to set the current_price = self.df.loc[self.current_step, 'Close']. But, if you try this out, it significantly decreases the performance of the agent compared to what was reported in the tutorial.

Setting current_price = self.df.loc[self.current_step-1, 'Close'] as you suggested does nothing to fix the problem as you are still executing at the previous time step while having knowledge of the next time step.

from rl-bitcoin-trading-bot.

kitmir avatar kitmir commented on May 23, 2024

I am not sure if I would agree with you but I see what you mean and I will give it another look.
But I advice also for you to look into what is being sent to action function. State doesn't include current step. that's the reason why I say it is not lookahead bias.

from rl-bitcoin-trading-bot.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.