INNER CODE UNIT · Python

initial_sl

aaryansinha16/AI-trader · backend/app.py:171

    initial_sl = round(ep * (1 - sl_pct), 2)
    lots = _lots_for_score(final_score)
    now_dt = datetime.now()
    position = {
        "id": int(now_dt.timestamp() * 1000),
        "entry_time": now_dt.strftime("%H:%M:%S"),
        "entry_time_dt": now_dt.isoformat(),   # full datetime for BE timer
        "symbol": trade["symbol"],
        "direction": trade["direction"],
        "strategy": trade.get("strategy", ""),
        "entry_premium": ep,
        "sl": initial_sl,
        "initial_sl": initial_sl,
        "target": round(ep * (1 + target_pct), 2),
        "max_premium": ep,
        "trailing_active": False,
        "breakeven_locked": False,             # True once SL moved to entry
        "first_profit_time": None,             # iso ts when trade first went green

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…