Screenshot of script python code

35% ROI in 15 Days – New ADX Driven 3Commas Bot Trigger Script

I recently completed testing this new automated script to trigger 3Commas bots and actual trading returned 35% in just 15 days! Even with a couple days turned off, the returns were better than I expected. Rather than wait any longer, I’m sharing the script now! Here’s the details….

Script Performance

The script ran for a span of fifteen days over the holidays (was off for about two days), and managed to peak at $60 on a $165 account during that time, so just over a 36% return in that period. There’s definitely some drawdowns happening, especially with higher volatility, but overall the net positive return seems to be very promising.

Script performance thirty five percent in fifteen days

How the Script Works

Similar to the first script I wrote, this one relies on 3Commas DCA trading bots and FTX.com, however instead of looking for breakouts, it looks for trends using the Directional Movement Indicator (DMI) and the Average Directional Index (ADX), and instead of starting deals, it starts bots. The bot remains active until conditions are no longer met.

The script scans all perpetual futures on FTX.com (except for black-listed ones) and will trigger the corresponding bot to start when the DMI lines cross – but only if the ADX line has a positive slope, and it’s value is above 15 (configurable). This goes for both longs and shorts.

The script will then rank all perps meeting the above conditions based on the absolute slope value of the EMA-20 line (configurable). The slope values are then smoothed using an EMA-3 calculation (also configurable). This is a very crude way to rank them, but seems to work well enough.

The stopping condition is configurable, and can be manual, when the ADX slope turns negative, when the ADX slopes tends to horizontal, or when the DMI lines again cross.

The base values in the script are the recommended values to start with, and I will cover the closing conditions in a bit more detail later on.

Requirements

For this script you’ll need an FTX.com account, the Pro plan on 3Commas.io, and a way to run python scripts. I like the Python IDLE for local development and testing, but run my bots using a Google VM Instance so they continue to run while I’m offline. You’ll also need to connect your 3Commas account to your FTX sub-account you plan to use.

Installing the Script

Installation is similar to the previous script, but we need a few more dependencies with this one. I created a separate guide describing exactly how to setup and install the scripts on a Google VM so it can run 24/7. That guide includes all the dependencies you’ll need for using this particular script, as well as some details on how to install the script, and how to use Tmux to get the script to run continuously.

Next you’ll install the script. Details can be found in the section How to Install and Setup Python Automated Trading Scripts, except you’ll want to use the code at this link to get the zip file for this script.

Setting Up The config.py File.

In the referenced guide in the previous section I covered how to do this, but make sure to rename the example.config.py file to just config.py, then open it to edit it and add your 3Commas and FTX details such as API and secret keys, sub-accounts, etc. Lines 1 to 4 are for 3Commas, and 6 to 8 are for FTX.

3commas and FTX API settings in config file

On the last script a lot of folks had issues finding the correct 3Commas Account ID. Unfortunately 3Commas doesn’t make this obvious or easy to find for the futures account (it’s different from the subaccount ID for spot). The easiest way to find it is described in this comment from the previous script. The next few lines configure the script:

Script settings in config file
  • PAIRS_BLACKLIST – Include any perps you don’t want to trade. The ones included already are there either because they don’t move much, not actually a perp, or there’s no matching pair in 3Commas, such as SHIB. Feel free to add any others as you wish.
  • MAX_OPEN_POSITIONS – This sets the maximum number of deals that can be open at the same time. It’s an upper limit though, and the script may calculate a lower number based on your bots’ usage of funds, and the funds available in your subaccount.
  • FUNDS_USAGE – You can limit how much of the funds in your subaccount will be used for trading. I tend to leave some headroom for drawdowns and as well for manual red bag recoveries. The value of 0.9 means the script will only use up to 90% of the funds in the subaccount.
  • TF – The time frame you want to trade – in minutes. 15 minutes, 60 minutes, 240 minutes, etc. The minimum needs to be greater than 1 minute, and the maximum needs to be less than 1 day. A good starting point is 15 minutes or 60 minutes. I wouldn’t recommend going over 4 hours (240 minutes).
  • ADX_LENGTH – The number of bars to use for calculating the ADX value. This is the same as the TradingView default.
  • EMA_LENGTH – Similar to the ADX_LENGTH, but the ema is used for helping rank pairs. Larger values will be more lagging, shorter values more false signals.
  • EMA_SMOOTHING – This smoothes the slope calculation of the EMA values for ranking the pairs.
  • DEAL_BOT_RATIO_WARNING – This defines a warning level of the number of open positions on the exchange to the number of enabled bots. In the shell window a message will be displayed letting you know you’ve reached this level and you may want to manually close some open positions or deals since many of those may now be red bags and you’re missing out on potential winning deals on other pairs. If the setting CLOSE_DEALS_WITH_BOT is True, then this warning should never be displayed since the pairs are closed when the bot is disabled.
  • CLOSE_DEALS_WITH_BOT – Bots are deactivated (so they won’t make more deals) when the ADX slope turns negative. When this is set to True, any open deals from that bot will also be closed at the current market price. If set to False, the bot is disabled, but any open deals for that bot remain open.
  • EARLY_CLOSE – This attempts to close deals when the last three consecutive ADX slopes are progressively lower than each other, indicating a slowing trend. The aim here is to reduce the drawdown even further by preempting the ADX slope going negative.
  • CLOSE_DEALS – When set to True, any open deals will be closed when the DM indicator lines cross in the opposite direction. When set to False, no deals will be closed when the indicator lines cross.

For the last three settings above, when CLOSE_DEALS_WITH_BOT is set to True, CLOSE_DEALS has no effect since the deals will be closed when the bot is deactivated. This also means deals can be closed too early, with two possible outcomes – 1) The deals are closed before a profit can be taken, or 2) The deals are closed before your bags become too red. So there’s a trade off here – let them run and hopefully close itself with your TP, or cut your loss early and move on.

When EARLY_CLOSE is true, the bots are deactivated even earlier, possibly giving the deal some time to close in profit before a potential trend reversal. When CLOSE_DEALS_WITH_BOT is also True, this further reduces the possibility of deeper drawdowns, but also possibly misses on more upside.

If the CLOSE_DEALS option is True while CLOSE_DEALS_WITH_BOT is False, in the scenario’s above you 1) Give your deal a chance to close in profit, if the price does pump back up, or 2) Take a deeper loss since when the DM indicator lines cross it will undoubtedly be further away from when the ADX turned negative. In back-testing, the ADX did produce some false signals and profits were higher in this scenario for some coins, and hence why this option was added.

If both options are False (CLOSE_DEALS and CLOSE_DEALS_WITH_BOT), the script will not close any deals on red bags, and you’ll have to close them manually. This is not a bad option if you’re not trading with leverage since you can still theoretically make a profit regardless of how far in the red the deal has gone – though it takes more patience and you could miss out on other gains in the meantime. It’s also a great way to conserve your capital. The biggest downside is you could miss out on market reversals and be really really red on all your bags if you’re not paying attention.

3Commas Bot Settings in config.py

The section of settings below the above settings are specifically for creating and updating your 3Commas bots.

3Commas bot settings in config file

I’ve cleaned this up a bit from the last script, but should be fairly self-explanatory. The first section is used for creating and updating bots, and the second is used on updates only. These settings all coincide with 3Commas bot settings as if you were setting up a bot manually in 3Commas, so they should be familiar.

Creating Your 3Commas Bots

Compared to the previous script, creating the 3Commas bots is very similar, with one difference – we don’t need to enable the bots after they’re created. Hence that option is now deactivated in the Py3c_update.py script as it’s not needed.

Assuming you’ve completed setting up the config.py file, in the terminal window run the bot creator script using:

python3 Py3c_create.py

As the script runs the shell window will show as each bot is created. Long bots will be created, followed by short bots. You can ignore the error{} texts that appear, this just means there was no error creating the bot. Let the script continue until the shell prompt is back again.

Updating Your 3Commas Bots

This is very similar to the above operation if you need to make changes to your bots. First make your changes to the bot settings in the config.py file, then run:

python3 Py3c_update.py

Choose the first option (all the rest are inactive). The shell will display the progress and run through each bot, very similar to how the create bot script does, and updates each bot.

Start The Automated Trading Script

Assuming all your bots are setup without any issues and all dependencies are installed, you should be able to now start your script. If you’re testing locally on the Python IDLE interface, open the adx_bot.py script and hit the F5 key to start the bot. If you’re running from a shell window, make sure you’re in the same folder as the script and type:

python3 adx_bot.py.

Experiment With Different Script and 3Commas Bot Settings

While the config.py file has some default settings (most used in my initial testing), keep in mind I didn’t do extensive testing. The settings used may not work in all market conditions and could affect actual returns. Using a shorter timeframe would reduce drawdowns on reversals while waiting for the script to check for updates, but could also mean increased false triggers. You could also test different bot settings. More SO’s with higher martingale or step percentage. The bot settings are based on this guide for trending markets since the intent of this script is to activate bots that are in a trend.

Possible Future Updates to the Script

No automated script is perfect, and there is always room for improvement. Two possible implementations come to mind that might be helpful. The first is looking at a higher time frame trend to validate the entry. In other words, don’t start a long bot if the general trend is bearish on a higher time frame, and vice versa. There’s usually no shortage of bots to enable and I’m always hitting the max positions, so adding this filter might help thin out the list for better pairs to trade.

The second is to ignore signals resulting from breakouts. Breakouts generally wreak havoc on indicators since the data being used in the calculation is sort of an outlier. If you consider the price action will regress or normalize, then any signals from that breakout will be false signals. The hard part is deciphering between a breakout that will regress and the start of a strong trend or move we don’t want to miss. As a result, implementing something like this is tricky and may be better handled through stop management. It’s worth an explore at some point though.

