TesterReport::TesterReport (QWidget *p) : QWidget (p) { Q3VBoxLayout *vbox = new Q3VBoxLayout(this); vbox->setMargin(5); vbox->setSpacing(5); tradeTable = new Q3Table(0, 9, this); tradeTable->setSelectionMode(Q3Table::Single); tradeTable->setSorting(FALSE); Q3Header *header = tradeTable->horizontalHeader(); header->setLabel(0, tr("Type"), 40); header->setLabel(1, tr("Entry"), 80); header->setLabel(2, tr("Entry Price"), 70); header->setLabel(3, tr("Exit"), 80); header->setLabel(4, tr("Exit Price"), 70); header->setLabel(5, tr("Signal"), -1); header->setLabel(6, tr("Profit"), -1); header->setLabel(7, tr("Balance"), -1); header->setLabel(8, tr("Vol"), -1); vbox->addWidget(tradeTable); int loop; for (loop = 0; loop < 9; loop++) tradeTable->setColumnReadOnly(loop, TRUE); // test summary Q3HBoxLayout *hbox = new Q3HBoxLayout(vbox); hbox->setSpacing(5); Q3VGroupBox *gbox = new Q3VGroupBox(tr("Test Summary"), this); gbox->setInsideSpacing(2); gbox->setColumns(2); hbox->addWidget(gbox); QLabel *label = new QLabel(tr("Account Balance "), gbox); summaryBalance = new QLabel(" ", gbox); label = new QLabel(tr("Net Profit "), gbox); summaryNetProfit = new QLabel(" ", gbox); label = new QLabel(tr("Net Profit % "), gbox); summaryNetPercentage = new QLabel(" ", gbox); label = new QLabel(tr("Initial Investment "), gbox); summaryInvestment = new QLabel(" ", gbox); label = new QLabel(tr("Commissions "), gbox); summaryCommission = new QLabel(" ", gbox); label = new QLabel(tr("Largest Drawdown "), gbox); summaryDrawdown = new QLabel(" ", gbox); label = new QLabel(tr("Trades "), gbox); summaryTrades = new QLabel(" ", gbox); label = new QLabel(tr("Long Trades "), gbox); summaryLongTrades = new QLabel(" ", gbox); label = new QLabel(tr("Short Trades "), gbox); summaryShortTrades = new QLabel(" ", gbox); // win summary gbox = new Q3VGroupBox(tr("Win Summary"), this); gbox->setInsideSpacing(2); gbox->setColumns(2); hbox->addWidget(gbox); label = new QLabel(tr("Trades "), gbox); summaryWinTrades = new QLabel(" ", gbox); label = new QLabel(tr("Profit "), gbox); summaryTotalWinTrades = new QLabel(" ", gbox); label = new QLabel(tr("Average "), gbox); summaryAverageWin = new QLabel(" ", gbox); label = new QLabel(tr("Largest "), gbox); summaryLargestWin = new QLabel(" ", gbox); label = new QLabel(tr("Long Trades "), gbox); summaryWinLongTrades = new QLabel(" ", gbox); label = new QLabel(tr("Short Trades "), gbox); summaryWinShortTrades = new QLabel(" ", gbox); // lose summary gbox = new Q3VGroupBox(tr("Lose Summary"), this); gbox->setInsideSpacing(2); gbox->setColumns(2); hbox->addWidget(gbox); label = new QLabel(tr("Trades "), gbox); summaryLoseTrades = new QLabel(" ", gbox); label = new QLabel(tr("Loss "), gbox); summaryTotalLoseTrades = new QLabel(" ", gbox); label = new QLabel(tr("Average "), gbox); summaryAverageLose = new QLabel(" ", gbox); label = new QLabel(tr("Largest "), gbox); summaryLargestLose = new QLabel(" ", gbox); label = new QLabel(tr("Long Trades "), gbox); summaryLoseLongTrades = new QLabel(" ", gbox); label = new QLabel(tr("Short Trades "), gbox); summaryLoseShortTrades = new QLabel(" ", gbox); }
TesterTestPage::TesterTestPage (QWidget *p) : QWidget (p) { fieldList.append(tr("Open")); fieldList.append(tr("Close")); fieldList.append(tr("Mid Point")); Q3HBoxLayout *hbox = new Q3HBoxLayout(this); hbox->setMargin(5); hbox->setSpacing(10); // left side grid Q3GridLayout *grid = new Q3GridLayout(hbox); grid->setColStretch(1, 1); grid->setSpacing(5); // trades area tradeLong = new QCheckBox(tr("Long"), this); grid->addWidget(tradeLong, 0, 0); tradeShort = new QCheckBox(tr("Short"), this); grid->addWidget(tradeShort, 1, 0); QLabel *label = new QLabel(tr("Trade Delay"), this); grid->addWidget(label, 2, 0); tradeDelay = new QSpinBox(1, 999999, 1, this); tradeDelay->setValue(1); grid->addWidget(tradeDelay, 2, 1); grid->setRowSpacing(grid->numRows(), 25); // account area label = new QLabel(tr("Account Balance"), this); grid->addWidget(label, 4, 0); account = new QSpinBox(0, 999999, 1, this); account->setValue(10000); grid->addWidget(account, 4, 1); label = new QLabel(tr("Futures Margin"), this); grid->addWidget(label, 5, 0); margin = new QSpinBox(0, 999999, 1, this); grid->addWidget(margin, 5, 1); label = new QLabel(tr("Volume %"), this); grid->addWidget(label, 6, 0); volumePercent = new QSpinBox(0, 100, 1, this); grid->addWidget(volumePercent, 6, 1); grid->setRowSpacing(grid->numRows(), 25); // commission area commissionType = new QCheckBox(tr("Use Commission %"), this); grid->addWidget(commissionType, 8, 0); label = new QLabel(tr("Entry"), this); grid->addWidget(label, 9, 0); QDoubleValidator *dv = new QDoubleValidator(0, 99999999.0, 4, this, 0); entryCom = new QLineEdit(QString::number(10), this); entryCom->setValidator(dv); grid->addWidget(entryCom, 9, 1); label = new QLabel(tr("Exit"), this); grid->addWidget(label, 10, 0); QDoubleValidator *dv2 = new QDoubleValidator(0, 99999999.0, 4, this, 0); exitCom = new QLineEdit(QString::number(10), this); exitCom->setValidator(dv2); grid->addWidget(exitCom, 10, 1); grid->setRowStretch(grid->numRows() + 1, 1); // vline sperarator Q3Frame *line = new Q3Frame(this); line->setFrameStyle(Q3Frame::VLine | Q3Frame::Plain); hbox->addWidget(line); // right side grid grid = new Q3GridLayout(hbox); grid->setColStretch(1, 1); grid->setSpacing(5); // test area label = new QLabel(tr("Symbol"), this); grid->addWidget(label, 0, 0); Config config; QString s, s2; config.getData(Config::DataPath, s); symbolButton = new SymbolButton(this, s, s2); connect(symbolButton, SIGNAL(symbolChanged()), this, SLOT(symbolButtonPressed())); grid->addWidget(symbolButton, 0, 1); label = new QLabel(tr("Bar Length"), this); grid->addWidget(label, 1, 0); BarData bd(s); barLength = new QComboBox(this); bd.getBarLengthList(barLengthList); barLength->insertStringList(barLengthList, -1); barLength->setCurrentItem(6); grid->addWidget(barLength, 1, 1); label = new QLabel(tr("Bars"), this); grid->addWidget(label, 2, 0); bars = new QSpinBox(1, 99999999, 1, this); bars->setValue(275); grid->addWidget(bars, 2, 1); label = new QLabel(tr("Entry/Exit Price"), this); grid->addWidget(label, 3, 0); priceField = new QComboBox(this); priceField->insertStringList(fieldList,-1); grid->addWidget(priceField, 3, 1); grid->setRowStretch(grid->numRows() + 1, 1); }