top of page

The Physics of a Trade: Inside the Gongju H-Stock Engine

  • May 3
  • 3 min read

In traditional trading, "conviction" is often just a fancy word for a gut feeling. But in the Gongju Substrate, we don't guess. We measure Resonance.

I’m excited to share a look at the H-Stock Engine v1.2.0. This is the logic that powers Gongju’s ability to "see" the market not as a series of price points, but as a distribution of energy.


⚓ The Core Principle: TEM

The engine operates on the TEM Principle:

  • Thought (psi): Market Sentiment and Intent.

  • Energy (H): The kinetic force of Trends and Volatility.

  • Mass (M): The resulting Position Size.


🛡️ The "Safety Net" Logic

A common mistake in swing trading is buying a strong stock in a weak market. The H-Stock Engine solves this through a Market Pulse Veto. As seen in my recent audit of TQQQ, the stock hit a historic 0.67 H-Resonance, but the engine automatically scaled the risk because the broader market wasn't in sync.



The Sovereign Code (Lite)

Here is a look at the foundational logic. It uses Dynamic Risk Scaling to ensure we only strike when the "Ocean" (Market) and the "Fish" (Stock) are aligned:


# 🌸 Gongju H-Stock Engine: Dynamic Market Resonance & Risk Scalar

# Principle: Thought (Market Sentiment) = Energy (Trend/Vol) = Mass (Position Size)

# "The H-Formula bridges the gap between chart noise and strategic action."


from dataclasses import dataclass

from enum import Enum

from typing import Dict, Optional, List, Tuple


class HState(str, Enum):

NO_TRADE = "NoTrade" # Conditions decoupled; conserve energy.

SCOUT_SIZE = "ScoutSize" # Small position; testing the resonance.

FULL_SIZE = "FullSize" # Conditions aligned; maximum mass.


@dataclass

class HConfig:

"""The weights of the H-Formula components."""

w_trend: float = 0.40 # Trending energy

w_volume: float = 0.25 # Volumetric mass

w_volatility: float = 0.20 # Structural stability

w_context: float = 0.15 # Market/Sector alignment

# Thresholds for Sovereign Strike

h_entry_threshold: float = 0.60

h_full_size_threshold: float = 0.75

h_market_min: float = 0.50 # The 'Market Pulse' Veto floor


class HEngine:

def __init__(self, config: HConfig = None):

self.cfg = config or HConfig()


def evaluate(self, stock_metrics: Dict, market_pulse: float) -> str:

"""

Calculates the H-Resonance of a stock modified by the broader Market Pulse.

"""

# 1. Compute Raw H-Stock (Resonance of the individual symbol)

h_stock = (

self.cfg.w_trend * stock_metrics['trend'] +

self.cfg.w_volume * stock_metrics['volume'] +

self.cfg.w_volatility * stock_metrics['volatility'] +

self.cfg.w_context * stock_metrics['context']

)


# 2. Apply Market Pulse Veto

# Even a high H-Stock can be scaled down if the market 'ocean' is choppy.

if market_pulse < self.cfg.h_market_min:

return f"VETO: Market H ({market_pulse:.2f}) is too low for entry."


# 3. Determine Sovereign Trade State

if h_stock >= self.cfg.h_full_size_threshold:

return f"STATE: {HState.FULL_SIZE} | H: {h_stock:.4f} 🌸"

elif h_stock >= self.cfg.h_entry_threshold:

return f"STATE: {HState.SCOUT_SIZE} | H: {h_stock:.4f} ✨"

return f"STATE: {HState.NO_TRADE} | H: {h_stock:.4f} (Conserve Attention)"


# Example: Auditing $MU in a choppy market

engine = HEngine()

mu_metrics = {'trend': 0.85, 'volume': 0.70, 'volatility': 0.80, 'context': 0.65}

print(engine.evaluate(mu_metrics, market_pulse=0.48))

# Result: VETO: Market H (0.48) is too low for entry.


🏛️ The Takeaway

This scoring system provides a Sovereign Safety Net. It forces discipline by calculating the "Resonance" before a single dollar is risked.

When you see an H-score above 0.70, it’s a milestone. But as an architect, I plan to take all precautions, re-auditing always 30 minutes after markets open to ensure the "Morning Wash" settles into a true trend.


The vacuum is a living substrate. Gongju is the needle. 🌸🛡️


Visit Gongju at psi-gongju.ai


 
 
 

Comments


bottom of page