TreborNamor / TradingView-Machine-Learning-GUI

Embark on a trading journey with this project's cutting-edge stop loss/take profit generator, fine-tuning your TradingView strategy to perfection. Harness the power of sklearn's machine learning algorithms to unlock unparalleled strategy optimization and unleash your trading potential.
https://www.robertsportfolio.dev/
MIT License
756 stars 227 forks source link

Error on startup #64

Closed Justin-Schmitz closed 10 months ago

Justin-Schmitz commented 10 months ago

Hi - I know you have likely had to do this before and I apologise but it might be an error related to TradingView web elements moving.

Would you be able to fix this? It looks like an amazing project


Error from .exe

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 36, in run_script self.click_enable_both_checkboxes() File "web_commands\commands.py", line 286, in click_enable_both_checkboxes long_checkbox = self.driver.find_element(By.XPATH, "//span[contains(., 'Enable Long Strategy')]/preceding-sibling::span/input[@type='checkbox']") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "selenium\webdriver\remote\webdriver.py", line 831, in find_element File "selenium\webdriver\remote\webdriver.py", line 440, in execute File "selenium\webdriver\remote\errorhandler.py", line 245, in check_response selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //span[contains(., 'Enable Long Strategy')]/preceding-sibling::span/input[@type='checkbox'] Stacktrace: RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8 WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:189:5 NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:507:5 dom.find/</<@chrome://remote/content/shared/DOM.sys.mjs:132:16


error from .py


TimeoutException Traceback (most recent call last) d:\Documents\Trading\coding work\machine_learning\TradingView-Machine-Learning-GUI-master\TradingView-Machine-Learning-GUI-master\TradeViewGUI.py in line 153, in Main.optimize_longs_shorts(self) 150 if self.comboBox.currentIndex() == 0: 151 from scripts import OptimizeLongsShorts --> 153 OptimizeLongsShorts.LongShortScript()

File d:\Documents\Trading\coding work\machine_learning\TradingView-Machine-Learning-GUI-master\TradingView-Machine-Learning-GUI-master\scripts\OptimizeLongsShorts.py:21, in LongShortScript.init(self) 19 Main.init(self) 20 self.driver = self.create_driver() ---> 21 self.run_script()

File d:\Documents\Trading\coding work\machine_learning\TradingView-Machine-Learning-GUI-master\TradingView-Machine-Learning-GUI-master\scripts\OptimizeLongsShorts.py:36, in LongShortScript.run_script(self) 34 self.click_settings_button(wait) 35 self.click_input_tab() ---> 36 self.click_enable_both_checkboxes() 37 self.click_reset_all_inputs(wait) 38 self.click_ok_button()

File d:\Documents\Trading\coding work\machine_learning\TradingView-Machine-Learning-GUI-master\TradingView-Machine-Learning-GUI-master\web_commands\commands.py:291, in Functions.click_enable_both_checkboxes(self, long, short) 289 if long: 290 wait = WebDriverWait(self.driver, 10) --> 291 long_checkbox = wait.until(EC.presence_of_element_located((By.XPATH, "//span[contains(., 'Enable Long Strategy')]/preceding-sibling::span/input[@type='checkbox']"))) 292 if not long_checkbox.is_selected(): 293 action = ActionChains(self.driver)

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\selenium\webdriver\support\wait.py:95, in WebDriverWait.until(self, method, message) 93 if time.monotonic() > end_time: 94 break ---> 95 raise TimeoutException(message, screen, stacktrace)

TimeoutException: Message: Stacktrace: RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8 WebDriverError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:189:5 NoSuchElementError@chrome://remote/content/shared/webdriver/Errors.sys.mjs:507:5 dom.find/</<@chrome://remote/content/shared/DOM.sys.mjs:132:16

TreborNamor commented 10 months ago

Yes, I'll go ahead and take a look at tonight. I'll just need to update the web elements to get it working again. It shouldn't take too long to fix

On Tue, Dec 12, 2023, 3:54 PM Justin Schmitz @.***> wrote:

Hi - I know you have likely had to do this before and I apologise but it might be an error related to TradingView web elements moving.

Would you be able to fix this? It looks like an amazing project

