BennyThadikaran / stock-pattern

A Python CLI tool to scan, detect, and plot stock chart patterns
GNU General Public License v3.0
162 stars 33 forks source link

no detection found on hourly daily csv #40

Closed sharjeel125 closed 5 months ago

sharjeel125 commented 5 months ago

why i am having no detection on btc hourly chart additionaly i tried on daily chart too but still no detection found correct me if i am doing anything wrong i follow your step written on readme.md

BTC-Hourly.csv BTC-Daily.csv

P.S : there are patterns on these csv's

image

BennyThadikaran commented 5 months ago

What you are seeing in the screenshot are warnings File not found followed by the filepath.

There are a couple of issues here.

SYM_LIST

In the user.json, the SYM_LIST is a list of stock symbols or Coin name or instrument name, one on each line.

btcusdt
aptusdt
dogeusdt

Also the list must match the filename. For example btcusdt-60 for a file named btcusdt-60.csv You are passing a CSV file containing OHLC data. I hope you get the problem.

Your OHLC files in Documents folder must be saved as lower case filenames. So BTC-Hourly.csv must be btc-hourly.csv. The reason being its easier to pass names in CLI without remembering the letter-casing.

py init.py --sym btc-hourly

OHLC data format

I checked the csv file you attached, the column names must be Date, Open, High, Low, Close and Volume. (Case sensitive). I dont know which volume matters to you (BTC or USD volume) just rename one to Volume.

Attached below is the corrected version of your BTC-daily.csv btc.csv

BennyThadikaran commented 5 months ago

If you need further clarification please let me know. I am running further checks. Will get back to you.

BennyThadikaran commented 5 months ago

A final issue was the Dates are sorted Newest to Oldest. The script expects dates in reverse order i.e Oldest to Newest. I wrote a quick script to resolve all the mentioned issues above.

  1. Save the below script as a python file in the Documents folder.
  2. Create a sym_list.txt file and add the names of the CSV files (.csv extension not required).
  3. Run the script. If all is well, delete the old CSV files.
  4. Make corrections to the config file as i mentioned earlier and run the scan. See screenshot below. Its all working now.
import pandas as pd
from pathlib import Path

DIR = Path(__file__).parent

sym_list = (DIR / "sym_list.txt").read_text().strip().split("\n")

for sym in sym_list:
    df = pd.read_csv(DIR / f"{sym}.csv")

    # Rename the columns 
    df.columns = [
        "unix",
        "Date",
        "symbol",
        "Open",
        "High",
        "Low",
        "Close",
        "Volume",
        "Volume USD",
    ]

    # Parse the Date column as Datetime
    df["Date"] = pd.to_datetime(df["Date"])

    # Set the Date column as index
    df = df.set_index("Date", drop=True)

    # Reverse the sort order
    df = df[::-1]

    # Save the file as lower case.
    df.to_csv(DIR / f"{sym.lower()}.csv")

And here is the result Screenshot from 2024-06-01 12-07-00

sharjeel125 commented 5 months ago

At first, I would like to thanks that you give your precious time to answer my query ,

Some suggestions :

Show how to use the repository with a simple example. Include commands and code snippets. Add screenshots or images to illustrate the steps.

Create a demo file (e.g., demo.py or demo.ipynb). In this file, showcase a test case or example use case. Ensure the demo is self-explanatory and covers typical use scenarios.

BennyThadikaran commented 5 months ago

Were you able to run and detect those patterns?

I already made some corrections in the README in the install instructions section. I will consider further changes over the weekend.

sharjeel125 commented 5 months ago

Thanks bro for help you are humble and kind god bless you

sharjeel125 commented 5 months ago

eurusd-4h.csv there are multiple patterns in above it detects nothing and one more thing it shows selection from 0 - 9 in user input pattern detection i tried all from 0 to 9 some numbers heading is different than its functionality like when i hit 5 to perform DBOT it perfom HNSU

BennyThadikaran commented 5 months ago

Hey, Thanks for pointing out the user input bug. I have fixed it and releasing shortly.

As for the CSV file provided - two issues

  1. The date order must be Oldest to Newest (at the bottom)
  2. The dates were also not sorted correctly

You need to run the below to rectify these issues (Using Pandas DataFrame)

df = df.sort_index()

Attached is the corrected file. I still could not detect any patterns. A possible reason could be the way pivots are detected https://github.com/BennyThadikaran/stock-pattern/wiki/Pattern-Algorithms#identifying-pivots

eurusd-4h.csv

sharjeel125 commented 5 months ago

image

bro i am just loving to explore your updated repo and what it offers by checking different things you probably think that i am auditing 😸 but i am not just checking all the patterns if your repo found all the patterns correctly on every time frame so what going wrong here in your showcase pictures the lines are properly structured but when i try on hns the right shoulder last line is not made and here double bottom first line is not made as shown in picture

ba.csv [Uploading all-daily.json…]()

BennyThadikaran commented 5 months ago

I am happy if you're auditing my code 😛

The image you're referring from the readme is an old screenshot. The missing segment was just an aesthetic not necessary for the pattern.

I was using the previous pivot to draw that line. But sometimes the starting line was drawn from a pivot low. Instead of adding extra code to remedy it, i decided to drop it.

As for the HNS can you provide a screenshot.

I suggest you open a discussion here https://github.com/BennyThadikaran/stock-pattern/discussions

Also check this discussion https://github.com/BennyThadikaran/stock-pattern/discussions/50

On 12 June 2024 19:37:01 UTC, Muhammad Sharjeel @.***> wrote:

image

bro i am just loving to explore your updated repo and what it offers by checking different things you probably think that i am auditing 😸 but i am not just checking all the patterns if your repo found all the patterns correctly on every time frame so what going wrong here in your showcase pictures the lines are properly structured but when i try on hns the right shoulder last line is not made and here double bottom first line is not make as shown in picture

[Uploading ba.csv…]()

-- Reply to this email directly or view it on GitHub: https://github.com/BennyThadikaran/stock-pattern/issues/40#issuecomment-2163765747 You are receiving this because you commented.

Message ID: @.***>