File size: 1,534 Bytes
59da845
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
pub mod compiler;
pub mod data;
pub mod engine;
pub mod ui;

use eframe::egui;
use ui::backtest_panel::BacktestPanel;

struct MqlRustApp {
    backtest_panel: BacktestPanel,
}

impl MqlRustApp {
    fn new(_cc: &eframe::CreationContext<'_>) -> Self {
        Self {
            backtest_panel: BacktestPanel::new(),
        }
    }
}

impl eframe::App for MqlRustApp {
    fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
        egui::CentralPanel::default().show(ctx, |ui| {
            ui.heading("MQL-Rust Compiler & Backtester");
            ui.separator();
            
            // Draw configuration panel
            if let Some(config) = self.backtest_panel.draw(ui) {
                // Return config triggered a backtest run request
                self.backtest_panel.compiler_log.push_str(&format!(
                    "\n> Starting backtest with Deposit: ${}, Leverage: 1:{}, Spread Modifier: {}",
                    config.initial_deposit, config.leverage, config.spread_modifier
                ));
                // TODO: Wire parsing and backtesting execution threads
            }
        });
    }
}

fn main() -> eframe::Result<()> {
    let options = eframe::NativeOptions {
        viewport: egui::ViewportBuilder::default()
            .with_inner_size([600.0, 700.0])
            .with_title("MQL-Rust"),
        ..Default::default()
    };
    
    eframe::run_native(
        "MQL-Rust Console",
        options,
        Box::new(|cc| Ok(Box::new(MqlRustApp::new(cc)))),
    )
}