Error from .exe

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 36, in run_script self.click_enable_both_checkboxes() File "web_commands\commands.py", line 286, in click_enable_both_checkboxes long_checkbox = self.driver.find_element(By.XPATH, "//span[contains(., 'Enable Long @.*** https://github.com/type='checkbox']")

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "selenium\webdriver\remote\webdriver.py", line 831, in find_element File "selenium\webdriver\remote\webdriver.py", line 440, in execute File "selenium\webdriver\remote\errorhandler.py", line 245, in check_response selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: //span[contains(., 'Enable Long @. https://github.com/type ='checkbox'] Stacktrace: @.://remote/content/shared/RemoteError.sys.mjs:8:8 WebDriverError @chrome://remote/content/shared/webdriver/Errors.sys.mjs:189:5 NoSuchElementError @chrome://remote/content/shared/webdriver/Errors.sys.mjs:507:5 @.*** https://github.com/chrome ://remote/content/shared/DOM.sys.mjs:132:16

error from .py

TimeoutException Traceback (most recent call last) d:\Documents\Trading\coding work\machine_learning\TradingView-Machine-Learning-GUI-master\TradingView-Machine-Learning-GUI-master\TradeViewGUI.py in line 153, in Main.optimize_longs_shorts(self) 150 if self.comboBox.currentIndex() == 0: 151 from scripts import OptimizeLongsShorts --> 153 OptimizeLongsShorts.LongShortScript()

File d:\Documents\Trading\coding work\machine_learning\TradingView-Machine-Learning-GUI-master\TradingView-Machine-Learning-GUI-master\scripts\OptimizeLongsShorts.py:21, in LongShortScript.init(self) 19 Main.init(self) 20 self.driver = self.create_driver() ---> 21 self.run_script()

File d:\Documents\Trading\coding work\machine_learning\TradingView-Machine-Learning-GUI-master\TradingView-Machine-Learning-GUI-master\scripts\OptimizeLongsShorts.py:36, in LongShortScript.run_script(self) 34 self.click_settings_button(wait) 35 self.click_input_tab() ---> 36 self.click_enable_both_checkboxes() 37 self.click_reset_all_inputs(wait) 38 self.click_ok_button()

File d:\Documents\Trading\coding work\machine_learning\TradingView-Machine-Learning-GUI-master\TradingView-Machine-Learning-GUI-master\web_commands\commands.py:291, in Functions.click_enable_both_checkboxes(self, long, short) 289 if long: 290 wait = WebDriverWait(self.driver, 10) --> 291 long_checkbox = wait.until(EC.presence_of_element_located((By.XPATH, "//span[contains(., 'Enable Long @.*** https://github.com/type='checkbox']"))) 292 if not long_checkbox.is_selected(): 293 action = ActionChains(self.driver)

File ~\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\selenium\webdriver\support\wait.py:95 https://file+.vscode-resource.vscode-cdn.net/d%3A/Documents/Trading/coding%20work/machine_learning/TradingView-Machine-Learning-GUI-master/TradingView-Machine-Learning-GUI-master/~/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0/LocalCache/local-packages/Python311/site-packages/selenium/webdriver/support/wait.py:95, in WebDriverWait.until(self, method, message) 93 if time.monotonic() > end_time: 94 break ---> 95 raise TimeoutException(message, screen, stacktrace)

TimeoutException: Message: Stacktrace: @.://remote/content/shared/RemoteError.sys.mjs:8:8 WebDriverError @chrome://remote/content/shared/webdriver/Errors.sys.mjs:189:5 NoSuchElementError @chrome://remote/content/shared/webdriver/Errors.sys.mjs:507:5 @. https://github.com/chrome ://remote/content/shared/DOM.sys.mjs:132:16

— Reply to this email directly, view it on GitHub https://github.com/TreborNamor/TradingView-Machine-Learning-GUI/issues/64, or unsubscribe https://github.com/notifications/unsubscribe-auth/AOHWMROYRISFKTRNUXHVZ4LYJDHB7AVCNFSM6AAAAABASFFHHGVHI2DSMVQWIX3LMV43ASLTON2WKOZSGAZTQNRQGQ3TQMQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>

Justin-Schmitz commented 10 months ago

You absolute legend!!!! I gave a small sponsor as a token of my massive thanks to you!!!

TreborNamor commented 10 months ago

You're welcome! I just checked the program and it appears to be functioning correctly on my system. I suspect you might have missed a step during the installation process, or the issue could be related to the TradingView script you're using. Are you trying the MACD/RSI TradingView script I created for you, or is it a custom script? Based on the error message, it seems like the script is having trouble locating the first text box in the picture. The program is crashing here.

image