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

Element can't be scrolled into view #1

Closed JulioCesarAntonyFraga closed 3 years ago

JulioCesarAntonyFraga commented 3 years ago

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

JulioCesarAntonyFraga commented 3 years ago

Looks like i had to change the elemment index to 1 instead of 2. Now I got some other elemments that I have to fix the name the script is looking for.

JulioCesarAntonyFraga commented 3 years ago

The elements the script is looking for are not correct. They may have changed. Can you guys please update?

Andddyyyyy commented 3 years ago

I'm having exactly the same issue as above, if the repo can be updated that'd be amazing!

tmmatherne commented 3 years ago

Same here.... incorrect xpath It’s possible the class=“title-xxx” is unique to the stock being tested

I wouldn’t know how to fix this but sure TreborNamor could

JulioCesarAntonyFraga commented 3 years ago

I've been trying to fix it, and I kind of understood which elements they're trying to choose and all. At some point, it just can't find the element ".table-roles" or something like that ( I don't really remember the name). It just doesn't find it. I did tests, I replaced the code with the correct elements names, but in the end, this element just can't be find (even if it exists, and it actually does, at least it is shown in the page source code).

tmmatherne commented 3 years ago

I’ve managed to get it working. change the xpath location as you pointed out in your comment title- and also the innerInput one as well. Make sure you are logged into TradingView and that you only have stoploss checked within settings when running stoploss script.

JulioCesarAntonyFraga commented 3 years ago

I’ve managed to get it working. change the xpath location as you pointed out in your comment title- and also the innerInput one as well. Make sure you are logged into TradingView and that you only have stoploss checked within settings when running stoploss script.

I've made an account but the script always open the browser with it logged out.

I will try to apply the things you told me tomorrow. Thank you for the help.

Could help me with the account stuff though?

tmmatherne commented 3 years ago

Ahh yes. I had that same issue as well. Here is the fix for that. Go to Firefox address bad and type the following

about:preferences#privacy The button next to History, select Use Custom Settings.

Turn off Always Use Private Browsing Mode Turn on Remember My Browsing And Download History At the bottom of the page, turn on Clear History When Firefox Closes. At the far right, press the Settings button. Turn on ONLY Cache and Form And Search History leaving the others off.

This will keep you logged into tradingview

JulioCesarAntonyFraga commented 3 years ago

Ahh yes. I had that same issue as well. Here is the fix for that. Go to Firefox address bad and type the following

about:preferences#privacy The button next to History, select Use Custom Settings.

Turn off Always Use Private Browsing Mode Turn on Remember My Browsing And Download History At the bottom of the page, turn on Clear History When Firefox Closes. At the far right, press the Settings button. Turn on ONLY Cache and Form And Search History leaving the others off.

This will keep you logged into tradingview

Thank you, man! I appreciate your help.

Andddyyyyy commented 3 years ago

Thanks for the help guys! I'm getting top to the point now ehere it will open the settings box to upodate the Stop loss/Take profit values but get this error:

Loading script... script has timed out. Traceback (most recent call last): File "C:\Users\Andyf\OneDrive\Desktop\TradingView_Machine_Learning-master\scripts\takeprofit_linear.py", line 76, in run_script(webdriver.driver) File "C:\Users\Andyf\OneDrive\Desktop\TradingView_Machine_Learning-master\scripts\takeprofit_linear.py", line 41, in run_script best_key = find.best_key() File "C:\Users\Andyf\OneDrive\Desktop\TradingView_Machine_Learning-master\functions\find.py", line 5, in best_key best_in_dict = max(profits, key=profits.get) ValueError: max() arg is an empty sequence

Any ideas?

JulioCesarAntonyFraga commented 3 years ago

Ahh yes. I had that same issue as well. Here is the fix for that. Go to Firefox address bad and type the following

about:preferences#privacy The button next to History, select Use Custom Settings.

Turn off Always Use Private Browsing Mode Turn on Remember My Browsing And Download History At the bottom of the page, turn on Clear History When Firefox Closes. At the far right, press the Settings button. Turn on ONLY Cache and Form And Search History leaving the others off.

This will keep you logged into tradingview

Hey man! I can't manage to open the browser already logged in. I've done the stuf`f you said, but it just doesn't work. I have saved the account in the account settings at firefox but nothing sems to work. Do you have any idea?

tmmatherne commented 3 years ago

Did you save the root Directory or Local? Not sure if matters but I used the root directory image

batuhan3526 commented 3 years ago

Hello Are u guys got this error ? Could u help me ? error error3 @tmmatherne @JulioCesarAntonyFraga @Andddyyyyy

TreborNamor commented 3 years ago

hello everyone, it looks like the elements on Tradingview had changed. I updated the elements and added some extra fixes to script. If you guys are still having problems please download the new repository.

tmmatherne commented 3 years ago

thanks @TreborNamor