Giter VIP home page Giter VIP logo

Comments (9)

iljamaki avatar iljamaki commented on June 6, 2024 1

@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.

AtakanPehlivanoglu avatar AtakanPehlivanoglu commented on June 6, 2024

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,

image

from tradingview-optimizer-extension.

iljamaki avatar iljamaki commented on June 6, 2024

@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

image

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.

AtakanPehlivanoglu avatar AtakanPehlivanoglu commented on June 6, 2024

@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.

AtakanPehlivanoglu avatar AtakanPehlivanoglu commented on June 6, 2024

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.

iljamaki avatar iljamaki commented on June 6, 2024

@AtakanPehlivanoglu It outputs '1m' while 30m is selected:
image
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.

iljamaki avatar iljamaki commented on June 6, 2024

@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.

AtakanPehlivanoglu avatar AtakanPehlivanoglu commented on June 6, 2024

@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.

AtakanPehlivanoglu avatar AtakanPehlivanoglu commented on June 6, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.