Page 6 of 7
Re: Hitting most of the profit target in the first few days: what now?
Posted: Sat Oct 24, 2026 10:06 am
by FTtrader
Key Architectural Details
The Zero-Tick Requirement (OnTimer): Hardware interrupts and WMI queries can take 10 to 50 milliseconds to return. If you place PerformanceCounter.NextValue() inside OnTick(), you will inadvertently stall the execution thread during high volatility. Timer.Start() and OnTimer() execute entirely independently of market data feeds.
Property Cache Refresh (_cTraderProcess.Refresh()): The Process class caches its metrics at the moment it is instantiated. If you query WorkingSet64 without calling .Refresh() first, it will statically report the RAM usage from when the cBot was initially attached to the chart.
Alert Cooldown State: If a rogue Windows Update spikes the CPU to 100% for ten minutes, firing an HTTP request to Telegram every 60 seconds will quickly get your bot's token rate-limited. The _alertCooldown enforces a strict 15-minute silence window after an initial warning, ensuring you are notified without flooding your network queue.
Re: Hitting most of the profit target in the first few days: what now?
Posted: Sat Oct 24, 2026 10:07 am
by FTtrader
Because cTrader utilizes Microsoft's ClickOnce deployment architecture, the physical cTrader.exe executable is buried in a dynamically generated, randomized folder path (inside AppData\Local\Apps\2.0\) that changes every time your broker pushes an update.
To ensure the script survives IC Markets platform updates, you must execute the .appref-ms application reference shortcut rather than targeting the .exe directly.
Re: Hitting most of the profit target in the first few days: what now?
Posted: Sat Oct 24, 2026 10:07 am
by FTtrader
This PowerShell script checks the memory footprint, logs the event, gracefully attempts to close the window to prevent workspace corruption, forcefully kills the process if it hangs, and relaunches the terminal.
Code: Select all
# --- cTrader Memory Guardian Script ---
$ProcessName = "cTrader"
$RamThresholdMB = 1500
$LogFile = "C:\cTrader_Monitor.log"
# Target the ClickOnce shortcut to survive IC Markets updates
$cTraderShortcut = "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\IC Markets cTrader\IC Markets cTrader.appref-ms"
$processes = Get-Process -Name $ProcessName -ErrorAction SilentlyContinue
if ($processes) {
foreach ($proc in $processes) {
$ramUsageMB = [math]::Round($proc.WorkingSet64 / 1MB, 2)
if ($ramUsageMB -gt $RamThresholdMB) {
$timestamp = Get-Date -Format 'yyyy-MM-dd HH:mm:ss'
Add-Content -Path $LogFile -Value "$timestamp - WARNING: $ProcessName RAM at ${ramUsageMB}MB. Exceeds ${RamThresholdMB}MB. Initiating restart."
# Attempt a graceful shutdown first to allow cTrader to save the workspace state
$proc.CloseMainWindow() | Out-Null
Start-Sleep -Seconds 5
# Force kill if the WPF thread is completely frozen
if (-not $proc.HasExited) {
Add-Content -Path $LogFile -Value "$timestamp - ERROR: Graceful shutdown failed. Force killing process ID $($proc.Id)."
Stop-Process -Id $proc.Id -Force
Start-Sleep -Seconds 3
}
# Relaunch the application
Start-Process -FilePath $cTraderShortcut
Add-Content -Path $LogFile -Value "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') - SUCCESS: cTrader relaunched."
}
}
}
Re: Hitting most of the profit target in the first few days: what now?
Posted: Sat Oct 24, 2026 10:07 am
by FTtrader
Task Scheduler Implementation
To run this autonomously without an active RDP session, configure it as a Windows Scheduled Task.
Open Task Scheduler and select Create Task.
General Tab: Check Run whether user is logged on or not and check Run with highest privileges. This is mandatory for Stop-Process to execute successfully without UAC blocking it.
Triggers Tab: Set the task to run Daily, and check Repeat task every: 5 minutes for a duration of Indefinitely.
Actions Tab:
Action: Start a program
Program/script: powershell.exe
Add arguments: -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File "C:\Path\To\Your\cTraderMonitor.ps1
Re: Hitting most of the profit target in the first few days: what now?
Posted: Sat Oct 24, 2026 10:08 am
by FTtrader
State Recovery Consideration
Because your Series Guardian cBot utilizes LocalStorage rather than ephemeral RAM variables, forcefully killing the terminal will not corrupt your trailing maximum equity or daily start-of-day baselines. When the script relaunches cTrader, the cBot will instantly read the exact physical limits from the disk and resume protecting the account without resetting your 2 to 6-week series math.
Re: Hitting most of the profit target in the first few days: what now?
Posted: Sat Oct 24, 2026 10:08 am
by FTtrader
Microsoft Sysinternals Autologon securely encrypts your Windows credentials within the Local Security Authority (LSA) secrets, bypassing the lock screen without storing your password in plain text in the registry. This guarantees your VPS desktop environment loads completely after an unexpected server restart, fulfilling the prerequisite for any GUI-based applications to launch.
Configuration Steps
1.) Download the Autologon utility directly from the official Microsoft Sysinternals repository.
2.) Extract the archive and execute Autologon64.exe as an administrator.
3.) Accept the license agreement.
4.) Input your VPS username, the local machine name in the domain field (this usually auto-populates), and your administrative password.
5.) Click Enable. A dialog will confirm that autologon is configured and the credentials are encrypted successfully.
Re: Hitting most of the profit target in the first few days: what now?
Posted: Sat Oct 24, 2026 10:09 am
by FTtrader
cTrader Auto-Launch Integration
Bypassing the lock screen is only the first half of the disaster recovery sequence. To ensure your Series Guardian cBot resumes monitoring your live exposure immediately upon the desktop loading:
Press Win + R and execute shell: startup to open the user's startup directory.
Paste a copy of the IC Markets cTrader .appref-ms application reference shortcut into this folder. Do not use the raw .exe path to avoid breaking the startup sequence when the broker pushes an update.
Verify that your active cTrader workspace is explicitly saved with the Series Guardian already attached to the chart.
Re: Hitting most of the profit target in the first few days: what now?
Posted: Sat Oct 24, 2026 10:09 am
by FTtrader
When the VPS recovers from a Patch Tuesday reboot, Autologon will securely sign into the desktop environment, Windows will trigger the shell:startup payload, and cTrader will initialize with your saved workspace, reading the LocalStorage files to instantly resume tracking your trailing and daily drawdown limits.
Re: Hitting most of the profit target in the first few days: what now?
Posted: Sat Oct 24, 2026 10:10 am
by FTtrader
Because Autologon keeps an active user session permanently loaded on the desktop, you can leverage Group Policy to explicitly forbid the Windows Update engine from forcing a restart while a user is present.
Applying the GPO Restrictions
1.) Press Win + R, type gpedit.msc, and hit Enter to open the Local Group Policy Editor.
2.) Navigate to Computer Configuration > Administrative Templates > Windows Components > Windows Update. (Note: On newer Windows Server 2022 builds, you may need to look inside the Manage end user experience or Legacy Policies subfolders).
3.) Locate and double-click No auto-restart with logged on users for scheduled automatic updates installations. Set this to Enabled and click OK.
4.) Locate and double-click Configure Automatic Updates. Set this to Enabled. In the options pane, change the dropdown to 2 - Notify for download and auto install. This halts the update pipeline entirely, preventing the installation engine from ever staging a pending reboot.
5.) Open an elevated Command Prompt and execute gpupdate /force to immediately apply the policies to the local registry.
Re: Hitting most of the profit target in the first few days: what now?
Posted: Sat Oct 24, 2026 10:10 am
by FTtrader
With these two policies active alongside Autologon, your VPS will securely pull down the update definitions but will patiently wait for you to manually install them during your weekend market closures, completely eliminating the risk of a mid-week reboot halting your live cTrader executions.