# Hercules GUS-V5 for TradingView

These Pine Script v6 files are intentionally separate from Hercules' web chart:

- `GUS-V5-Indicator.pine` is the visual, non-repainting indicator. It combines WaveTrend signals with EMA structure, Supertrend, RSI, MACD, ATR, Bollinger width, session VWAP, confirmed markers and JSON alert events.
- `GUS-V5-Strategy.pine` is the backtest/forward-test counterpart. It models 0.08% commission on each fill, two ticks of slippage, next-tick order processing, ATR brackets and approximate risk-based sizing.

## Safety contract

- Signals use standard exchange OHLC and wait for `barstate.isconfirmed`.
- Both scripts request `ticker.standard()` OHLC with `lookahead_off`, so Heikin Ashi may remain a visual chart style without becoming the signal source. The strategy also enables standard-OHLC fills in TradingView's broker emulator.
- No higher-timeframe request is used. The standard-ticker request stays on the active timeframe and never uses lookahead, so future bars cannot leak into the past.
- The quantity calculation is an approximation. TradingView does not know MEXC contract-size and volume-step rules for every instrument; Hercules' server preview remains authoritative.
- Commission and slippage are configured in the `strategy()` declaration and can also be reviewed in Strategy Properties. Funding, latency, partial fills and order-book impact are not simulated.
- Webhook payloads explicitly use `"environment":"PAPER"`. Hercules does not currently expose a public webhook receiver; do not point these alerts at a LIVE execution endpoint.

## TradingView setup

1. Open the matching MEXC perpetual chart in TradingView. Normal candles are best for auditing; Heikin Ashi may be used visually because both scripts explicitly source standard OHLC.
2. Paste one script into Pine Editor and add it to the chart.
3. For the indicator, create an alert on `GUS-V5 LONG confirmed`, `GUS-V5 SHORT confirmed`, or `Any alert() function call`.
4. For the strategy, use `Order fills and alert() function calls` if both simulated fills and signal events are needed.
5. Choose `Once per bar close` and inspect the JSON before adding any webhook URL.

Example payload:

```json
{
  "schema": "hercules.signal.v1",
  "strategy": "GUS-V5",
  "version": "1.0.0",
  "side": "LONG",
  "symbol": "MEXC:BTCUSDT.P",
  "timeframe": "60",
  "price": 65000.0,
  "barTime": 1786752000000,
  "environment": "PAPER"
}
```

Pine Script creates alert events; the running alert itself is created in TradingView's chart UI and runs on TradingView infrastructure.
