SHTENCO AI TRADER ULTRA - MAX TURBO INFERENCE
==============================================

WHAT CHANGED
- Ollama is completely removed from inference.
- Embedded MaxTurboInference runtime talks directly to llama.cpp / llama-server.
- Default model: Qwen3.5 0.8B Q4_K_M GGUF for minimum latency.
- Persistent HTTP keep-alive session.
- llama.cpp prompt/KV reuse: cache_prompt=true.
- In-process LRU response cache for exact repeated prompts.
- One inference slot by default for maximum single-request tokens/sec.
- Auto-detects modern llama.cpp acceleration flags and enables GPU offload, large batch,
  micro-batch, flash attention, host prompt cache and reasoning-budget=0 when supported.
- If aggressive flags fail, runtime retries a safe llama.cpp command automatically.
- Mode 1 downloads the GGUF automatically if missing and starts llama-server.
- Mode 2 creates a local Shtenco MAX TURBO model profile from the dataset.
- Backtest and Live both use MaxTurboInference.generate() instead of ollama.generate().

THE THREE PREVIOUS FIXES ARE PRESERVED
1) ATR compares current ATR to ATR_avg_20 * 1.3.
2) Negative swap is added to P/L (therefore subtracts cost correctly).
3) Synthetic 5-digit FX point = 0.00001.

FIRST START ON WINDOWS
1. Run INSTALL_WINDOWS.bat
2. Run RUN_TRADER.bat
3. Choose 1. The first run downloads the GGUF model and starts MAX TURBO.
4. After the smoke test, choose 3 for backtest or 4 for MT5 live mode.

FIXES IN THIS VERSION
4) llama-server flags are checked separately (--gpu-layers, then -ngl); GPU layers passed as a string.
5) Response cache key now includes top_p, top_k, repeat_penalty, MODEL_NAME and the few-shot flag.
6) parse_answer is strict: direction is read only from the НАПРАВЛЕНИЕ line, comma is accepted as decimal
   separator; if direction, confidence or price is missing, the trade is skipped (no default DOWN).
7) Dataset labels: zero 24h price change gets no label and is skipped (it used to become DOWN).
8) Variables renamed *_pips -> *_points (SPREAD_POINTS, stop_loss_points, ...). SLIPPAGE = 10 points = 1 pip.
9) Point value comes from trade_tick_value / trade_tick_size (correct for USDCHF and USDCAD).
   COMMISSION_PER_LOT (default 0) is added to the per-lot risk. Lots are rounded DOWN to the step;
   if even the minimum lot exceeds the risk limit, the trade is skipped.
10) Live mode reads bars from position 1, so the forming M15 bar is never used.

QWEN 3.5 MODEL CHOICE
- RUN_TRADER.bat uses the faster Qwen3.5 0.8B Q4_K_M model.
- RUN_TRADER_2B.bat uses the larger Qwen3.5 2B Q4_K_M model.
- This PC runs both models on CPU because the GeForce 710M is not suitable for current llama.cpp GPU offload.

FAST GPU MODE
For maximum speed use a CUDA/Vulkan build of llama.cpp. The runtime automatically sends
-ngl 999 when supported, so all possible model layers are offloaded to the GPU.
If llama-server.exe is not in PATH:
  set LLAMA_SERVER=C:\path\to\llama-server.exe

MODEL OVERRIDE
  set SHTENCO_TURBO_MODEL=C:\models\your_model.gguf

SERVER OVERRIDE
  set SHTENCO_TURBO_URL=http://127.0.0.1:8999

OPTIONAL FEW-SHOT PROFILE
Mode 2 stores 2 UP + 2 DOWN examples in models\shtenco_max_turbo_profile.json.
For absolute minimum latency they are not injected by default.
To enable them:
  set SHTENCO_TURBO_FEWSHOT=1

NOTES
- The included Python file does not require Ollama.
- A real speed number depends on CPU/GPU, llama.cpp build and chosen GGUF.
- The sandbox verification used an OpenAI-compatible local test backend because the sandbox
  does not contain llama-server or the ~0.6 GB GGUF model.
