Let Python optimize the best stop loss and take profits for your TradingView strategy.

Overview

TradingView Machine Learning

TradeView is a free and open source Trading View bot written in Python. It is designed to support all major exchanges. It contains back testing, money management tools as well as strategy optimization by machine learning.

Disclaimer

This software is for educational purposes only. Do not risk money which you are afraid to lose. USE THE SOFTWARE AT YOUR OWN RISK. THE AUTHORS AND ALL AFFILIATES ASSUME NO RESPONSIBILITY FOR YOUR TRADING RESULTS.

We strongly recommend you to have coding and Python knowledge. Do not hesitate to read the source code and understand the mechanism of this bot.

Features

  • Based on Python 3.8+: The bot will work on any operating system - Windows, macOS and Linux.
  • SL/TP Generator: Let the bot decide what stop loss or take profit you should use.
  • Functions: A growing library of functions you can use to optimize your script.

Installation

#1. Download Pycharm, Firefox, and TradingView_Machine_Learning folder here.

PyCharm Community Edition

FireFox

TradingView_Machine Learning

#2. Extract Zip File And Open The Folder With Pycharm.

#3. Go to Terminal And type code below to get pip packages.

  • pip install beautifulsoup4
  • pip install selenium
  • pip install webdriver-manager
  • pip install numpy
  • pip install termcolor

#3. Go To functions folder in PyCharm, and click webdriver.py You'll need to put your firefox profile in that file to make sure Python can find your web browser.

  • profile = webdriver.FirefoxProfile(r'C:\Users\Robert\AppData\Roaming\Mozilla\Firefox\Profiles\kwftlp36.default-release')
  • if you need help finding firefox profile go to this website and copy the root directory folder into script.
  • it should look like this. "C:\Users\Robert\AppData\Roaming\Mozilla\Firefox\Profiles\kwftlp36.default-release"
  • Find Profile

#4. Go To Scripts Folder

  • In the scripts folder you'll find scripts to optimize stoploss, take profit, or both files.

#5. Click A Script And Run It.

