<?php
require_once "../../portal/config.php";
session_start();

$data = json_decode(file_get_contents("php://input"),true);
$user_id = $_SESSION['user_id'] ?? 0;

$conn->query("
REPLACE INTO fxh_strategy_settings
(
    user_id,
    symbol,
    ema_fast,
    ema_slow,
    atr_mult,
    risk,
    auto_trade,
    updated_at
)
VALUES
(
    $user_id,
    '{$conn->real_escape_string($data['symbol'])}',
    {$data['emaFast']},
    {$data['emaSlow']},
    {$data['atrMult']},
    {$data['risk']},
    {$data['auto_trade']},
    NOW()
)
");
