Trend Parser — How to Run & Use | Broxynet
Now Live · Trend Parser

TrendParser

A lightweight Node.js script that reads a JSON file of trading records, evaluates each one against 45 buy & sell conditions and reversals, then writes a complete statistical report to disk. Here is how to set it up, run it, and read the results.

1Node.js Script
45Buy & Sell Tests
2Data Folders (in / out)
100%Offline · No Keys
What It Does

Read the Data, Test Every Condition

The parser turns a raw export of strategy records into clear statistics and condition matches — no servers, no API keys.

📊

Numeric Statistics

For each BUY and SELL dataset it computes the average, high and low of every numeric field — trend scores, angle values, moving-average signals and more.

🧮

State Percentages

String fields such as mode, EMA alignment, EMA momentum and direction are broken down into counts and percentages so you can see how the market behaves over time.

🎯

Condition Engine

23 BUY conditions and 22 SELL conditions are evaluated against the original records, reporting how many records match each rule and by what percentage.

🔁

Reversal Detection

Six reversal tests (three per side) compare each record against the previous chronological one to catch bullish↔bearish transitions and score changes.

⚙️

Safe & Deterministic

Every value is validated before use, every test runs inside a try/catch, and the same input always produces the same output. Nothing is written back to your source data.

📁

Clean Output File

Results are saved as a single, pretty-printed JSON file in the output folder — with records, statistics and condition analysis grouped under buy and sell.

Setup & Run

Three Steps to a Report

Once Node.js is installed and your data file is in place, running the parser takes one command.

01

Install Node.js

Node v18 or newer is all you need. Verify with node –version. No npm packages are required.

02

Place Your Data File

Put <exchange>-<pair>-state.json in the json/ folder next to the script. See “Input Format” below.

03

Run & Answer Two Prompts

Start the script, then type the exchange name and trading pair when asked. It reads the file, runs every test, and writes the report.

trend-parser — run
$ node trend-parser.js
 
==============================================
TREND DATA PARSER
==============================================
 
Exchange name: kraken
Trading pair (example USD-BTC): USD-BTC
 
Looking for: json/kraken-USD-BTC-state.json
File found.
Trend records found: 1482
BUY records: 731
SELL records: 751
📥

Where it reads from

The script looks for json/<exchange>-<pair>-state.json, relative to the folder where you run it. The exchange and pair come straight from your two prompts (the pair is upper-cased automatically).

📤

Where it writes to

It creates the test/ folder if needed and saves test/<exchange>-<pair>-<timestamp>-parsed.json. It never modifies your original file.

Exact commands

Run the script from the folder that contains both json/ and trend-parser.js:

$ node trend-parser.js

The folder layout the program expects:

my-project/ ├── trend-parser.js ← the script (run from here) ├── json/ ← input files live here │ └── kraken-USD-BTC-state.json └── test/ ← created automatically; reports are written here

Tip: if your data file uses a different name, the parser will not find it — keep the exact <exchange>-<pair>-state.json naming. The exchange you type must match the first part of that filename.

Input Format

What the JSON File Must Contain

The program reads one path in your file: $ .customStratStore.trendData, which must be a non-empty array of records.

🗂️

File & Location

Where the parser looks and what it needs inside
  • pathjson/<exchange>-<pair>-state.jsonResolved relative to the folder you run Node from.
  • dataRoot.customStratStore.trendDataMust be an array of record objects; an empty or missing array is a hard error.
🔢

Numeric Fields

Average / high / low are computed for these
  • trendShortEMA · trendMediumEMA · trendLongEMAnumberShort / medium / long moving-average values.
  • trendScore · dirScore · priceScore · movingAveScorenumberCore directional and momentum scores used by most conditions.
  • confirmationScore · changePercentnumberConfirmation strength and percent change.
  • highAngle · lowAngle · angleDiff · chunksAveragenumberAngle metrics; angleDiff drives the threshold conditions.
🏷️

State Fields

Counts & percentages are computed for these strings
  • modestringStrategy mode of the record.
  • emaAlignmentbullish / bearishEMA alignment state used by EMA confirmation conditions.
  • emaMomentumimproving / worseningEMA momentum trend, compared against the previous record for reversals.
  • directionconverging up · converging down · divergingUp · divergingDownThe dominant state every buy/sell condition checks first.
📈

Voltrend & Signals

Nested object and boolean flags the tests read
  • voltrend.trendDirectionup / downVolume trend direction, used by the volume-confirmation conditions.
  • voltrend.increasing · decreasingnumber (counters)Preserved per record only — intentionally NOT averaged or percented.
  • headAndShouldersbooleanTrue when a Head & Shoulders pattern is detected (SELL side).
  • reverseHeadAndShouldersbooleanTrue when a reverse H&S pattern is detected (BUY side).

