backtest | A simple & fast bitcoin trading strategy | Cryptocurrency library

 by   jarthod C++ Version: Current License: MIT

kandi X-RAY | backtest Summary

kandi X-RAY | backtest Summary

backtest is a C++ library typically used in Blockchain, Cryptocurrency, Bitcoin applications. backtest has no bugs, it has no vulnerabilities, it has a Permissive License and it has low support. You can download it from GitHub.

A simple & fast bitcoin trading strategy backtesting tool.
Support
    Quality
      Security
        License
          Reuse

            kandi-support Support

              backtest has a low active ecosystem.
              It has 11 star(s) with 13 fork(s). There are 3 watchers for this library.
              OutlinedDot
              It had no major release in the last 6 months.
              backtest has no issues reported. There are no pull requests.
              It has a neutral sentiment in the developer community.
              The latest version of backtest is current.

            kandi-Quality Quality

              backtest has no bugs reported.

            kandi-Security Security

              backtest has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.

            kandi-License License

              backtest is licensed under the MIT License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              backtest releases are not available. You will need to build from source code and install.
              Installation instructions are not available. Examples and code snippets are available.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of backtest
            Get all kandi verified functions for this library.

            backtest Key Features

            No Key Features are available at this moment for backtest.

            backtest Examples and Code Snippets

            No Code Snippets are available at this moment for backtest.

            Community Discussions

            QUESTION

            Pine script Why can't I use barssince as the strategy condition?
            Asked 2021-Jun-08 at 18:13

            My strategy looks like this:

            ...

            ANSWER

            Answered 2021-Jun-08 at 18:13

            Every time your buy_signal variable became true, barssince() would return zero, so now we use the bar count from the previous bar.

            We added something for your longStop variable because it was missing. Keep in mind this is the stop-buy level, as well as debugging plots at the end:

            Source https://stackoverflow.com/questions/67807027

            QUESTION

            Trying to replace a manual counter with barssince
            Asked 2021-Jun-03 at 17:31

            I have two questions:

            1. I wanna replace redCandlesCounter with barssince, because it looks better. The thing is when I do that: if (barssince(not isCandleGreen and close > middleBand and open < upperBand) > 2 and isLong) kinda breaks the logic by selling on the next candle, which is not what I want. By the way, the tests were done on GTO/USDT (Binance) 30m interval, pictures are at 30 Mar '21 18:30.
            Not expected:

            Expected:

            1. A sexier way to replace isCandleGreen = close > open?
            Code ...

            ANSWER

            Answered 2021-Apr-15 at 14:15

            I guess, you can try to use barssince like this:

            Source https://stackoverflow.com/questions/67107448

            QUESTION

            Replacing valuewhen in order to follow code optimization guide by PineCoders
            Asked 2021-May-31 at 16:38

            I'm reading PineCoders' FAQ and more precisely how to optimize the code. I want to replace valuewhen in the following scenario. I assume they mentioned it because of the warning about repainting when creating alerts?

            Use techniques like this one whenever you can, to avoid using valuewhen().

            How should I avoid valuewhen in the following case?

            ...

            ANSWER

            Answered 2021-May-31 at 16:38

            QUESTION

            Managing longs and short orders like LucF PineCoders Backtesting-Trading Engine
            Asked 2021-May-31 at 16:13

            I'm trying to accomplish trade direction (Long/Short/Both) in study mode, just like LucF and PineCoders did here.

            Issues:
            • When I select "Longs Only", I expect it to show only long trades, but it doesn't due to the missing the part which finds the range of the candles in the long trade. If you check the link I gave above (Backtesting & Trading Engine [PineCoders]), LucF uses InLong, InShort, InTrade variables. The problem is that his code is older and too overengineered for me and I don't get the idea on how to recreate it.

            I said overengineered, because his code includes pyramiding, slippage and other stuff that are now built-in TradingView, probably because back in 2019, PineScript didn't have such features.

            The actual idea behind that indicator is to plot alerts and another script which backtests it using that indicator as a source.

            • The bar coloring part is not working and it is currently commented, so the code can compile. The problem is the same as above's description. I need to know whether I'm in a long trade direction or short or not in a trade at all. I don't know how to accomplish that part.
            ...

            ANSWER

            Answered 2021-May-31 at 16:13

            This will get you started. We:

            • Follow the states of shorts/longs, which makes it possible to plot stop and entry levels only when we are in a trade.
            • Made the doLongs/doShorts inputs part of the entry conditions.
            • Added the breach of stops to the exit conditions.

            Note that this logic does not replicate that of the Engine, as here you are entering on closes, whereas the Engine is entering on the next bar following the detection of the entry/exit conditions, which is more realistic. You can also adapt your code to proceed that way:

            Source https://stackoverflow.com/questions/67738873

            QUESTION

            docker-compose up is stuck on attaching to
            Asked 2021-May-28 at 13:48

            I have written several python scripts that will backtest trading strategies. I am attempting to deploy these through docker compose.

            The feeder container copies test files to a working directory where the backtester containers will pick them up and process them. The processed test files are then sent to a "completed work" folder. Some CSV files that the backtester outputs are then written to an NFS share on another computer. I should mention that this is all running on Ubuntu 20.04.

            As far as I can tell everything should be working, but for some reason the "docker-compose up" command hangs up on "Attaching to". There should be further output with print statements (I've unbuffered the Dockerfiles so those should show up). I've also left it running for a while to see if anything was getting processed and it looks like the containers never started up. I've looked at all the other threads dealing with this and have not found a solution that has worked to resolve this.

            Any insight is very very appreciated. Thanks.

            Here is the docker-compose file:

            ...

            ANSWER

            Answered 2021-May-28 at 13:48

            It's been three weeks with no responses, but I just wanted to update with what I've found. In all cases where I've left "docker-compose up" running it eventually started.

            At times it took 30 minutes, but it started every time.

            Source https://stackoverflow.com/questions/67395047

            QUESTION

            ValueError: Length of values (1) does not match length of index index (12797) - Indexes are the same length
            Asked 2021-May-14 at 14:54

            So this is driving me crazy now, cause I really don't see the problem.

            I have the following code:

            ...

            ANSWER

            Answered 2021-May-14 at 14:54

            QUESTION

            Pinescript strategy is not printing correctly on charts (possible timestamp problem)
            Asked 2021-May-11 at 14:46

            I was trying to backtest a Strategy that relies on Depth of Market (DOM) data.

            Unfortunatley that data can't be accessed in Pinescript, nor can I access by calling an API (please correct me if wrong!)...

            So instead I am trying to hardcode the values into my script as per this FAQ: https://www.pinecoders.com/faq_and_code/#how-can-i-initialize-a-series-on-specific-dates-using-external-data

            I'm playing around with a modified version of the code taken from the above link, but I can't get it to display correctly.

            What I expect to happen: I thought it would print 5 single dots at 1am, 2am, 3am, 4am, and 5am on the 5th of May. Each dot would be 1 step higher than the next.

            What happens instead: It prints 24 dots, one for each hour of the 5th of May. All the dots are in the same level, there is no stepping.

            Here is the code I am using:

            ...

            ANSWER

            Answered 2021-May-11 at 14:46

            Your timestamp has no hour variable, so it's always fixed at May 1st, 00:00h.
            That only matches your first line, so the output will always be 1.

            This will work:

            Source https://stackoverflow.com/questions/67481575

            QUESTION

            Pinescript Strategy exit and order Quantity calculations
            Asked 2021-May-10 at 18:19

            Is there any reading you recommend about the following issue? I still did not find an answer to it

            strategy.exit (or also strategy.order) parameter "qty". I am passing qty as 25% of the initial position size.

            Example: position size is 11, then exit qty is 2.75. After 4 times (4 orders triggered) it should be completely out (meaning exited the full position). Strategy backtest is taking only -2 out each time. Leaving positionsize higher than 0 after 4 times.

            ...

            ANSWER

            Answered 2021-May-10 at 18:19

            There is a minimum position size associated with each market. The value isn't visible to scripts or through the charts UI, but the broker emulator uses it in strategies. Your market may not allow fractional position sizes.

            Source https://stackoverflow.com/questions/67463795

            QUESTION

            How to backtest Strategy in pine script more than a year?
            Asked 2021-May-05 at 09:56

            How to backtest Strategy in pine script more than a year?

            I have strategy for nifty in 5 mins chart. when I am running it, it shows result only for last 100 days.. previous data not visible in the chart.

            but, if I keep chart time frame more than 5 mins data (candles) come more than that, more time frame more dates back shows.. but my strategy works in 5 mins. I would like to test it for last two / five years.. How to do it?

            ...

            ANSWER

            Answered 2021-May-05 at 09:56

            The depth of history is measured in bars—not time. The quantity of bars on charts varies with your type of account. See this PineCoders FAQ entry for more information.

            Disclosure: the link in this answer points to a PineCoders FAQ entry.
            I am a member of the PineCoders community and I most probably wrote that FAQ entry. PineCoders is a TradingView-supported group of volunteer Pine coders and PineCoders' website is strictly educational. Neither TradingView nor PineCoders benefits financially from sending traffic to pinecoders.com, and the site contains no affiliate/referral links.

            Source https://stackoverflow.com/questions/67393929

            QUESTION

            How to backtest portfolio compositions using backtrader?
            Asked 2021-Apr-22 at 16:03

            I have a csv file / pandas dataframe which looks like this. It contains various portfolio compositions for a portfolio which is re-balanced everyday according to my own calculations.

            ...

            ANSWER

            Answered 2021-Apr-22 at 15:55

            The first thing you will want to do it load your targets with your datas. I like personally to attach the target to the dataline as I add it to backtrader.

            Source https://stackoverflow.com/questions/66863381

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network

            Vulnerabilities

            No vulnerabilities reported

            Install backtest

            You can download it from GitHub.

            Support

            For any new features, suggestions and bugs create an issue on GitHub. If you have any questions check and ask questions on community page Stack Overflow .
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
            CLONE
          • HTTPS

            https://github.com/jarthod/backtest.git

          • CLI

            gh repo clone jarthod/backtest

          • sshUrl

            git@github.com:jarthod/backtest.git

          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link