That’s it! Make sure to sign up below so you don’t miss any updates or future scripts, and as usual, drop some comments below if you have any issues with the script, setting up, or suggestions on how it can be improved.

Stay up to date on all the posts and how-to’s, Subscribe!

259 thoughts on “35% ROI in 15 Days – New ADX Driven 3Commas Bot Trigger Script

  1. Hello Nick!

    I’d like to know if this, and other scripts you write won’t work with just an Advanced Plan on 3Commas, and if a Pro Plan is simply mandatory.

    I’m asking because I had severe difficulties getting a prior script of your to work despite not finding any obvious errors in implementation. I’m from a poor country so the pro plan is quite harsh in price, tho if I could replicate your returns of course it’d be worth it.

    Thanks!

    Like

    • Hey Pedro,
      You need the Pro plan, yes, it’s the only one that allows multiple futures bots at once.
      Let me know some the issues as you go, I’ll do my best to help you work through them.

      Like

  2. Hey again!

    I tried implementing the script in the VR Machine set up from your other post, but I get this error when I try to run the line “python3 Py3c_create.py”:

    no existing bot ID files found, proceeding….
    The following long pairs were ignored, order volume too low: []
    The following short pairs were ignored, order volume too low: []
    0 long bots created.
    0 pairs ignored, order amount to low
    0 short bots created.
    0 pairs ignored, order amount to low
    Ignored pairs can be found in ignored_longs.txt and ignored_shorts.txt
    All done, have a nice day!

    I believe no bots are being created for some reason. What do you think is the problem? I’m running the Pro Plan.

    Like

      • Thanks for the fast reply Nick!

        Unfortunately I already checked for that and can confirm the number that shows on “account_id” on my 3commas is the name I put on TC_ACCOUNT_ID.

        One possible error is perhaps that I put the same API keys on both TC_API_KEY/TC_API_SECRET, and API_KEY/SECRET_KEY.

        Are they supposed to be a different pair of API keys for each? If so, what other set should I put in? Or if not, what do you think is the problem then?

        Thanks!

        Like

      • One possible error is perhaps that I put the same API keys on both TC_API_KEY/TC_API_SECRET, and API_KEY/SECRET_KEY.

        Yes, this could be it. In this post I covered this in a bit more detail, but the second set of API keys are from FTX.

        Like

  3. Oh alright! But what exactly are those other API Keys?

    As in, I know I can get API keys from the API page on FTX where you create them, but I thought you’re suppose to put them on 3Commas as well to link it with the FTX sub account?

    Am I supposed to generate another set of API keys for the same FTX Sub account, and use those to fill the FTX API Settings?

    Like, I link 3Commas with FTX with one set of FTX generated API keys for its sub account, and those are the ones belonging to 3Commas API Settings. Then, I generate a separate FTX set of API keys for the same sub account, and put those in the FTX API Settings?

    Sorry for the repeated questions, I just really wanna try out your script!

    Thanks!

    Like

    • Yeah, you’ll need another set of FTX API keys for those. They can be the same ones you use for the connection between 3Commas and FTX, but I like to keep them separate so create another set. Sorry, I had alluded to this in the post on the first script, and didn’t mention it here at all, so I’ll try to add an update to bring more attention to it.
      To be honest, my understanding of the FTX API is that you can grab the market data for free, so the bots should still be created. But maybe since we’re passing empty or incorrect keys the response is not authorizing the data to be sent, or it simply doesn’t recognize and sends back and an empty response. In any case, try adding those and let me know how that works.

      Like

      • Alright, so I made sure the “account_id” number is the one I put on TC_ACCOUNT_ID” (even checked that when I made a bot on the non-futures account, the number was decreased by one, compared to the futures one, so I think I got the right one)

        I put the set of API keys I made on FTX on my sub account to connect with 3Commas on the 3Commas API Settings (TC_API_KEY/TC_SECRET_KEY), and then made a new set of API keys on FTX for my Sub Account and used those to fill the FTX API Settings (API_KEY/SECRET_KEY).

        However, it still doesn’t work. I get the same error over and over:

        no existing bot ID files found, proceeding….
        The following long pairs were ignored, order volume too low: []
        The following short pairs were ignored, order volume too low: []
        0 long bots created.
        0 pairs ignored, order amount to low
        0 short bots created.
        0 pairs ignored, order amount to low
        Ignored pairs can be found in ignored_longs.txt and ignored_shorts.txt
        All done, have a nice day!

        What can I do at this point?

        Thanks!

        Like

  4. Hi Pedro,
    if I understood it right, for the above API Pair you need to generate API Keys in 3commas, not the FTX ones you used to connect the FTX account to 3commas, because you want the script to communicate with your 3commas account. The second pair from FTX is just to get market info.
    Greetings
    George

    Like

    • That’s correct George. You’ll need a second set of API keys for 3Commas and FTX for the script. I’ll update the post today to make that a bit clearer. Thanks!

      Like

      • Hey Nick, I’ve done as George said and got the API keys from 3Commas, but it still displays the same error for me.

        Am I getting the SUB_ACCOUNT wrong? I’m putting the exact name i have for the FTX sub account. Is it supposed to be a number, or something?

        To hopefully get everything clear:
        – I connected 3Commas to my FTX Sub account with one set of FTX API Keys, i’ll call it “pair A”.
        – I filled the TC_ACCOUNT_ID with the number you get from creating a DCA bot info for my FTX(Futures) exchange on 3Commas.
        – I put the 3Commas generated API Key and Secret Key (the ones which a much longer) on TC_API_KEY and TC_SECRET_KEY.
        – I generated a second set of FTX API Keys on my sub account, “pair b” to put in API_KEY and SECRET_KEY.
        – I filled SUB_ACCOUNT with my FTX Sub account’s name, in this case “3Commas”.

        Have I committed another error?

        Thanks!

        Like

    • Hi George,
      The settings I used in the test are the ones you see in the config.py, which includes a 3x leverage. For more clarity, the first two days the CLOSE_DEALS_WITH_BOT, EARLY_CLOSE, and CLOSE_DEALS were all false, and I was manually recovering red bags. This is a bit risky since there’s a chance of liquidation on strong reversals. I then switched to CLOSE_DEALS_WITH_BOT = True for the remainder of the test. The returns were more subdued, but the wins still outweighed the losses by a healthy margin. I’m still running the bot now, testing with CLOSE_DEALS_WITH_BOT = False, and EARLY_CLOSE and CLOSE_DEALS are both True. At the moment, I’m up about 4% today so far (14 hours in), killed it with about 6% return yesterday, but was about 5.5% in the red two days ago due to some volatility and crazy reversals.
      I’m planning on switching back to the config.py defaults today as it does help reduce the drawdowns, and in my opinion, I’m not expecting the market conditions to change to anything we would call a strong trend any time soon, and expect some volatility to continue in the short term.

      Like

  5. Hi Nick!
    Thank you so much for all your effort.
    Unfortunately, the Script isn’t working here (Google Console).

    I’m getting the more or less famous:

    o existing bot ID files found, proceeding….
    The following long pairs were ignored, order volume too low: []
    The following short pairs were ignored, order volume too low: []
    0 long bots created.
    0 pairs ignored, order amount to low
    0 short bots created.
    0 pairs ignored, order amount to low
    Ignored pairs can be found in ignored_longs.txt and ignored_shorts.txt

    I’ll double checked the API key from 3C and made sure, that the TC_ACCOUNT_ID is correct (via the “Message to start…”).
    Permissions are all except Smarttrade (I tested this, too).
    I’ll double checked the FTX API keys and tried API for main and for Sub Account.
    Permissions: Trade

    I’ve got the (paid) 3c Pro Plan; 3C is successfully connected to FTX and I’m able to create a Perp-Bot on FTX Futures.

    I’m new to FTX (until now I was using Binance)

    Is there anything else I should check? Thank you for any hint!

    Like

    • Hmm, that should be working, I might need to do some deeper testing to make sure this isn’t a python version issue. For now, can you add this line into the code in the Py3c_create.py file and try running it again. It should dump out a list of pairs in the format like {'1INCH-PERP': '', 'AAVE-PERP': '', 'ADA-PERP': '',.... Let me know what you get. So, add the line print(pairs_list) after line 150, so this is on line 151:

      Like

      • Hey Nick, I added the print line to the Py3c_create.py file, and it generated a new error:

        Sorry for the crude photoshop. At the top is the file i edited with the print line, and below is both the previous error, and the new error the edit generated.

        Thanks!

        Like

      • Yep, perfect! The empty {} in the output tells me the script is not finding any “perp” ‘s in the list. I’ve actually been able to replicate the issue. It works fine with Python 3.9.5, but the default version in debian 11 is 3.9.2 – which is where I’m seeing the same issue as you. I’ll try to get a fix up today if I can.

        Like

      • Hi Nick, great content! Thanks!

        I don’t get the bots created. I did follow the walk through in the previous post. So I have activated Tmux. When using the pyc3c create I get this script:

        frederikdejong3@instance-1:~/3commas_bot$ python3 Py3c_create.py
        no existing bot ID files found, proceeding….
        Error: {‘error’: True, ‘msg’: “Other error occurred: record_invalid Invalid parameters {‘pair’: [‘No market data fo
        r this pair’]}.”}
        Traceback (most recent call last):
        File “/home/frederikdejong3/3commas_bot/Py3c_create.py”, line 193, in
        build_bots()
        File “/home/frederikdejong3/3commas_bot/Py3c_create.py”, line 168, in build_bots
        longbot_list, no_long_bots = generate_long_bots(pairs_list, min_price)
        File “/home/frederikdejong3/3commas_bot/Py3c_create.py”, line 99, in generate_long_bots
        bot_list[key] = data[“id”]
        TypeError: ‘NoneType’ object is not subscriptable
        frederikdejong3@instance-1:~/3commas_bot$ python3 adx_bot.py
        No bot ID lists were found. Create bots and ID list before continuing.
        Bye!
        frederikdejong3@instance-1:~/3commas_bot$

        It seems that it haven’t create any bots.

        How can I solve this?

        I appreciate your answer

        Many thanks

        Freem

        Like

      • Hey Freek, I responded to your email about the ccxt version since it looks like your folder is 3commas and not adx. The original 3Commas script needs an earlier version of ccxt to work.

        Like

      • Thanks Nick,

        I saw your email, many thanks!
        I reinstalled the VM and the second time, I was able to activate the bots. Within the first hour already grabbed the 1%. hahaha great. We’ll see how it goes in the longer term. Have you tested with a larger amount yet? because of the safety orders?

        Like

    • Ok, I’ve updated the create script. You’ll need to delete the old version and replace it. The easiest way is to make sure you’re in the folder where the file is and use:
      rm Py3c_create.py
      then:
      wget https://github.com/nickpagz/adx-bot/raw/master/Py3c_create.py

      That should work now on the version of python that’s installed on your instance.

      Like

      • Good and Bad news!

        You update now allows the bots to be created and they show up on 3Commas, but two other bugs showed up right after.

        Bug 1 is caused when running python3 adx_bot.py after the bots are all created: “IndexError: list index out of range”

        Bug 2 is that randomly when creating bots the script will pop an error at one of the perps and stop: “NoneType object is non subscriptable”

        I should say the first bot build up went perfectly, but Bug 2 only started showing when I ran it for the second and more times. Maybe something related to re-writting previous lists?

        Do you recognize the issue?

        Thanks!

        Like

      • No, this should be working now. It runs perfect on my setup. But let me do some more testing, with a full and fresh install and see how it goes. I’ll get back to you here when I get it sorted it out.

        Like

      • Hi Pedro,

        Ok, so bug 2 first. I had the same issue several times today – this is really due to 3Commas API flakiness. I’ve updated the “create” script to increase the number of tries, and this worked for me. You can delete the current file using the rm command, and then add the new one using `wget https://raw.githubusercontent.com/nickpagz/adx-bot/master/Py3c_create.py`

        Bug 1, I’m not sure yet, but it looks like there’s no funds in the FTX subaccount you’re connected to. The Balance and Max Positions in the screenshot show zero. It shouldn’t cause the error, but it’s possible. Also make sure there’s no other open positions in that subaccount on ftx. Other open positions using different leverage can cause issues. Let me know if that works!

        Like

      • Hi Nick!
        Once again thank you so much!
        It seems to work now, but after creating a few bots there’s this error:

        SAND-PERP > 78062xx
        Error: {}
        SC-PERP > 78062xx
        Order volume too low for SECO-PERP, bot not created
        Error: {‘error’: True, ‘msg’: “Other error occurred: record_invalid Invalid parameters {‘pair’: [‘No market data for
        this pair’]}.”}
        Traceback (most recent call last):
        File “/home/…./3commas-ftx-triggers-main/./Py3c_create.py”, line 189, in
        build_bots()
        File “/home/…./3commas-ftx-triggers-main/./Py3c_create.py”, line 168, in build_bots
        longbot_list, no_long_bots = generate_long_bots(pairs_list, min_price)
        File “/home/…./3commas-ftx-triggers-main/./Py3c_create.py”, line 99, in generate_long_bots
        bot_list[key] = data[“id”]
        TypeError: ‘NoneType’ object is not subscriptable

        It’s not because of the Order Volume, this message is popping up at a few occasions.

        I’ve run the script a few times, I deleted all bots – nothing changes.

        Thank you and keep going!

        Like

      • Hi Nick,
        no, I’m not blacklisting Shib. I’m using your default settings… (except max open positions 2):

        PAIRS_BLACKLIST = [‘DMG-PERP’, ‘BRZ-PERP’, ‘PERP/USD’, ‘SRN-PERP’, ‘PRIV-PERP’]

        I tried to remove SRN-PERP, but nothing changes.

        Thx!

        Like

      • Ok, you need to blacklist SHIB in the config file. There’s no option to create a bot in 3Commas for the ftx shib perp for some reason.

        Like

      • Hi Nick,

        looks like I had a mismatch with the config files… Sorry for bothering you. Thank you for all your efforts!

        Now, using the right config.py (i crosschecked it) the Py3c_create works well, but running the adx_bot.py:

        Getting perps OHLCV data…
        . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
        Traceback (most recent call last):
        File “/home/xxx/3c-adx/./adx_bot.py”, line 359, in
        open_positions = get_positions()
        File “/home/xxx/3c-adx/./adx_bot.py”, line 116, in get_positions
        if ‘info’ in all_positions[0]:
        IndexError: list index out of range

        Just for your information: yesterday I had a few other errors:

        Connection error, trying again…
        Connection error, trying again…
        Max bot usage: 36.43306666666666
        Traceback (most recent call last):
        File “/home/xxx/3c-adx/./adx_bot.py”, line 303, in
        if math.floor((float(tradeable_balance) * config.FUNDS_USAGE) / bot_usage) < config.MAX_OPEN_POSITIONS:
        TypeError: float() argument must be a string or a number, not ‘NoneType’

        I tried to change the max open positions, it doesn’t matter.

        Like

      • Ok, sounds like there might be an issue with the subaccount you’re connecting to on ftx. Make sure there’s some USD in the account, at least enough for one bot to run – so about $50 or so. Also, no other positions should be open in that subaccount – the leverage settings can interfere with the bots’ settings. This error though, it does look like it’s borking at the positions calculation. I hope that helps, but if you’re still having issues post your config.py settings (less your API keys) and I can take a look, or email it to contact@onepercent.blog

        Like

  6. Hi Nick, great stuff as usual.
    I’ve been wondering how to scan multiple markets like you’re doing here, or like the 3commas composite bot does. Did you work it out for yourself, or is there a tutorial somewhere on how to do this?
    I’d ultimately like to make something similar to the composite bots, but using my own signals.

    Cheers!

    Like

  7. Hi, I have the same issue as your, no BoT created. Finally I found out that it is because of ccxt:ftx library that cause this issue.. I try the old version of last year…and now it is working… You can try out this command

    pip install ccxt==1.63.91

    Like

  8. Hey Nick!

    I’m eager to hear if you figured something out about the bug I reported earlier. I tried many fresh installs in new instances, but keep getting the same error when I try running “python3 adx_bot.py”.

    Have you been able to replicate this, or understand the cause?

    Thanks!

    Like

    • Hey Pedro, I’m still testing, and so far the only thing I came across was an issue with BTT-PERP. It looks it was delisted today but my bots were created before, so I was getting an error. I manually removed it from the bot lists files and it’s working again. So have a look at that, and in the meantime I’ll keep testing on my end.

      Like

      • I see. I don’t know exactly how to remove that perp manually from the code, but I’ll wait to hear from you if you hopefully find anything.

        Thanks!

        Like

      • Hey Pedro and Nick, I may have stumbled across a fix for this. I had the same error as Pedro and stumbled across something Nick said in the comments of his previous script. The issue has to do with the used sub-account not having had a PERP position before. Thus, the code returns an empty array and can’t reference any value, since there are no values to begin with. Once you open and close any PERP position manually on the exchange with the sub-account you are going to use you are giving the code some history and it should work after that; at least it did for me.

        Hope this helps!

        Like

    • Hello.
      I have this same error myself.
      I have tried increasing the Blacklist entries the same as Pedro below to no avail.
      I have also followed Yuri’s suggestion and opened/closed a PERP position.
      I have ensured that i have funds in the sub account.

      Like

      • For the sake of full disclosure and potential debugging of this problem, I have to mention I also made changes in the adx_bot.py script before trying this fix. In lines 117 to 123 I changed all the x’s to y’s and vice versa. I don’t remember my exact reasoning for it, but it also had to do with comments about fixes for the ftx-trigger script (for example the one by ‘don’ on October 24) and comparing those to the original code of the ftx-trigger script as well as the code for the adx-bot. I have to admit that I do not have enough knowledge of python to know if changing the letters would make a difference, but it just seemed logical since it was more in line with the fixes I read about for the other script and would make absolutely certain that those differences were not the problem.

        Like

      • Thanks Yuri for your response, but still the same i am afraid.
        The line 359 and line 116 errors.
        Pedro, do you recall making any other changes to the adx_bot to make it work?
        Are there more pairs that need blacklisting?

        Like

      • Other than the adding and removing a perp to the subaccount, this should be working from a fresh install – I tested this yesterday.
        One thing to watch out for is the ccxt library version, which seems to be causing an issue if you’re using an older version. Make sure to run pip3 install --upgrade ccxt and see if that helps.

        Like

      • Thankyou. I have upgraded ccxt as suggested and still nothing. How do i determine what pairs might need to be removed from the subaccount – i can’t see any errors. 😦

        Like

      • Crypto Bob and Anthony Morey:
        If you guys still want the Kucoin scripts, then I just finished them this morning. Notes: I’ve only done the Leveraged tokens so far and haven’t gotten around to doing leverage(Kucoin calls it margin) trading yet. I’m not sure if CCXT even supports it, so I will most likely have to write code for it. For the leveraged tokens, I’m using a separate config file (named config3x) to adjust the percentages manually. I’ve fully tested the py3c_create script, but haven’t fully tested the adx_bot script yet. I know it will at least pull in all the correct keys and assign the indicators to them, but I’ve been up all night and am going to test when I wake up later. Anyways, you can email me @ archernewlun@gmail.com if you want me to send it to you directly, or I can post on here later when I wake up.

        Like

      • Right – i am off to the races! I believe when i created the dummy trade before to create some history i did a smart trade. This time i started a bot. Stopped it and then closed off the open position quickly for a penny loss. This has provided the necessary “history” to get things going.

        Like

      • Hey Anthony, what got my code to finally work is that I got the API keys from 3commans (was originally using ftx on both keys). Then I applied Nick’s updates to the code on the config and create files, then I ran a clean install in a new VM instance and added the expanded blacklist for perps. Another thing is that i moved my ftx funds from USDT to USD, as the bots are there to trade USD.

        After all that, it worked for me.

        Like

  9. Hey again Nick!

    If you need help with some bug testing and info I’d be more than glad to help, be it through Discord or any means of contact you prefer. I’m super interested in learning from your code and get it working so if you want to chat about it just ask.

    Thanks!

    Like

  10. It worked Nick!

    The bots are built, activated, and engage in (mostly) profitable deals!

    However, the first time i applied your updated script, and change my account balance from USDT to USD (duh) it didn’t work, and generated another error.

    It was only after I expanded the Blacklist for PERPS to this that I got it working:

    PAIRS_BLACKLIST = [‘DMG-PERP’, ‘LUNA-PERP’, ‘BRZ-PERP’, ‘PERP/USD’, ‘SRN-PERP’, ‘SECO-PERP’, ‘PRIV-PERP’, ‘SAND-PERP’, ‘SC-PERP’, ‘RUNE-PERP’, ‘RSR-PERP’, ‘SHIB-PERP’, ‘SHIT-PERP’, ‘LEO-PERP’, ‘BTT-PERP’]

    I saw that Ilya from a previous post had done something very similar and it worked. It worked for me to!

    There must be something about these pairs that wrecks the code somewhere.

    Thanks a lot for your great work and willingness to help us! It means a lot! I’ll love to read whatever else in the future my new favorite blog comes up with!

    Like

    • Glad it worked Pedro! Yes, some deals will close negative, it’s designed to, but in the long run it should be positive overall if the market is having a decent trend. Keep an eye on the script as well, if it crashes (happens when 3Commas API stops working sometimes) the bots may stay on when they should be turned off. I’m looking at some options for getting notifications when that happens, but still working on it.

      Like

      • Great! If I might ask, what percentage of daily gains is it to be expected from this script on a normal, rangy day?

        Like

      • It varies a lot. Here’s what the chart looks like since I first started running the script. Keep in mind I’ve been testing, so some days it wasn’t running, and other days had starts and stops, and the settings varies too. Mostly 15 minute time frames, some 60 minutes, and different settings with closing deals with the bot true and false, and early close, etc. For the charts in the screenshot the account had between $150 and $180 during the testing, so that puts the values between +11% on those green days, to -6% max on the red days, and this was with four bots running most of the time, down to three when the account was closer to $150. I hope that helps give you a picture of what it’s done so far. I just started another test today, running two scripts side by side. Same settings as the default config, except in one I’m closing deals with the bot, and the other I’m not closing deals with the bot. Let’s see how it goes!
        Returns to date

        Like

  11. Thats good info to have Nick!

    However, as the first day has gone by, I gotta ask if its normal to have so many negative deals? I mean I think the bot is going 50/50 on winrate alone, and some of the losses are gigantic, like three times already its lost 4 dollars in a single trade.

    Are the current market conditions unfavorable for the script, or is something going on?

    Thanks

    Like

    • Hey Pedro,

      Yeah, I’m also seeing the same hit over the last 12 hours. It looks like there’s been some sudden reversals or back and forth on the deals the bot has chosen and it’s causing a drawdown. Seems to be coming back up in the last two hours though. Seems to be normal so far.

      Like

      • I see, I’m still suffering tho, bots keep losing trades. Is it safe to say the more rapidly volatile the market, going up and down fast, the worse this script performs?

        Like

      • Not so much the script necessarily, but the settings. I’m running two of the scripts side by side right now, and the one with the default settings is down for the day (since last midnight UTC), while the second one is up, using these settings:

        CLOSE_DEALS_WITH_BOT = False
        EARLY_CLOSE = True
        CLOSE_DEALS = True

        This could change of course, but part of the test is to see if this holds up in the long run – or which one prevails. At the moment, the settings above is positive on the day.

        Liked by 2 people

      • Just my quick obervation if you guys are interested: When I did a short backtest, it seems the DMI lags a little behind the indicators I’m using, so this might have something to do with it. I’m in the process of backtesting using a higher timeframe as a trend reversal indicator to see if it helps with multiple red trades. Also, when I did do some testing in TV, I implemented some risk management strategies which I think would be helpful in mitigating some of the risks with the bots excessively trading.

        Like

      • Hey Archer,

        Yes, I did notice some lag as well, but it was the best out of the other trend indicators I tested. I would be interested to hear what mitigation strategies you’re using, and maybe we look at implementing those. One idea I had was to look at another indicator (whatever that might be) on a higher timeframe as a validator for opening and closing deals. Let me know what you think.

        Like

  12. Thanks Nick! I’m testing the settings you shared, seem to currently work better, but I’ve been wondering…

    As you said, theres no shortage of deals bots can take at any time, so therefore doesn’t it make sense to be more picky with the settings? As in, require a higher score for the parameters for the bots to take deals? I don’t know if you stress tested most viable parameters, given your statement about no extensive testing, but with so many pairs and 24/7 operation it seems the first logical method to attempt to increase winrate.

    I’m still new to this so dunno if I’m wrong with this impression. Are the current settings optimal?

    Thanks

    Like

    • Hey Pedro,
      Your impressions definitely aren’t wrong. There’s lots of things we can play with to try and optimize the returns – both on the script side, and the bot side. So far I’ve only tested the 15 and 60 minute time frames, and adjusting the closing deals parameters. We can play with the ADX lookback period, the ADX cutoff, time frames, bot settings, etc.

      Like

  13. Hey Nick, I’m glad you posted this as it was just what I needed! I was in the process of modifying your previous bot to work with Kucoin, but I wanted to add indicators, a high timeframe trend lookback, and some way to loop through the different timeframes. I’m still pretty new to python, but coding and scripting is not exactly new to me. Been doing similar things with pine script, but tradingview limits you in how many alerts you can send out. I also wanted to implement a social media sentiment scraper to further narrow down the amount of deals we get into. I’m not sure if you started on implementing multiple timeframes, but I hope to get it completed this weekend. Also, I’m not sure if anyone wants the Kucoin create script, but i have completed that. They will of course have to modify it a little to fit their build, but let me know if you want to take a look at it.

    Like

  14. Hey Nick, dunno if you’re experiencing the same, but the script’s performance hasn’t been very great as i’ve started testing.

    The main fault is that the bots keep repeatedly getting into awful trades where they tank over 4 dollars each, and it nukes all other profits other bots make. I dunno why it goes so red, while green sales only go as high as $1.5 or so. Is it failing to trigger the sell signal prior? This happens on both the normal and the other settings you recommended, I found.

    Perhaps a method for the bots to scout larger timeframes is essential for the bot’s long term performance.

    Have you experienced this in the weeks prior as you tested? Or have these past days just been an unfortunate time to start testing the script?

    Thanks!

    Like

    • Hey Nick, dunno if you’re experiencing the same, but the script’s performance hasn’t been very great as i’ve started testing.

      How many bots are you running at the same time? I’m running 4 bots and I’m still in profit. Per my comments yesterday, the default bot settings were in the red, but the other one I mentioned was in profit. So far today, both bots are in profit. If you’re only running one or two bots at a time, then you could be missing out on more winning bots to counter the losing ones.

      The main fault is that the bots keep repeatedly getting into awful trades where they tank over 4 dollars each, and it nukes all other profits other bots make. I dunno why it goes so red, while green sales only go as high as $1.5 or so. Is it failing to trigger the sell signal prior? This happens on both the normal and the other settings you recommended, I found.

      DCA bots have a built in flaw – when price is trending the bots only (usually) take a profit with a portion of the funds, but when the trend reverses, the SO’s kick in and could use all of your funds, then it cuts the deal. DCA bots usually have a poor risk/reward ratio. It’s how they work – but we make up for that with more wins. If you’re running enough bots in parallel, this shouldn’t be an issue, except on really choppy days.
      Again, not sure how many bots you’re running, but over the last two days I have been profitable.

      Perhaps a method for the bots to scout larger timeframes is essential for the bot’s long term performance.

      Yes, this could definitely help reduce the number of bots that get started. I’ll hopefully get a chance to start coding that very soon.

      Have you experienced this in the weeks prior as you tested? Or have these past days just been an unfortunate time to start testing the script?

      It’s happened, yes, but I kind of expected there would be ups and downs, and that some settings won’t work all of the time. Some days were really but, but then they end up in the green the following day. Again, make sure you have enough bots running to even things out.

      Like

      • Yes so, I’m running the new settings you shared in the previous comment, with 10 bots runnings at the same time, and today I am flunctuating between slightly red and slightly om profit.

        When you say you’re green on the same settings, do you mean you’re above 0, or seen good 3/4% profits?

        Do you think running 20 bots would work better? That would take at least U$ 700 TO safely fund, right?

        Also I hope I’m not sounding annoying. I absolutely love you’re sharing this work, I’m just curious on the possible ways to improve it since it seems to have to many possibilities.

        Thanks!

        Like

      • Yes so, I’m running the new settings you shared in the previous comment, with 10 bots runnings at the same time, and today I am flunctuating between slightly red and slightly om profit.

        When you say you’re green on the same settings, do you mean you’re above 0, or seen good 3/4% profits?

        At the moment it’s 3% and 6% for the script and bot default and test settings respectively. Are you using the default bot settings as well?

        Do you think running 20 bots would work better? That would take at least U$ 700 TO safely fund, right?

        Well, I’m not sure. I’m wondering if fewer bots are actually controlling the quality of bots activated. Maybe if you try setting your bots to a max of 4 and see how that works.

        Also I hope I’m not sounding annoying. I absolutely love you’re sharing this work, I’m just curious on the possible ways to improve it since it seems to have to many possibilities.

        Not at all, the feedback is what we need to improve the script and the bots, so keep it coming!

        Like

  15. Hey Nick!

    I tried applying some of your recommended changes, but when I did I ran into this error when trying to run the create command. I made a new install in a new instance, and it happened again. Its a new error. Do you know about it?

    Thanks!

    Like

    • Just to give some feedback of my own.
      I agree with above comments, after 12 hours i was slightly in the red and the gains incurred during that time were wiped by downturn. However, another 12 hours i have found i am in profit!
      I am running with the default 4 bots with settings:
      CLOSE_DEALS_WITH_BOT = False
      EARLY_CLOSE = True
      CLOSE_DEALS = True

      Like

      • Yep, those settings seem to be working out. Everyone’s crying over the huge sell-off of the last 24 hours, but so far this configuration is up over 10% during the same time.

        Like

      • Nope! Its strange, it was happening over and over, and then after a few hours, without changing anything, it started working again. Maybe some issue on 3Commas/FTX’s servers? I believe you mentioned something like that happening.

        Also yeah I’m also testing the new settings and the winrate did increase a lot after getting it down to 4 bots.

        Is the current “Meta” were getting at something like a few bots with high BO’s/SO’s? Have you tested if it scales well to large bankrolls?

        Thanks!

        Like

      • Maybe some issue on 3Commas/FTX’s servers?

        Yes, 3Commas API is pretty flaky. I suspect with all the big moves happening they were a bit overloaded.

        Is the current “Meta” were getting at something like a few bots with high BO’s/SO’s? Have you tested if it scales well to large bankrolls?

        I haven’t tested it no. I would definitely expect some diminishing returns though, as we trade more bots that aren’t as “good” as the ones at the top of the list. If that’s the case, and as you’ve found out, if going with only 4 bots is better than 10, then perhaps that’s the limit. I’m slowly increasing the number of bots in my testing to see how it goes. If it is the case though, then we could increase the BO and SO values at the same ratio to make the same returns on a larger account while keeping the number of bots down. We still need to watch out for liquidity though, and make sure our trade sizes are well below what’s available on the order books so we don’t get hit with too much slippage.

        Like

  16. Hi Nick,

    I noticed that during these few days, the market are so volatility. This means that a deal may be finish in a few minutes. As the default of each bot is to start the new deal asap and this may cause an issue as the situation might already be reversed and will cause that deal to be negative.

    I just experiment by adjust from your code base to set the default of bot to be start as Manual. It seem that the outcome is better for my result – less of red 😉

    Here is what I change.

    Py3c_create.py, Py3c_update.py

    Replace
    “strategy_list”: [{“strategy”:”nonstop”}],
    with
    “strategy_list”: [{“strategy”:”manual”}],

    and adx-bot.py, in the function start_bot, add the following code after the first one that “enable” a bot
    print(f’Bot Enabled for {pair} – {bot_id}’)

    error, bot_trigger = p3cw.request(
        entity = 'bots',
        action = 'start_new_deal',
        action_id = bot_id
    )   
    print(f'Bot Start New Deal for {pair} - {bot_id}')
    

    Like

    • I designed the script to basically “ride” a trend for as long as it was a trend. The ADX does have a little bit of lag, but the EARLY_CLOSE setting was designed to help with stopping the bot as soon as there was an indication of a weakening trend. In some cases, yes, this could mean a few red deals – but ultimately we (hopefully) made lots more riding the entire trend. I didn’t intend for the script to not have red deals, but to minimize the drawdown as much as possible.

      With this modification, you’re not actually making too much difference. In the original, bots are deactivated, so they don’t start new deals. When the conditions are met, the bot is activated and it starts making new deals until the script stops the bot. In your case, you’re manually starting the deals under the same conditions, and as long as the conditions are met, the script will continue to tell the bot to start new deals. As long as you have limited bots running, then this works to limit the number of deals a bot makes – and as the number of bots that run in parallel increase it’s virtually the same as the original script. I think with this setting your upside will also be limited.

      Having said that, I’m not going to argue the change if it works for you. I would say that unless you’re testing side by side with the original, it’s going to be difficult to know for sure. For example, yesterday the original (with the latest update to the config default settings) returned 33%, and it’s up about 12% today so far. In fact, since I started testing these new settings on Jan 17th, I’ve only had green days. I’ve had lots of red deals, but the net outcome is positive (so far).

      Like

  17. Hey Nick,
    So I’ve been testing this with other signals and it looks like this is a good signal for the bots. What I did though was ditch the dm crossover and went purely with ADX and ADX_SLOPE. Then I added a high timeframe ema slope. I also added a win/losing streak counter, limited max trades to 4/day, limited losing streak to 1/day, and max win streak to 3/day. This got me to 75% win rate, hardly any open trades, and over 1000 trades backtested to May 2021. Avg bars in trade is 37(30min timeframe). When using only the signals you provided, I get 73% win rate, An open trade from Nov (very high open trade), and over 790 total trades backtested to May 2021. Avg bars in trade is 92(30min timeframe. The biggest difference though, was to not allow Longs to be traded on the weekends. This essentially doubled the amount of profit you could make as it prevents false longs on the weekend and allows shorts to excecute. The difference in testing was $397 in profit vs $942 over the same time period(Everything else being equal). Now I’ve only had time to do some limited testing, but I will do more when I have time. I think what you did so far is awesome, but just adding the function to disable longs on weekends can potentially increase profits further. Let me know what you think

    Liked by 1 person

    • Hey Archer, thats some impressive results.

      Are you disabling longs on weekends because we’re in a bearish trend, or because longing as such on weekends is a bad idea?

      Like

    • Good stuff! I’ll have a look at adding a trading filter based on the day of the week and the time of day. I do tend to agree about weekend trading – though only going short on the weekends might be too much over optimization – the reason I think that is because I do believe weekends are more volatile, and generally don’t trade on weekends because of it. I think if you were able to go back to 2020 you might find the opposite is true since we were generally in an uptrend (before BTC April peak). Since then we’ve been more sideways and down, so it makes sense the shorts did better. Again, that’s my hypothesis – so I could be dead wrong. I think in general though, we know weekends are volatile, so having the filter would be a good option.

      How much effect do think the HTF ema helped? I’m assuming you were using this to validate the long/short direction?

      Like

      • You’re probably right about going back to 2020. I’ll have to check that later. Tradingview only allows me to go back so many candles on intraday timeframes unless I upgrade my subscription, so I’ll have to change my start/end times. There is a correction I’d like to make in that I was using a higher timeframe EMA trend, not slope. I tried using the slope and in some cases its good, but not consistent. I also want to try a higher timeframe ADX to see if it works better. I should know tonight what the outcome is.

        Like

      • Which modifications are you referring to? The Kucoin modifications? I’ve only done backtesting so far on the ADX signals with the higher timeframe EMA trend. I’ve modified the previous script to work with Kucoin and added my own signals, but I like the ADX with EMA trend signals better, so I’m going to modify the script to work with that….Unless Nick beats me to it lol.

        Like

  18. I’ve noticed that longing on wekends in general is a bad idea. Every backtest I’ve done, especially the ones that include shorts, I’ve disabled weekends and generally have gotten better results. There are some other settings I’m working with to where enabling longs might be beneficial, but I have to check it across multiple coins to see how it performs.

    Like

  19. Hey Nick,
    So the best results I’ve gotten are with 30min trading timeframe, 20 EMA Trend on higher timeframe(4Hr) for signal validation /reversal, and the stock ADX signals you’ve provided. This gives me a consistent 80-90% win rate, with or without weekends included. Some coins are higher when disabling longing on the weekends, but I think you should be okay overall just by including the higher EMA Trend. No strategy is perfect and I’m sure its almost impossible for any strategy to avoid holding red bags, but this may be the best outcome I’ve had so far. At the very least its the most consistent I’ve tested so far.

    Like

    • Sounds interesting. If you wanna share the code you modified I’ll test it on my account too and share the results if you’d like it.

      Like

    • Ok cool. In terms of the signal validation, how are you checking for the trend? I typically use something like an EMA20/EMA40 on a 4x time frame (eg 15 mins X 4 = 60 mins is my HTF) to check for trend direction. Is that how you’re doing it, or something else?

      In any case, I’ve uploaded a version of this in an un-merged branch here:
      https://github.com/nickpagz/adx-bot/tree/add-htf-validation
      You can see the date/times for the two files that changed.

      It’s un-merged because it’s un-tested. I was hoping to at least run it once tonight, but I’m out of time – and I have no idea if the code even has any mistakes (syntax) or logic errors. You’re welcome to try it, but it may not work. I’ll hopefully have some time tomorrow to get it a whirl.

      Like

      • I will give Nick’s ago now. Just woke up to find that i have lost all my gains over the last couple of days and a bit more besides.

        Like

      • I can test the code rn if you wanna. I was actually studying how to implement a HTF but you beat me to it!

        Does un-merged mean it doesn’t work tho? Or just that it’s untested?

        Like

      • Sure, go for it! I’ll hopefully have a chance to load it up in a couple of hours from now.
        Un-merged means I’ve made the changes on a branch of the original code, so that it doesn’t affect the original code, but you can still download and use the branched code. Eventually, if it works, I’ll merge the two branches so there’s only one version of the code.
        This is the link for the branch with the changes:
        https://github.com/nickpagz/adx-bot/tree/add-htf-validation
        You would install/download (using wget for example) the same way as before, just make sure you’re linking to this branch.

        Liked by 1 person

      • Hiya. I have been running the unmerged script for more than 8 hours now and don’t believe i have gotten a signal – least no trades have kicked in.

        Like

      • Hmm, ok. Thanks for trying it. I’m setting up a test now, so I’ll report back here in the comments later.

        Like

      • I’m experiencing the same thing as Anthony. The HTF code doesn’t start any deals. Are the conditions too harsh, or is there error somewhere, do you think?

        Like

      • Yep, found it! A logic error, a leftover from another attempted implementation. Remove line 295 – stats.append(trend_dir). I’ve removed it already in the un-merged branch.

        Like

      • I’m expecting this to help a bit, but I’m still not expecting miracles.
        One of the reasons the drawdowns (red closing deals) had to do with the bounces on the way down. The screenshot below shows what KIN looked like in that free-fall on the 15 minute chart. The script and the KIN short bot would be killing it on the way down, but on every bounce the bot would go negative and trigger some SO’s before continuing back down and taking more TP’s. However, the bounces were large and sharp enough to cause the DM+ to cross over the DM- (blue line crossing up over the orange line), causing the script to panic sell the deal – and leaving us possibly with a loss on that deal.
        To get around this you could use a higher TF, like the 30 min or 1 hr, or set the script to not close any deals and you do it manually – most of these would have TP’d eventually on their own. Having said that, in these or other conditions a higher time frame might have you stuck on a long before the prices tanked, and really leaving you with a huge red bag.
        I think the point is that the market changes often, and the settings work differently in each of those market conditions – and hence we need to learn over time which settings work for which market and adjust accordingly. A single script or bot that handles it all would likely mean very average returns, which I suppose is ok as long as we’re going up and beating CPI.
        Maybe there’s something else we can do to improve on this, I’m all ears!

        Like

      • I’ve done several bots with similar settings plus RSI 3/30/1 hour and it helped not entering deals at the end of the run. In the API can’t see a way to do it but in the web interface is available. I think that will help

        Like

      • Hey Pedro, I added the RSI to the KIN TradingView chart it does look like the RSI might have caught those close signals a little sooner than the DM crosses, which is interesting. To be clear, you’re using an RSI length of 3 instead of the standard 14?
        In terms of adding it to the bot through the API, it’s clear how to add different ones, using a JSON string – but it’s not clear how to do it specifically for the RSI – https://github.com/3commas-io/3commas-official-api-docs/blob/master/bots_api.md
        I’ll try to create a bot manually with those settings, then use the API to get the bot settings and then see if I can copy the format that’s returned.
        Another option is to have the script do it.

        Definitely something to look at though. I’m curious to see how this works in other market conditions.
        Thanks!!

        Like

      • The RSI setting that i use in my bots is the default one in 3commas web interface: RSI-7. But I use it in the 3m/30m and 1 hour timeframe, all in the same bot.

        Like

      • Ok, I made those settings manually in a test bot, then queried the bot using the API to see what the strategy list structure came out as. You should be able to replace the “strategy_list” line in the create or update scripts to this:
        'strategy_list': [{'options': {'time': '3m', 'points': '30'}, 'strategy': 'rsi'}, {'options': {'time': '30m', 'points': '30'}, 'strategy': 'rsi'}, {'options': {'time': '1h', 'points': '30'}, 'strategy': 'rsi'}]

        If you use RSI-14, then change “rsi” to “rsi14”.

        Like

      • Yes, KIN and others gave me some huge losses the nullified many profits. I believe things like this should be the focus when trying to improve the script. The more tools the code has to diminish the number of times it gets deals “wrong”, the better.

        Assigning more that one timeframe check, such as, trading on the 5min, checking the 30min, and also checking the 2h for validation could maybe filter a lot of false signals. Could also be the 15min, 1h, and 4h. But I don’t know if it would filter deals far too much and many good trades would be missed

        You’re right about it depending on the market. In a bearish one, like the current, a script that heavily favors Shorting would make more sense.

        Perhaps you could something like this: Focus mostly on a generic script that still has a lot of performance, like this one, but also give settings and/or additional code that focusses either on a Bull (Long) market, or a Bear (Short) market. And so people could have the choice of either switching between the bear and bull, or leave the normal script running 24/7.

        Also, have you considered using more advanced checks for validation? Like RSI, or more complex indicators? I don’t know which you’d have access to with this code, so I’m curious if you do.

        Just a thought, and thanks!

        Like

      • Hey Pedro,
        Yeah, this is exactly why I make this public, so I can improve as I go. I’m still growing my trading knowledge, so any tips are greatly appreciated.
        In terms of other checks/indicators, the script is using the TA library, I think the same one TradingView is using now for version 5 of Pine script. They’re listed here as well:
        https://github.com/mrjbq7/ta-lib
        (scroll down a bit).

        I’m definitely looking at ways to improve this using more validation on higher timeframes.

        Like

      • Nice! Would be great to find out which validators have the best effect. Perhaps Three for checking Trend, Momentum and Volume each could work wonders. Theres several perp pairs to choose so I believe there’s lots of room for quality filtering.

        Like

  20. Yeah that’ll be cool. I’m not done with it yet and I’m still learning python myself, but I could send it to you and Nick when I’m done.

    Like

  21. No go Nick:
    3commas_bot/adx_bot.py”, line 359, in
    unfiltered_stats, trend_direction = perp_stats(perp)
    File “/home/amorey74/3commas_bot/adx_bot.py”, line 208, in perp_stats
    htf_mins = time_frame_mins * config.HTF_MULTIPLIER
    AttributeError: module ‘config’ has no attribute ‘HTF_MULTIPLIER’

    Like

    • Ignore previous post – i neglected to change up the config.py file that sets all the parameters.
      Have started and now working again.

      Like

  22. Thanks a lot for sharing the script. Really helpful. I’ve been trying the same kind of strategies but manually using trading view. I’ve been running it for 3 days and by my tests in trading view it seems that adding RSI 7 in the creation of the bot would improve the chances of success but can’t seem to find in the API how to do it. Any idea if this is possible? Thanks

    Like

  23. Hey Nick,
    I work weird hours sometimes, so I didn’t have a chance to check this out yet. In testing on the 15min, It does seem harder to use a HTF trend line, as the moves are sharper. I tried using 60min with limited success. 2HR timeframe seems to work slightly better as it captures larger market moves. I’ll be able to test more when I get off my 12hr shift tomorrow.

    Like

  24. I’ve tried using the Stochastic RSI on higher timeframe and while you will get better results, you will also get much lower trades. You will most likely get less red bags, which means it will potentially be more passive, but its all theory until we test it live. In any case, I do believe finding a good HTF validator is the way to go. We just have to find what indicator works best.

    Like

  25. FYI…I just did a quick test before I go into work on the Stoch RSI. It seems to do better on the 1HR HTF than the ema20 trend. However, then EMA20 is consistently better on the 2HR HTF. The coins I’ve used are AR, FTM, ETH, AVAX, LINK, and KSM. Generally I like to test across at least 10 coins and for at least 100 trades to get a feel for how it will perform. I’ll try to post some screenshots this week so you guys can see what I’m looking at.

    Like

    • Archer

      Would you be will to share your code? Would be interested in how you adjusted to work with Kucoin and adding other indicators.

      Like

      • Yeah I can send it to you. I’m still not done with implementing the adx bot script with my kucoin create script yet. I will this week and can send both. It will probably be around Thursday since I work 12hr night shifts this week.

        Like

  26. Thanks for the API code. Just changed the Update script to reflect that. One thing to note is that the RSI settings are different for short and for long so I divided the code into two. Also, the nonstop is still there, just with the RSI ones added on. I’ll report back on how it’s behaving if you’re interested.

    Like

    • Whats the difference in settings between the long and short bots, if I might ask? I’m playing with Nick’s new RSI settings rn

      Like

    • Sorry I meant in the application of the code, I’m still learning a lot of basics. What parameters from Nick’s changes should be for the Long bots, and what for the short bots?

      ‘strategy_list’: [{‘options’: {‘time’: ‘3m’, ‘points’: ’30’}, ‘strategy’: ‘rsi’}, {‘options’: {‘time’: ’30m’, ‘points’: ’30’}, ‘strategy’: ‘rsi’}, {‘options’: {‘time’: ‘1h’, ‘points’: ’30’}, ‘strategy’: ‘rsi’}]

      Really curious to learn

      Like

      • Ahh, Understood.

        For long it looks like this: “strategy_list”: [{‘strategy’:’nonstop’}, {‘options’: {‘time’: ‘3m’, ‘points’: ’70’}, ‘strategy’: ‘rsi’}, {‘options’: {‘time’: ’30m’, ‘points’: ’70’}, ‘strategy’: ‘rsi’} ],

        For Short like this: “strategy_list”: [{‘strategy’:’nonstop’}, {‘options’: {‘time’: ‘3m’, ‘points’: ’30’}, ‘strategy’: ‘rsi’}, {‘options’: {‘time’: ’30m’, ‘points’: ’30’}, ‘strategy’: ‘rsi’}],

        Like

    • Sorry, I meant in the application of the code. Was wondering what parameters from Nick’s changes have to change for Longs and Shorts respectively. Is it 30 for the Long function, and 70 for the Shorts function?

      Like

    • Alright so I fixed the error and applied the changes, but the bots don’t engage in any trades.

      Is there an error somewhere perhaps?

      Like

      • I Also saw a big drop in trades entered but until now with 100% sucess rate. If you want to increase the amount of trades, use only RSi 3m instead of also the 30m . Increases the chances of reversal but you get more trades.

        At the moment i still don’t know what is the best setup. Still testing.

        Like

      • Cool!

        How many trades have you made that make up that 100% winrate? Plus I’m using Nick’s changes of the 3min/30min/1h. So you’re using only the 3min/30min? Is including the 1h too harsh?

        And yeah sure, the great thing about Nick’s public blog is that we can all figure out whats best together.

        Like

    • Hey Pedro!
      Have you back tested this at all? It looks really interesting so far. My feeling is we may not need the ADX/DMI validation, but it’s not clear yet. If that’s the case, you wouldn’t even need a script since you can setup multi-pair bots with 3Commas and your start conditions, which would make things a bit easier. Though, we could also instead use a script to trigger deals directly on the exchange and eliminate 3Commas altogether. In random checks I see a few areas where the bot would be helpful, but most areas are profitable, and a stop loss on the few that aren’t in the right direction might be sufficient.
      I’m going to try and backtest this in the coming days as time permits and report back.

      Like

      • I tested it before with Trading View Strong Buy in different TF and it worked well. With DMI doesn’t seem to work so well. Had to remove the higher RSI Timeframes. Now only running with 3m Timeframe and now it seems to be having good results. I also going to do two more tests in parallel: Using DMI + RSI without DCA and DMI against BTC. Just need to figure out how to do it so that the right script connects to the right bot/ftx sub account and don’t mess up the other tests.

        Like

    • If you drop down to the e2 micro instead of the default cpu they offer it’s only about $7 per month or less, depending on your usage.

      Like

      • It did amazing, topping out at 30% gains and more in a single day. However, an issue we’re seeing is with drawdowns at the end of the run, or on bounces. This can cause the script to close a red deal that would later turn a profit. For the now the best option is to manually rescue bots by setting the config to not close deals.

        Like

      • Hey Nick, the script that did amazing is the normal script you wrote about, or does it have any of the modifications mentioned in the comments?

        Like

      • No, it’s the same script that’s in the Github repository with no extra mods, not even the HTF validation. I did mention in the reply about the large drawdown which ate up most of those massive gains.
        I’m currently analyzing all the trades that happened with the script and looking at tweaking the bot settings to hopefully reduce those drawdowns.

        Like

      • So, how did everyone’s settings work in the last two/tree days? I had one day with a 20% return, followed by two red days that destroyed all the profits gained. I’m here scratching my head trying to understand what can I do to prevent it. Ideas?

        Like

      • Nice, I’m currently running the base script but with an RSI-7 for the 3min as a slight guide for entries. I was suffering a lot with huge red deals with the new config settings, so i turned those back to normal as well.

        Looking forward to what you find out!

        Like

      • Yeah, those RSI triggers really filter out the deals. Having said that, I’m running a multi-pair bot in 3Commas with only those settings as the trigger (so no script, all 3Commas). It only runs one deal at a time, but in the last 24 hours, it’s actually been doing quite well. I’m going to let it run for a few more days and see if it stays consistent.

        Like

      • Oh wait, are you setting the config like this?

        CLOSE_DEALS_WITH_BOT = False
        EARLY_CLOSE = True
        CLOSE_DEALS = True

        Or the original, like this?

        CLOSE_DEALS_WITH_BOT = True
        EARLY_CLOSE = True
        CLOSE_DEALS = False

        I’m asking cause it seems you changed the main code with the latter settings, so when you say you use the main code, do you mean the latter?

        Like

  27. Pedro, i mentioned this to Nick on his other post, run trading bots 24/7 with GCP…If you are looking for somewhere to host these scripts for free with up to 2 VMs with ample block storage you can try Oracle Cloud Infrastructure Always Free Tier (https://www.oracle.com/cloud/free/#always-free). I have used them for other projects. Haven’t used it for something like this as I am still trying to figure out how to convert this script to work on CBPro long strategy only (in the US and cant use FTX or do shorts).

    Might save you the $6 per month.

    Like

    • This is because the latest data row will contain an unfinished bar/candle. We’re typically grabbing bar/candle data 10 to 60 seconds after a timeframe/bar/candle is complete, so the last row has the current/unfinished candle which we can’t rely on.

      Like

  28. Hey Nick!

    So in the comments there have been many updates and proposed changes, I’d like to know if you are, or plan to test some of them to check which performs best over time.

    I’ve tested most, but not long enough each. What do you think?

    Thanks!

    Like

  29. Are you guys running short bots as well? I’m doing a little more backtesting tonight and tomorrow, then I’m going to go with the setting I’ve gotten so far. I did mention that the Stochastic RSI I wanted to impletment will result in fewer trades, but a higher win rate. I think I was using 1HR timeframe to look for entries. I’ll have to check again. BTW what does FTX charge for trading fees? I guess I have to check them out. I know Bybit charges .075% taker and 0% for maker (I think), which is one of the lowest I’ve seen so far. I will be making a script for this as well, but i wanted to get the Kucoin one online this weekend.

    Like

  30. Sorry Nick, I forgot to get back to you on the HTF SMA trend validation. I was using only one trend line and checking if the current trend was higher or lower than the previous. I ran the script with two SMA trend lines and 5 fast /16 slow seem to be the best settings with HTF set at 1HR timeframe. I’ve tested that across 6 different currencies with similar results. Also, I wanted to know if you have time this week to check out my create and adx_bot scripts for Kucoin. Since you have more experience in Python, I wanted you to just look over it real quick and see if there are any gotchas that I might’ve missed. I’m going to deploy it tomorrow and see how it runs. If anyone else wants to test it, I can send it to them as well.

    Like

  31. Oh and I’ve started playing with the Stoch RSI settings again. Before I left them stock, but after doing some research, I’ve found that at the 15min TF, you need to use less bar length. So I used the 1HR HTF RSI and reduced the Stoch and RSI length to 7(from 14), moved the K length to 1(from 3) and have gotten really good results as a entry validator. I have some screenshots from TV of performance that I’ve captured, but I’m not sure how to upload them here as they are from MS snipping tool.

    Like

    • I’ll test out your new scrip if you wanna share the settings and config.

      Plus you can share screenshots just by uploading pictures to imgur and copypasting the link to it on the comment’s chat box, it will appear as a pic.

      Like

  32. Good Morning any suggestion on how to get past this error ?

    Traceback (most recent call last):
    File “/home/aipythonbots/python-test-bot/adx_bot.py”, line 359, in
    open_positions = get_positions()
    File “/home/aipythonbots/python-test-bot/adx_bot.py”, line 116, in get_positions
    if ‘info’ in all_positions[0]:
    IndexError: list index out of range

    Like

    • Not much to report back. I did try changing the bot settings to front-load the deals – ie, only 4 SO’s and a higher martingale, and added a stop loss. It really didn’t help that much, and I saw some losses as a result. I’ve been really busy recently, but my next go would be in the opposite direction – ie deeper and less aggressive deals upfront, and no stop loss, and go to a higher time frame, like the 30 minute or 1 hr.
      I also need to clean up the htf validation check as it runs too slow and doubles the requests on the FTX API. Though, it looks like this validation check only helps with a small fraction of the deals. The ultimate issue is starting bots in sideways price action. I need to come up with another check/filter to check, though this could be as simple as raising the ADX limit from 15 to 25 (realizing this as I type this response – so maybe this will be my next check). This isn’t a setting in the config file (yet), but it’s an easy fix.
      Let me run this and see what happens.

      Like

  33. I loaded this up and it was a disaster. Personally I think that the problem is coin selection. I added all of the coins under 5 cents and those with a trading volume under 1mill but it did not respect my blacklist. I think going to delete the folder and start again with a fresh config. The bot settings are super super aggressive and realistically I would want to have different settings for the coins with low volume and low price. I think this will work a treat with the right coin selection.

    Like

    • Hi Jonny,
      Yeah, the script is proving to be very effective on strong trends, but bites back hard on reversals, or in sideways action – mostly because deals are closed quickly, and the 3Commas bots are always going to be heavier when in the negative since we DCA’ing down. I’m trying to come up with some different bot settings to minimize this, but so far the best option is to disable the bot early and not close any deals (both config settings).
      In terms of not respecting your blacklist, it sounds like you’re referring to the 3Commas blacklist. This will be ignored, for sure. You need to blacklist in the config file, then create your bots. If you change the blacklist in the config file after the bots are created, then those bots can still get triggered.
      Tbh, I’m not sure about the low-volume coins strategy. Low volume tends to give more erratic calculations of the indicators, which makes the script less predictable with more whipsaw action of the triggers.
      Having said that, I have been wrong before, lol, so go for it!

      Like

      • Sorry Nick, I meant I tired to blacklist the low volume, low price coins. Firstly I added all of the ftx coins to trading view and then identified the low volume coins and the low price coins and put them in the blacklist in the config.py file. I believe this is a major contributor to the poor performance. Alas, No joy it did not respect the blacklist. I believe from your response that it would only do this the first time?

        Like

      • Correct! Add the coins you don’t want to trade to the blacklist in the config file, then create the bots. The script should ideally NOT be activating the bots if they’re in the blacklist and a bot exists, but for some reason that check is not working so I need to look into that. As long as you create the bots first, essentially creating a new bot ID list (and bots), then they’ll be ignored.

        Like

  34. FYI I converted a trade to smart trade and blacklisted the coin. This has caused an error with the bot as it sees I have an open position and shutdown with an error on line 382 of adx_bot.py.

    Like

    • Yeah, I didn’t code the script to account for all the scenarios, including this one. I don’t typically convert to smart trades, but I do very often manually trade the positions out on ftx. For those, I stop the script and disable bots since in most cases it’s more than one that needs attention. Having said that, I’ll take a look and see why the blacklist didn’t block it – understanding that the config file is loaded when the script starts, and not after. So you would have to stop the script and start it again for the change to take effect. Either way I’ll have a look and see what can be done.

      Like

  35. Question for anyone on the group – has anyone encounter this error or have any idea what it needs to be fixed. Thank you in advance Traceback (most recent call last):
    File “/home/aipythonbots/python-test-bot/adx_bot.py”, line 359, in
    open_positions = get_positions()
    File “/home/aipythonbots/python-test-bot/adx_bot.py”, line 116, in get_positions
    if ‘info’ in all_positions[0]:
    IndexError: list index out of range

    Like

    • From this errr log, this all_positions is an empty array…so you might prevent this by check the len of this array before get any item in that array.
      if len(all_positions) > 0 and ‘info’ in all_positions[0]:

      Like

      • I’ve been reluctant to capture this with a check because there are other reasons why the array can be empty. Having the stack trace can sometimes help identify what the issue is, and it stops the script from calling for more deals when we might already be at max. One that has plagued the code in the past are breaking changes in the ccxt library updates. It’s a trade-off, but I intend to update the guide/post with some of these special requirements/pre-requisites in the near future.

        Like

    • This could be a couple of issues, but I think the most common two are a) the ccxt library version installed, and b) there’s never been any positions in that ftx sub-account before.
      For a) you could run sudo pip3 install cctx --upgrade, or a version of that (sudo may not be necessary, and your environment might be setupto just use pip).
      For b) you can manually start and close a deal in the ftx sub-account, per this comment.

      Like

  36. Hi Nick, how’s the HF development going? If you need help let me know. I’ve been reading on some trading books and i’m not sure if it’s the right move to close the deals when adx stars turning as it just mean that theres less strenght in the trend, not necessarily a price reversal. I was thinking make to take the bot start signal as actually a deal start and the oposite crossing of the dmi as a close, all with HF validation. Did you ever try that?

    Like

    • Hi Nick, how’s the HF development going?

      I haven’t touched it yet, at least not since the code branch I implemented. I’m planning on refactoring the code to be more efficient when I have some time. Though I’ve found the number of deals it actually validates against isn’t much.

      i’m not sure if it’s the right move to close the deals when adx stars turning as it just mean that theres less strenght in the trend, not necessarily a price reversal

      You’re correct, it doesn’t indicate the end of the trend, just a weakening. My goal with this was to, let’s say, end on a winning deal. That last deal, the one that goes red and takes back so much profits typically happens at the end of a trend or a reversal. Since the indicator is lagging, by deactivating the bot early, we’re front-running the trend reversal and hoping the deal closes out before the trend actually reverses. In some cases this means we miss a continuing trend, but I think it’s better to walk away with some profit than risking it all on a higher profit. This also gives some room for another coin that’s in a stronger trend to come into play. Again, it’s a trade off, but I think a necessary one given the high drawdowns.

      I was thinking make to take the bot start signal as actually a deal start and the oposite crossing of the dmi as a close, all with HF validation. Did you ever try that?

      For the most part this is what the bot is doing, except I’m starting the bot (not just a deal) on the dmi cross, and take profits on the way up. As a profit is taken and the deal ends, the bot automatically starts another deal. The bot is deactivated (not the deals) when the ADX slope goes negative. With EARLY_CLOSE, it’s stopped when the ADX slope becomes increasingly less and less, ie the last three slope readings are consecutively lower, essentially indicating a slowing trend. If you set the CLOSE_DEALS flag to true, this will close any open deals left on the bot when the dmi crosses. I hope that helps explain it a bit more.

      By the way, I have to say I have been using your triple RSI trigger on two multi-pair bots for the last week or so. I have one long and one short, trading one deal each, and 3x leverage. While the gains are not staggering (but still very reasonable), the consistency is outstanding. The long bot is very reliable, the short is still good, but I’ve had to rescue a couple deals. Overall, every day is green! Some days though, there are no deals, so the bot is very picky. If you don’t mind, I’d like to write a post about this setup in the near future. One more thing, you can’t really use this setting with a HTF validation, it won’t work. This is because the bot scalps on bounces/countertrends. In other words, you’re taking a long when you’re oversold on three time frames, meaning we’re in a downtrend. Very similar to how a QFL trigger works, and like the QFL, it works better in a downtrend. Because of this, your HTF validation would never allow a long to be taken since we’re relying on a downtrend.

      Like

  37. Hey again Nick! I’ve been testing the 25 ADX parameters for almost 4 days now. It started amazing with day 1 and 2 bringing $15 and $24 each on a $150 account, but day 3 Destroyed most of those profits with a $29 nuke, and day 4 is looking to be either another negative or null day,

    I’m gonna keep running it for a few more days, but I was curious if you had any success with a way to try and cut down those massive single losses. Cause the patter i’ve bene noticing is that while 80/90% of trades are wins, the 10% of losses are all catastrophic.

    Thanks!

    Like

    • Pedro clear explanation. I am on the same page. The script works fantastic. It has 70 to 85 % wins but 15 % losses have kill all the gains. What time zone and pairs are you seeing in your losses. My wins seem to In Asian time zone.

      Like

    • Hi Pedro,
      I haven’t tested the 25 ADX yet, but the results you’re seeing are promising. I think those drawdowns are really just a fact of life with the bots. I’ve mentioned it before, but when the bot is moving with the trend, it’s only winning on a small percentage of the used funds, while a loss would generally have triggered all SO’s. This means those losses are large compared to the wins. One option is to manually rescue the deals, so leave the early close on, but don’t let the bot close any deals. In many cases, the deal will close itself eventually, and in some you’ll have to manually bail the deal out. Just be careful though if you’re using leverage, you don’t want to get liquidated.
      Two other options I’ve yet to try:
      1 – Set the bot with more SO’s, so you’re DCA’ing down further, and more aggressively. This will mean your bots will use a ton more funds but would mean more deals close out eventually. Again, no leverage here, and don’t let the script close the deals, but still leave the early close on.
      2 – Treat the bot like a regular trade. In this scenario, your BO is the full amount you want to trade with, and your SO count will be zero. Set a stop loss at a reasonable percentage so your overall R:R ratio is above 1. As long as you keep winning more deals than you’re losing, and any R:R over 1 will be profitable. Basically, this is treating the deal like a regular trade, ie with an entry, a TP, and SL. If this works better, I’ll copy the script so it trades directly on the exchange, and you won’t need 3Commas.

      I’ve been busy the last couple of weeks with a new position at work, so the time spent on this has been limited recently, but still working on a few things here and there.

      Like

      • That’s alright Nick, no need to overwork yourself.

        However, how would I go about settings the code to give the bots a stop loss? Could you give me an example, and on where to implement it, if possible?

        Thanks!

        Like

  38. Hi Pedro,
    If you still need to set the stop loss, edit the config.py and add the stop loss % you want to use and run the Py3c_update.py script which will add the stop loss to your existing bots. I started testing yesterday with a 7% stop loss and from a total of 95 trades, 4 trades triggered the stop loss.
    Regards
    Louis

    Like

    • Thanks, but i’ve found that I can’t simultaneously use the triple RSI settings and a stop loss both. To activate the stop loss i need to run the update command, but said update also updates the rsi settings equally for long and short bots, when actually they should be different (30 and 70 rsi values)

      Is there any way out of this?

      Like

  39. Hi Nick,
    Thanks for sharing the article and project. Got me pretty excited. I also added a rsi check with your hft and adx validations when opening long or short positions.


    # Calculate RSI
    df['RSI'] = df.ta.rsi(close='Close', length=14, append=True)
    # Add values to a list
    stats.append(df.loc[df.shape[0] – 2, 'RSI'])
    return stats, trend_dir
    ## <<<<<<<<<<< START LOOP HERE >>>>>>>>>>>>>>>>>
    RSI = unfiltered_stats[6]
    if ADX > 25 and (ADX_Slope > 0 and ((DM_plus > DM_minus and ADX > DM_minus) or (
    ADX < DM_plus and ADX < DM_minus))) and DM_plus > DM_minus and RSI < 50 and trend_direction == "up":
    unfiltered_stats.append("long")
    unsorted_tradable_perps.append(unfiltered_stats)
    elif ADX > 25 and (ADX_Slope > 0 and ((DM_plus < DM_minus and ADX > DM_plus) or (
    ADX < DM_plus and ADX < DM_minus))) and DM_plus < DM_minus and RSI > 50 and trend_direction == "down":
    unfiltered_stats.append("short")
    unsorted_tradable_perps.append(unfiltered_stats)

    view raw

    gistfile1.txt

    hosted with ❤ by GitHub

    Have you tried this before?

    Like

    • Unfortunately no. The script does long and short bots, and the paper trading only does spot from what I can tell. It would likely take a fair amount of code re-work to get it to work on a paper account.

      Like

  40. Nick could you please help me as i got stuck. I got this response in the T-Mux screen.

    frank@cryptobot:~/3commas_bot$ python3 Py3c_update.py
    Traceback (most recent call last):
    File “/home/frank/3commas_bot/Py3c_update.py”, line 2, in
    import config
    File “/home/frank/3commas_bot/config.py”, line 1, in
    xyxy
    NameError: name ‘xyxy’ is not defined
    frank@cryptobot:~/3commas_bot$

    Like

    • Which bot are you working with?
      Your folder structure looks like you’re in the original 3Commas script, but you’re replying on the ADX script post. Unfortunately the scripts need different versions of the ccxt library, and this could be messing things up. Are you trying to update your bots for the original script, or the adx script?

      Like

      • Sure thing. Fill out the contact form here and I’ll get back to you. Make sure to include where you’re stuck, ie which part of the process, which script isn’t running, and any error messages. Looking forward to your message.

        Like

  41. Nick would it be possible to setup a online meet and give you acces to my VM so we can go settings together and setup the latest BOT. Beceause i am a newby to Python and i really like your setup. Ofcourse i am willing to pay for your time. Hope you want to help

    Like

Leave a reply to George Cancel reply