Comments
  • Element can't be scrolled into view

    Element can't be scrolled into view

    So... Guys, I was trying to run the project and got some errors. The first one was that when searching for strategy_tester, there was no such element, I suppos,e since i got the following error:

    strategy_tester = driver.find_elements_by_xpath("//*[@class='title-1C5azoXt']")[2]
    IndexError: list index out of range
    

    Then I looked for the element name in the inspection window at firefox and found the right name (I guess):

    image

    It looks like now it started recognizing the element, but now i got this new error and I have no idea why. Can you guys help me?

    selenium.common.exceptions.ElementNotInteractableException: Message: Element <div class="title-37voAVwR"> could not be scrolled into view

    opened by JulioCesarAntonyFraga 15
  • Problem at startup

    Problem at startup

    Hello, I did everything as it says in your instructions, but when I press RUN, CMD starts working, but the program freezes. And in the end, such mistakes come out, tell me what to do.

    Could Not Click Strategy Tester Tab. Please Check web elements class name in commands.py file. Could Not click Overview Tab. Please Check web elements class name in commands.py file. Could not click settings button. Please check web_elements in commands.py file. Could not input tab button. Please check web_elements in commands.py file. Traceback (most recent call last): File "TradeViewGUI.py", line 153, in optimize_longs_shorts Optimize Longs Shorts.Long Short Script() File "scripts\OptimizeLongsShorts.py", line 21, in init self.run_script() File "scripts\OptimizeLongsShorts.py", line 37, in run_script self.click_enable_both_checkboxes() File "web_commands\commands.py", line 246, in click_enable_both_checkboxes

    IndexError: list index out of range

    8bc8ca5e5fed7d59a770ca218bd9dfe1

    opened by Andreymyski 12
  • two or more tradingview strategy parameters change simultaneously (enable two in the youtube video)

    two or more tradingview strategy parameters change simultaneously (enable two in the youtube video)

    Hi Robert, It will be very appreciated If you publish a script to do that.

    May be you can explain how to tailor the script to test our own strategies.

    Thanks in advance!

    opened by asyildiz3363 6
  • ModuleNotFoundError: No module named 'functions'

    ModuleNotFoundError: No module named 'functions'

    Hi TreborNamor,

    Same as issue 13 but do not see the fix? I pulled the ZIP down today.

    Is this an environment config issue?

    Cheers Data64X

    Traceback (most recent call last): File "C:/Users/ blah blah /TradingView_Machine_Learning-master/scripts/takeprofit_liner.py", line 4, in import click.py File "C:\Users\ blah blah \TradingView_Machine_Learning-master\scripts\click.py", line 8, in from functions.webdriver import driver ModuleNotFoundError: No module named 'functions'

    opened by Data64X 5
  • Question

    Question

    Hello, this is more a question rather than an issue. Is it possible to change this to test other strategies? I saw it somewhere but the github page does not exist. Also how fast is it to test 1000 cycles for example?

    opened by DriesVR1232 3
  • Index List Out of Range

    Index List Out of Range

    ====== WebDriver manager ====== Current firefox version is 92.0.1 Get LATEST driver version for 92.0.1 Driver [C:\Users\User.wdm\drivers\geckodriver\win64\v0.30.0\geckodriver.exe] found in cache Generating Max Profit For Stop Loss. Loading script...

    Traceback (most recent call last): File "TradeViewGUI.py", line 122, in optimize_longs_shorts name = obj.objectName() File "OptimizeLongsShorts.py", line 17, in init self.run_script() File "OptimizeLongsShorts.py", line 39, in run_script self.click_enable_both_checkboxes() File "my_functions.py", line 238, in click_enable_both_checkboxes long_checkbox = self.driver.find_elements_by_xpath("//*[@class='input-24iGIobO']")[0] IndexError: list index out of range

    looks like i have an issue in the segment of code suppose to read the checkboxes...

    opened by SWCBTCKid 3
  • A different issue

    A different issue

    First;y I get an error that it can't find the Functions. I fixed that by copying the scripts into the main folder directory and add a main.py to the funtions directory.

    Now I get this error. Capture

    I really don't understand what I have done wrong. I followed your instructions but it doesn't seem to work as yours does on Youtube.

    Thanks for your help. Awesome work by the way.

    opened by Grantmac75 3
  • ValueError: max() arg is an empty sequence

    ValueError: max() arg is an empty sequence

    Loading script... script has timed out. Traceback (most recent call last): File "C:\Users\MONSTER\OneDrive\Desktop\strateji\ML ile stop ve take profıt opt\scripts\stoploss_linear.py", line 77, in run_script(webdriver.driver) File "C:\Users\MONSTER\OneDrive\Desktop\strateji\ML ile stop ve take profıt opt\scripts\stoploss_linear.py", line 42, in run_script best_key = find.best_key() File "C:\Users\MONSTER\OneDrive\Desktop\strateji\ML ile stop ve take profıt opt\scripts\find.py", line 5, in best_key best_in_dict = max(profits, key=profits.get) ValueError: max() arg is an empty sequence

    opened by batuhan3526 3
  • can't find '__main__'  ???

    can't find '__main__' ???

    Hi first thank for the great work!!!

    I get this in pycharm:

    /home/mhi/anaconda3/envs/TradingView_Machine_Learning/bin/python: can't find '__main__' module in '/home/mhi/PycharmProjects/TradingView_Machine_Learning'
    
    Process finished with exit code 1
    

    in the linux terminal and conda enviroment:

    (TradingView_Machine_Learning) mhi@coha:~/PycharmProjects/TradingView_Machine_Learning$ python3 scripts/stoploss_linear.py 
    Traceback (most recent call last):
      File "scripts/stoploss_linear.py", line 3, in <module>
        from functions import click, webdriver, show_me, get, find
    ModuleNotFoundError: No module named 'functions'
    

    and that at the normal linux terminal:

    mhi@coha:~/PycharmProjects/TradingView_Machine_Learning$ python3 scripts/stoploss_linear.py 
    Traceback (most recent call last):
      File "/home/mhi/PycharmProjects/TradingView_Machine_Learning/scripts/stoploss_linear.py", line 3, in <module>
        from functions import click, webdriver, show_me, get, find
    ModuleNotFoundError: No module named 'functions'
    

    ok I'am new to pychame! I have to activate the conda enviroment manual in the pychame terminal and the webdriver-manager package can'tbeinstalled via conda only via pip.

    but the results from the normal linux-system terminal also failed all modulules are there install with pip in the os default interpreter path

    opened by m9tz 3
  • can't find #3, find folder

    can't find #3, find folder

    Hello, I have been looking for a find folder on pycharm, but there is no anymore ? Where do i need to paste my webfolder file ?

    I don't understand this very well ...

    If you could give me more info ? thx dries

    opened by driesdep 3
  • IndexError: list index out of range

    IndexError: list index out of range

    Could not click settings button. Please check web_element's in commands.py file. Could not input tab button. Please check web_element's in commands.py file. Traceback (most recent call last): File "TradeViewGUI.py", line 153, in optimize_longs_shorts OptimizeLongsShorts.LongShortScript() File "scripts\OptimizeLongsShorts.py", line 21, in init self.run_script() File "scripts\OptimizeLongsShorts.py", line 37, in run_script self.click_enable_both_checkboxes() File "web_commands\commands.py", line 246, in click_enable_both_checkboxes

    IndexError: list index out of range

    opened by KhalidAmine 1
Owner
Robert Roman
Full Stack Web Developer & Python Enthusiast!
Robert Roman
Code for "Learning the Best Pooling Strategy for Visual Semantic Embedding", CVPR 2021

Learning the Best Pooling Strategy for Visual Semantic Embedding Official PyTorch implementation of the paper Learning the Best Pooling Strategy for V