Example of one trend record

{ “id”: 1042, “time”: 1759872000, “type”: “buy”, “mode”: “normal”, “trendShortEMA”: 61432.10, “trendMediumEMA”: 60980.44, “trendLongEMA”: 59710.02, “trendScore”: 4, “dirScore”: 2, “priceScore”: 3, “movingAveScore”: 1.5, “confirmationScore”: 2, “changePercent”: 0.84, “direction”: “converging up”, “emaAlignment”: “bullish”, “emaMomentum”: “improving”, “highAngle”: 12.3, “lowAngle”: -6.1, “angleDiff”: 5.7, “chunksAverage”: 0.42, “headAndShoulders”: false, “reverseHeadAndShoulders”: true, “voltrend”: { “increasing”: 9, “decreasing”: 3, “trendDirection”: “up” } }

Records are split by the type field: “buy” records feed the BUY analysis and “sell” records feed the SELL analysis. Records are sorted chronologically by time before any reversal test runs.

Output & Results

What You Get Back

A summary prints to the terminal, and a full report is saved as JSON. Here is exactly how to read it.

trend-parser — output
BUY CONDITIONS
BUY 1. Overall bullish agreement: 412/731 (56.3611%)
BUY 2. Strong bullish agreement: 188/731 (25.7182%)
BUY 10. Strong bullish angle: 96/731 (13.1327%)
BUY 18. Reverse H&S detected: 54/731 (7.3871%)
 
BUY REVERSALS
BUY REVERSAL 1. Bearish → bullish transition: 37/731 (5.0616%)
 
SELL CONDITIONS
SELL 1. Overall bearish agreement: 439/751 (58.4554%)
SELL 10. Strong bearish angle: 61/751 (8.1225%)
SELL 17. Head & Shoulders detected: 42/751 (5.5925%)
 
PARSING COMPLETE
Exchange: kraken
Pair: USD-BTC
Total records: 1482
BUY records: 731
SELL records: 751
 
Output:
test/kraken-USD-BTC-1759872045123-parsed.json
✅

Terminal Summary

What prints to your screen
  • matches/samples (x%)per conditionHow many of that side’s records satisfy each rule, as a count and percentage.
  • BUY / SELL blocksconditions + reversalsPrinted in four groups: BUY conditions, BUY reversals, SELL conditions, SELL reversals.
📄

The Output JSON

Structure of the saved report
  • exchange · pair · sourceFile · generatedAtmetadataWhich file was parsed and when the report was created.
  • settings.angleThreshold5The custom angle threshold used by BUY #11 and SELL #10.
  • totalRecords · buyRecords · sellRecordscountsTotal records and the split between sides.
  • buy / sellrecords + statistics + conditionAnalysisEach side holds parsed records, full statistics, and every condition’s matches & matching record ids/times.
🧭

How to Interpret

Reading the numbers correctly
  • Percentage = share of that sideof BUY or SELL records onlyA 56% on BUY #1 means 56% of all BUY records met that rule — not 56% of everything.
  • Reversals need historyprevious record requiredA reversal compares a record to the one immediately before it in time, regardless of that side’s type.
  • Conditions use raw recordsnot the statisticsRules are tested against original data, so results stay exact and reproducible.

If it doesn’t run

ERROR: JSON file was not found. → Check json/<exchange>-<pair>-state.json exists (name must match your prompts). ERROR: $.customStratStore.trendData was not found or is not an array. → Open the file and confirm that path contains a non-empty record array. ERROR: trendData exists but contains no records. → The array is empty — export fresh data.

Each failure prints a clear reason and stops with exit code 1. Nothing is written to disk when an error occurs, so your source file stays untouched.

Check out our list of tool guides

Learn about each broxynet tool and how to use them to support your broxynet-V1 license or develop your own tools. Dont own broxynet-V1 for your Gunbot Defi? See what it can do for you.

Reference — Files

Download & Verification

Verify the integrity of your download using the SHA-256 checksum below.

SHA-256: 31bb12051377ab08ce80eb54ee2802e42449b79d5c5a319cef77a9ec9b7a77b8
MD5: a13ac413d7c6ffc53f647f3106090c72
Download
This software is provided “as is” for testing and development purposes only. No liability is assumed by the developer or Broxynet for any resulting losses, damages, or misuse. Use of this CLI is entirely at your own risk — you are responsible for safeguarding your credentials and ensuring compliance with your exchange and Gunbot terms of service.