Comments (9)
@AtakanPehlivanoglu This is your project so feel free to fix it the way you want, I'll be happy as long as it works.
from tradingview-optimizer-extension.
Hello @iljamaki ,
I have recently tested this issue using the latest extension v1.0.2
and didn't face any issues you mentioned.
Here are my reports regarding this test,
from tradingview-optimizer-extension.
@AtakanPehlivanoglu Ok so that suggests this is something that depends on the environment. I also use version 1.0.2 and the issue exists there
As I said earlier, I also tried cloning the repository locally as I wasn't sure which commit version 1.0.2 was made of, but also the latest commit 0b49f6f had the same problem.
My browser is Chrome Version 112.0.5615.121 (Official Build) (64-bit) and the OS is Windows 11 Home 22H2. Is there any other information I can provide you with to help resolve the issue?
from tradingview-optimizer-extension.
@iljamaki Well that's interesting for sure,
Could you please run the script below in your Chrome console while you are on tradingview.com?
This script is directly from the latest extension version and I'm not sure how this code block can differ from one environment/browser to another since I have already tested it with multiple devices(macOS/Windows)
My Chrome version is Version 112.0.5615.138 (Official Build) (64-bit)
This code block matches the first innerWrap
and group
with wildcard matching and looks for the value
of the first element which is the time period
and I'm not sure how this can differ since this querySelector
directly being used on TradingView DOM.
var timePeriodGroup = document.querySelectorAll("div[class*=innerWrap] div[class*=group]")
if (timePeriodGroup.length > 0){
strategyTimePeriod = timePeriodGroup[1].querySelector("div[class*=value]")?.innerHTML
}
https://github.com/OptiPie/tradingview-optimizer-extension/blob/main/script.js#L88
from tradingview-optimizer-extension.
One additional piece of information I would ask for,
Which tradingview subdomain are you using? I have also tested and validated on tr,ru,pl
subdomains and worked fine but maybe this could be also the issue, just for sanity check
@iljamaki
from tradingview-optimizer-extension.
@AtakanPehlivanoglu It outputs '1m' while 30m is selected:
I'm using the main domain "tradingview.com".
I can try to take another look into the element structure of the page if I find some time for it.
from tradingview-optimizer-extension.
@AtakanPehlivanoglu Okay I looked into it a bit more and as you may already have guessed from the screenshot I pasted above, the code only works if the user has not set any favorite timeframes.
This seemed to work regardless although there may be better ways of doing it:
var timePeriodGroup = document.querySelectorAll("div[class*=innerWrap] div[class*=group]")
if (timePeriodGroup.length > 1){
selectedPeriod = timePeriodGroup[1].querySelector("button[aria-checked*=true]")
strategyTimePeriod = (selectedPeriod ? selectedPeriod : timePeriodGroup[1]).querySelector("div[class*=value]")?.innerHTML
}
from tradingview-optimizer-extension.
@iljamaki great catch, I also realized that from the screenshot.
Imo your code works just fine for both cases(favorite and no favorite time period selection).
I have just refactored it a little bit since I would prefer more readable code over less code like a single if statement.
var timePeriodGroup = document.querySelectorAll("div[class*=innerWrap] div[class*=group]")
if (timePeriodGroup.length > 1) {
selectedPeriod = timePeriodGroup[1].querySelector("button[aria-checked*=true]")
// Check if favorite time periods exist
if (selectedPeriod != null) {
strategyTimePeriod = selectedPeriod.querySelector("div[class*=value]")?.innerHTML
} else {
strategyTimePeriod = timePeriodGroup[1].querySelector("div[class*=value]")?.innerHTML
}
}
When we are aligned with this, I can open a new branch and merge/deploy new version for this
from tradingview-optimizer-extension.
Update:
New version v1.0.3
is pushed to the Chrome Store.
Whenever it's approved by Chrome Store, new version will be available for use.
Special thanks to the @iljamaki and @Daemon0x00000000 for their contributions to the project.
from tradingview-optimizer-extension.
Related Issues (15)
- Fix - strategySymbol query selector due to Tradingview updates HOT 3
- Time period value in the report is empty due to changes made on tradingview.com HOT 1
- Optimization of floating point value is broken HOT 4
- Ability to pick which input fields to optimize (Enhancement Request) HOT 2
- Optimizer going beyond parameter inputs (Bug?) HOT 2
- [Enhancement] - Build / save report HOT 1
- Nothing works right HOT 1
- Ability to stop process and get partial report HOT 1
- Troubleshooting - Step size doesn't work correctly HOT 5
- Ability to test on Watchlist and timeframe HOT 2
- Still running ignoring stop parameter HOT 3
- Deep Backtesting HOT 7
- MutationObserver not firing HOT 2
- Would be great to optimize negative values for short trades. For example: If the angle of inception is between 0 and -3 degrees. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tradingview-optimizer-extension.