Jiacheng Chen 106 Jan 6, 2023
Recall Loss for Semantic Segmentation (This repo implements the paper: Recall Loss for Semantic Segmentation)

Recall Loss for Semantic Segmentation (This repo implements the paper: Recall Loss for Semantic Segmentation) Download Synthia dataset The model uses

null 32 Sep 21, 2022
An implementation for the loss function proposed in Decoupled Contrastive Loss paper.

Decoupled-Contrastive-Learning This repository is an implementation for the loss function proposed in Decoupled Contrastive Loss paper. Requirements P

Ramin Nakhli 71 Dec 4, 2022
Implement of "Training deep neural networks via direct loss minimization" in PyTorch for 0-1 loss

This is the implementation of "Training deep neural networks via direct loss minimization" published at ICML 2016 in PyTorch. The implementation targe

Cuong Nguyen 1 Jan 18, 2022
This is a simple backtesting framework to help you test your crypto currency trading. It includes a way to download and store historical crypto data and to execute a trading strategy.

You can use this simple crypto backtesting script to ensure your trading strategy is successful Minimal setup required and works well with static TP a

Andrei 154 Sep 12, 2022
Theano is a Python library that allows you to define, optimize, and evaluate mathematical expressions involving multi-dimensional arrays efficiently. It can use GPUs and perform efficient symbolic differentiation.

============================================================================================================ `MILA will stop developing Theano <https:

null 9.6k Dec 31, 2022
Theano is a Python library that allows you to define, optimize, and evaluate mathematical expressions involving multi-dimensional arrays efficiently. It can use GPUs and perform efficient symbolic differentiation.

============================================================================================================ `MILA will stop developing Theano <https:

null 9.6k Jan 6, 2023
Theano is a Python library that allows you to define, optimize, and evaluate mathematical expressions involving multi-dimensional arrays efficiently. It can use GPUs and perform efficient symbolic differentiation.

============================================================================================================ `MILA will stop developing Theano <https:

null 9.3k Feb 12, 2021
OCTIS: Comparing Topic Models is Simple! A python package to optimize and evaluate topic models (accepted at EACL2021 demo track)

OCTIS : Optimizing and Comparing Topic Models is Simple! OCTIS (Optimizing and Comparing Topic models Is Simple) aims at training, analyzing and compa

MIND 478 Jan 1, 2023
TensorFlow implementation for Bayesian Modeling and Uncertainty Quantification for Learning to Optimize: What, Why, and How

Bayesian Modeling and Uncertainty Quantification for Learning to Optimize: What, Why, and How TensorFlow implementation for Bayesian Modeling and Unce

Shen Lab at Texas A&M University 8 Sep 2, 2022
Open-L2O: A Comprehensive and Reproducible Benchmark for Learning to Optimize Algorithms

Open-L2O This repository establishes the first comprehensive benchmark efforts of existing learning to optimize (L2O) approaches on a number of proble

VITA 161 Jan 2, 2023
Official implementation for "Symbolic Learning to Optimize: Towards Interpretability and Scalability"

Symbolic Learning to Optimize This is the official implementation for ICLR-2022 paper "Symbolic Learning to Optimize: Towards Interpretability and Sca

VITA 8 Dec 19, 2022
🔮 A refreshing functional take on deep learning, compatible with your favorite libraries

Thinc: A refreshing functional take on deep learning, compatible with your favorite libraries From the makers of spaCy, Prodigy and FastAPI Thinc is a

Explosion 2.6k Dec 30, 2022
Sequential model-based optimization with a `scipy.optimize` interface

Scikit-Optimize Scikit-Optimize, or skopt, is a simple and efficient library to minimize (very) expensive and noisy black-box functions. It implements

Scikit-Optimize 2.5k Jan 4, 2023
Optimize Trading Strategies Using Freqtrade

Optimize trading strategy using Freqtrade Short demo on building, testing and optimizing a trading strategy using Freqtrade. The DevBootstrap YouTube

DevBootstrap 139 Jan 1, 2023
A fast Evolution Strategy implementation in Python

Evostra: Evolution Strategy for Python Evolution Strategy (ES) is an optimization technique based on ideas of adaptation and evolution. You can learn

Mika 251 Dec 8, 2022
An integration of several popular automatic augmentation methods, including OHL (Online Hyper-Parameter Learning for Auto-Augmentation Strategy) and AWS (Improving Auto Augment via Augmentation Wise Weight Sharing) by Sensetime Research.

An integration of several popular automatic augmentation methods, including OHL (Online Hyper-Parameter Learning for Auto-Augmentation Strategy) and AWS (Improving Auto Augment via Augmentation Wise Weight Sharing) by Sensetime Research.

null 45 Dec 8, 2022
CryptoFrog - My First Strategy for freqtrade

cryptofrog-strategies CryptoFrog - My First Strategy for freqtrade NB: (2021-04-20) You'll need the latest freqtrade develop branch otherwise you migh

Robert Davey 137 Jan 1, 2023