mirror of
https://github.com/chrisnov-it/quantumbotx.git
synced 2026-07-28 19:27:44 +00:00
99 lines
5.1 KiB
HTML
99 lines
5.1 KiB
HTML
<!-- templates/backtesting.html (Setelah Refactor) -->
|
|
{% extends "base.html" %}
|
|
|
|
{% block title %}Backtester{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="flex justify-between items-center mb-4">
|
|
<h2 class="text-2xl font-bold text-gray-800">Strategy Backtester</h2>
|
|
<a href="{{ url_for('backtest_history_page') }}" class="bg-gray-200 text-gray-800 py-2 px-4 rounded-lg font-medium hover:bg-gray-300">
|
|
<i class="fas fa-history mr-2"></i>Lihat Riwayat
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Enhanced Engine Info -->
|
|
<div class="mb-6 p-4 bg-blue-50 border border-blue-200 rounded-lg">
|
|
<div class="flex items-start">
|
|
<div class="flex-shrink-0">
|
|
<i class="fas fa-rocket text-blue-600 text-xl"></i>
|
|
</div>
|
|
<div class="ml-3">
|
|
<h3 class="text-sm font-medium text-blue-800">🚀 Enhanced Backtesting Engine Active</h3>
|
|
<div class="mt-1 text-sm text-blue-700">
|
|
<p>Your backtesting now includes:</p>
|
|
<ul class="mt-1 list-disc list-inside text-xs space-y-1">
|
|
<li>✅ <strong>Realistic spread costs</strong> - Actual trading costs deducted</li>
|
|
<li>✅ <strong>ATR-based risk management</strong> - Dynamic position sizing</li>
|
|
<li>✅ <strong>Instrument protection</strong> - Gold trading safeguards</li>
|
|
<li>✅ <strong>Slippage simulation</strong> - More accurate execution modeling</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="grid grid-cols-1 lg:grid-cols-3 gap-6">
|
|
<!-- Kolom Konfigurasi -->
|
|
<div class="lg:col-span-1 bg-white p-6 rounded-lg shadow">
|
|
<form id="backtest-form">
|
|
<div class="space-y-4">
|
|
<div>
|
|
<label for="strategy-select" class="block text-sm font-medium text-gray-700">Pilih Strategi</label>
|
|
<select id="strategy-select" name="strategy" class="mt-1 block w-full rounded-md border-gray-300 shadow-sm"></select>
|
|
</div>
|
|
<div>
|
|
<label for="data-file" class="block text-sm font-medium text-gray-700">Unggah Data Historis (CSV)</label>
|
|
<input type="file" id="data-file" name="file" accept=".csv" class="mt-1 block w-full text-sm text-gray-500 file:mr-4 file:py-2 file:px-4 file:rounded-full file:border-0 file:text-sm file:font-semibold file:bg-blue-50 file:text-blue-700 hover:file:bg-blue-100" required>
|
|
</div>
|
|
|
|
<!-- Risk Management Inputs (Enhanced Engine) -->
|
|
<div class="grid grid-cols-2 gap-4 pt-4 border-t">
|
|
<div>
|
|
<label for="sl_atr_multiplier" class="block text-sm font-medium text-gray-700">
|
|
SL (ATR Multiplier)
|
|
<span class="text-xs text-blue-600">🚀 Enhanced</span>
|
|
</label>
|
|
<input type="number" name="sl_atr_multiplier" id="sl_atr_multiplier" value="2.0" step="0.1" min="0.5" max="5.0"
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<p class="text-xs text-gray-500 mt-1">Dynamic SL based on volatility</p>
|
|
</div>
|
|
<div>
|
|
<label for="tp_atr_multiplier" class="block text-sm font-medium text-gray-700">
|
|
TP (ATR Multiplier)
|
|
<span class="text-xs text-blue-600">🚀 Enhanced</span>
|
|
</label>
|
|
<input type="number" name="tp_atr_multiplier" id="tp_atr_multiplier" value="4.0" step="0.1" min="1.0" max="10.0"
|
|
class="mt-1 block w-full rounded-md border-gray-300 shadow-sm focus:border-blue-500 focus:ring-blue-500">
|
|
<p class="text-xs text-gray-500 mt-1">Dynamic TP based on volatility</p>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="params-container" class="space-y-4 pt-4 border-t">
|
|
<!-- Parameter akan dimuat di sini -->
|
|
</div>
|
|
<button type="submit" id="run-backtest-btn" class="w-full bg-blue-600 text-white py-2 px-4 rounded-lg font-medium hover:bg-blue-700">
|
|
Jalankan Backtest
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
|
|
<!-- Kolom Hasil -->
|
|
<div id="results-container" class="lg:col-span-2 bg-white p-6 rounded-lg shadow hidden">
|
|
<h3 class="text-xl font-bold mb-4">Hasil Backtest</h3>
|
|
<div id="results-summary" class="grid grid-cols-2 md:grid-cols-3 gap-4 mb-6"></div>
|
|
<div class="mb-6">
|
|
<canvas id="equity-chart"></canvas>
|
|
</div>
|
|
<div id="results-log"></div>
|
|
</div>
|
|
<div id="loading-spinner" class="lg:col-span-2 flex items-center justify-center hidden">
|
|
<i class="fas fa-spinner fa-spin text-blue-500 text-4xl"></i>
|
|
<p class="ml-4 text-gray-600">Menjalankan simulasi...</p>
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block scripts %}
|
|
<script src="{{ url_for('static', filename='js/backtesting.js') }}"></script>
|
|
{% endblock %} |