Example #1
0
int
Volume::settings (PluginData *pd)
{
  Entity *command = new Entity;
  
  // plugin
  command->set(QString("plugin"), new QVariant(QString("Volume")));
  command->set(QString("type"), new QVariant(QString("indicator")));
  command->set(QString("upColor"), new QVariant(QString("green")));
  command->set(QString("downColor"), new QVariant(QString("red")));
  command->set(QString("neutralColor"), new QVariant(QString("blue")));
  command->set(QString("label"), new QVariant(QString("VOL")));

  MAType mat;
  command->set(QString("maType"), new QVariant(mat.indexToString(MAType::_EMA)));

  // style
  CurveLineType clt;
  command->set(QString("maStyle"), new QVariant(clt.indexToString(CurveLineType::_SOLID)));
  
  command->set(QString("maWidth"), new QVariant(1));
  command->set(QString("maColor"), new QVariant(QString("yellow")));
  command->set(QString("maPeriod"), new QVariant(10));
  command->set(QString("maLabel"), new QVariant(QString("MA")));
  
  pd->settings = command;
  
  return 1;
}
Example #2
0
Curve *
OHLC::getMA (Entity *settings, int num)
{
  QString key = "ma" + QString::number(num) + "Input";
  QVariant *input = settings->get(key);
  if (! input)
    return 0;
  
  key = "ma" + QString::number(num) + "Type";
  QVariant *type = settings->get(key);
  if (! type)
    return 0;
  
  key = "ma" + QString::number(num) + "Style";
  QVariant *style = settings->get(key);
  if (! style)
    return 0;
  
  key = "ma" + QString::number(num) + "Width";
  QVariant *width = settings->get(key);
  if (! width)
    return 0;
  
  key = "ma" + QString::number(num) + "Period";
  QVariant *period = settings->get(key);
  if (! period)
    return 0;
  
  key = "ma" + QString::number(num) + "Color";
  QVariant *color = settings->get(key);
  if (! color)
    return 0;
  
  key = "ma" + QString::number(num) + "Label";
  QVariant *label = settings->get(key);
  if (! label)
    return 0;

  MAType mat;
  if (! getMA(input->toString(), label->toString(), mat.stringToIndex(type->toString()), period->toInt()))
    return 0;
  
  Curve *curve = new Curve(QString("CurveLine"));
  curve->setLabel(label->toString());
  CurveLineType clt;
  curve->setStyle(clt.stringToIndex(style->toString()));
  curve->setPen(width->toInt());
  curve->setColor(QColor(color->toString()));
  curve->fill(label->toString(), QString(), QString(), QString(), QColor());

  return curve;
}
Example #3
0
int
OHLC::settings (PluginData *pd)
{
  Entity *command = new Entity;
  BarType bt;
  CurveOHLCType ct;
  CurveLineType clt;
  MAType mat;
  
  command->set(QString("plugin"), new QVariant(QString("OHLC")));
  command->set(QString("type"), new QVariant(QString("indicator")));
  
  command->set(QString("style"), new QVariant(ct.indexToString(CurveOHLCType::_OHLC)));
  command->set(QString("upColor"), new QVariant(QString("green")));
  command->set(QString("downColor"), new QVariant(QString("red")));
  command->set(QString("neutralColor"), new QVariant(QString("blue")));
  command->set(QString("label"), new QVariant(QString("OHLC")));

  // ma 1
  command->set(QString("ma1Input"), new QVariant(bt.indexToString(BarType::_CLOSE)));
  command->set(QString("ma1Type"), new QVariant(mat.indexToString(MAType::_EMA)));
  command->set(QString("ma1Style"), new QVariant(clt.indexToString(CurveLineType::_SOLID)));
  command->set(QString("ma1Width"), new QVariant(1));
  command->set(QString("ma1Color"), new QVariant(QString("yellow")));
  command->set(QString("ma1Period"), new QVariant(20));
  command->set(QString("ma1Label"), new QVariant(QString("MA1")));

  // ma 2
  command->set(QString("ma2Input"), new QVariant(bt.indexToString(BarType::_CLOSE)));
  command->set(QString("ma2Type"), new QVariant(mat.indexToString(MAType::_EMA)));
  command->set(QString("ma2Style"), new QVariant(clt.indexToString(CurveLineType::_SOLID)));
  command->set(QString("ma2Width"), new QVariant(1));
  command->set(QString("ma2Color"), new QVariant(QString("red")));
  command->set(QString("ma2Period"), new QVariant(50));
  command->set(QString("ma2Label"), new QVariant(QString("MA2")));

  // ma 3
  command->set(QString("ma3Input"), new QVariant(bt.indexToString(BarType::_CLOSE)));
  command->set(QString("ma3Type"), new QVariant(mat.indexToString(MAType::_EMA)));
  command->set(QString("ma3Style"), new QVariant(clt.indexToString(CurveLineType::_SOLID)));
  command->set(QString("ma3Width"), new QVariant(1));
  command->set(QString("ma3Color"), new QVariant(QString("blue")));
  command->set(QString("ma3Period"), new QVariant(200));
  command->set(QString("ma3Label"), new QVariant(QString("MA3")));
  
  pd->settings = command;
  
  return 1;
}
Example #4
0
int
RSI::settings (PluginData *pd)
{
  BarType bt;
  CurveLineType clt;
  MAType mat;
  Entity *command = new Entity;
  
  command->set(QString("plugin"), new QVariant(QString("RSI")));
  command->set(QString("type"), new QVariant(QString("indicator")));
  
  command->set(QString("input"), new QVariant(bt.indexToString(BarType::_CLOSE)));
  command->set(QString("color"), new QVariant(QString("red")));
  command->set(QString("period"), new QVariant(14));
  command->set(QString("label"), new QVariant(QString("RSI")));
  command->set(QString("width"), new QVariant(1));
  command->set(QString("style"), new QVariant(clt.indexToString(CurveLineType::_SOLID)));
  command->set(QString("rsiShow"), new QVariant(TRUE));
  
  command->set(QString("maType"), new QVariant(mat.indexToString(MAType::_EMA)));
  command->set(QString("maStyle"), new QVariant(clt.indexToString(CurveLineType::_SOLID)));
  command->set(QString("maWidth"), new QVariant(1));
  command->set(QString("maColor"), new QVariant(QString("yellow")));
  command->set(QString("maPeriod"), new QVariant(10));
  command->set(QString("maLabel"), new QVariant(QString("MA")));
  command->set(QString("maShow"), new QVariant(TRUE));
  
  command->set(QString("buyMarkerColor"), new QVariant(QString("green")));
  command->set(QString("buyMarkerPrice"), new QVariant(30.0));
  command->set(QString("buyMarkerShow"), new QVariant(TRUE));

  command->set(QString("sellMarkerColor"), new QVariant(QString("red")));
  command->set(QString("sellMarkerPrice"), new QVariant(70.0));
  command->set(QString("sellMarkerShow"), new QVariant(TRUE));
  
  pd->settings = command;
  
  return 1;
}
Example #5
0
void RSIDialog::setGUI (Entity *settings)
{
  _settings = settings;

  // RSI page
  QWidget *w = new QWidget;
  
  QFormLayout *form = new QFormLayout;
  w->setLayout(form);
  
  // color
  QVariant *set = _settings->get(QString("color"));
  
  _rsiColor = new ColorButton(this, QColor(set->toString()));
  connect(_rsiColor, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
  form->addRow(tr("Color"), _rsiColor);
  
  // period
  set = _settings->get(QString("period"));

  _rsiPeriod = new QSpinBox;
  _rsiPeriod->setRange(1, 999999);
  _rsiPeriod->setValue(set->toInt());
  connect(_rsiPeriod, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
  form->addRow(tr("Period"), _rsiPeriod);
  
  // style
  set = _settings->get(QString("style"));

  CurveLineType clt;
  _rsiStyle = new QComboBox;
  _rsiStyle->addItems(clt.list());
  _rsiStyle->setCurrentIndex(_rsiStyle->findText(set->toString(), Qt::MatchExactly));
  connect(_rsiStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
  form->addRow(tr("Style"), _rsiStyle);

  // width
  set = _settings->get(QString("width"));

  _rsiWidth = new QSpinBox;
  _rsiWidth->setRange(1, 99);
  _rsiWidth->setValue(set->toInt());
  connect(_rsiWidth, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
  form->addRow(tr("Width"), _rsiWidth);

  // show
  set = _settings->get(QString("rsiShow"));

  _rsiShow = new QCheckBox;
  _rsiShow->setChecked(set->toBool());
  connect(_rsiShow, SIGNAL(toggled(bool)), this, SLOT(modified()));
  form->addRow(tr("Show"), _rsiShow);

  _tabs->addTab(w, QString("RSI"));

  
  // MA page
  w = new QWidget;
  
  form = new QFormLayout;
  w->setLayout(form);

  // type
  set = _settings->get(QString("maType"));

  MAType mat;
  _maType = new QComboBox;
  _maType->addItems(mat.list());
  _maType->setCurrentIndex(_maType->findText(set->toString(), Qt::MatchExactly));
  connect(_maType, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
  form->addRow(tr("Type"), _maType);
  
  // style
  set = _settings->get(QString("maStyle"));

  _maStyle = new QComboBox;
  _maStyle->addItems(clt.list());
  _maStyle->setCurrentIndex(_maStyle->findText(set->toString(), Qt::MatchExactly));
  connect(_maStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
  form->addRow(tr("Style"), _maStyle);

  // width
  set = _settings->get(QString("maWidth"));

  _maWidth = new QSpinBox;
  _maWidth->setRange(1, 99);
  _maWidth->setValue(set->toInt());
  connect(_maWidth, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
  form->addRow(tr("Width"), _maWidth);
  
  // color
  set = _settings->get(QString("maColor"));
  
  _maColor = new ColorButton(this, QColor(set->toString()));
  connect(_maColor, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
  form->addRow(tr("Color"), _maColor);
  
  // period
  set = _settings->get(QString("maPeriod"));

  _maPeriod = new QSpinBox;
  _maPeriod->setRange(1, 999999);
  _maPeriod->setValue(set->toInt());
  connect(_maPeriod, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
  form->addRow(tr("Period"), _maPeriod);
  
  // show
  set = _settings->get(QString("maShow"));

  _maShow = new QCheckBox;
  _maShow->setChecked(set->toBool());
  connect(_maShow, SIGNAL(toggled(bool)), this, SLOT(modified()));
  form->addRow(tr("Show"), _maShow);

  _tabs->addTab(w, QString("MA"));
  

  // buy marker page
  w = new QWidget;
  
  form = new QFormLayout;
  w->setLayout(form);
  
  // color
  set = _settings->get(QString("buyMarkerColor"));
  
  _ref1Color = new ColorButton(this, QColor(set->toString()));
  connect(_ref1Color, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
  form->addRow(tr("Color"), _ref1Color);

  // value
  set = _settings->get(QString("buyMarkerPrice"));

  _ref1 = new QDoubleSpinBox;
  _ref1->setRange(-99999999.0, 99999999.0);
  _ref1->setValue(set->toDouble());
  connect(_ref1, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
  form->addRow(tr("Value"), _ref1);

  // show
  set = _settings->get(QString("buyMarkerShow"));

  _ref1Show = new QCheckBox;
  _ref1Show->setChecked(set->toBool());
  connect(_ref1Show, SIGNAL(toggled(bool)), this, SLOT(modified()));
  form->addRow(tr("Show"), _ref1Show);

  _tabs->addTab(w, tr("Buy Marker"));
  

  // REF2 page
  w = new QWidget;
  
  form = new QFormLayout;
  w->setLayout(form);
  
  // color
  set = _settings->get(QString("sellMarkerColor"));
  
  _ref2Color = new ColorButton(this, QColor(set->toString()));
  connect(_ref2Color, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
  form->addRow(tr("Color"), _ref2Color);

  // value
  set = _settings->get(QString("sellMarkerPrice"));

  _ref2 = new QDoubleSpinBox;
  _ref2->setRange(-99999999.0, 99999999.0);
  _ref2->setValue(set->toDouble());
  connect(_ref2, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
  form->addRow(tr("Value"), _ref2);

  // show
  set = _settings->get(QString("sellMarkerShow"));

  _ref2Show = new QCheckBox;
  _ref2Show->setChecked(set->toBool());
  connect(_ref2Show, SIGNAL(toggled(bool)), this, SLOT(modified()));
  form->addRow(tr("Show"), _ref2Show);

  _tabs->addTab(w, tr("Sell Marker"));
}
Example #6
0
void MACDDialog::setGUI (Entity *settings)
{
  _settings = settings;

  // MACD page
  QWidget *w = new QWidget;
  
  QFormLayout *form = new QFormLayout;
  w->setLayout(form);

  // input
  QVariant *set = _settings->get(QString("input"));

  BarType bt;
  _input = new QComboBox;
  _input->addItems(bt.list());
  _input->setCurrentIndex(_input->findText(set->toString(), Qt::MatchExactly));
  connect(_input, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
  form->addRow(tr("Input"), _input);
  
  // color
  set = _settings->get(QString("macdColor"));
  
  _macdColor = new ColorButton(this, QColor(set->toString()));
  connect(_macdColor, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
  form->addRow(tr("Color"), _macdColor);
  
  // fast period
  set = _settings->get(QString("fast"));

  _fast = new QSpinBox;
  _fast->setRange(1, 999999);
  _fast->setValue(set->toInt());
  connect(_fast, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
  form->addRow(tr("Fast Period"), _fast);
  
  // slow period
  set = _settings->get(QString("slow"));

  _slow = new QSpinBox;
  _slow->setRange(1, 999999);
  _slow->setValue(set->toInt());
  connect(_slow, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
  form->addRow(tr("Slow Period"), _slow);

  // ma fast type
  set = _settings->get(QString("fastMA"));

  MAType mat;
  _fastMA = new QComboBox;
  _fastMA->addItems(mat.list());
  _fastMA->setCurrentIndex(_fastMA->findText(set->toString(), Qt::MatchExactly));
  connect(_fastMA, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
  form->addRow(tr("Fast MA"), _fastMA);

  // ma slow type
  set = _settings->get(QString("slowMA"));

  _slowMA = new QComboBox;
  _slowMA->addItems(mat.list());
  _slowMA->setCurrentIndex(_slowMA->findText(set->toString(), Qt::MatchExactly));
  connect(_slowMA, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
  form->addRow(tr("Slow MA"), _slowMA);
  
  // line style
  set = _settings->get(QString("macdStyle"));

  CurveLineType clt;
  _macdStyle = new QComboBox;
  _macdStyle->addItems(clt.list());
  _macdStyle->setCurrentIndex(_macdStyle->findText(set->toString(), Qt::MatchExactly));
  connect(_macdStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
  form->addRow(tr("Style"), _macdStyle);

  // width
  set = _settings->get(QString("macdWidth"));

  _macdWidth = new QSpinBox;
  _macdWidth->setRange(1, 99);
  _macdWidth->setValue(set->toInt());
  connect(_macdWidth, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
  form->addRow(tr("Width"), _macdWidth);

  // show
  set = _settings->get(QString("macdShow"));

  _macdShow = new QCheckBox;
  _macdShow->setChecked(set->toBool());
  connect(_macdShow, SIGNAL(toggled(bool)), this, SLOT(modified()));
  form->addRow(tr("Show"), _macdShow);
  
  _tabs->addTab(w, QString("MACD"));

  // SIGNAL page
  w = new QWidget;
  
  form = new QFormLayout;
  w->setLayout(form);

  // style
  set = _settings->get(QString("signalStyle"));

  _signalStyle = new QComboBox;
  _signalStyle->addItems(clt.list());
  _signalStyle->setCurrentIndex(_signalStyle->findText(set->toString(), Qt::MatchExactly));
  connect(_signalStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
  form->addRow(tr("Style"), _signalStyle);

  // width
  set = _settings->get(QString("signalWidth"));

  _signalWidth = new QSpinBox;
  _signalWidth->setRange(1, 99);
  _signalWidth->setValue(set->toInt());
  connect(_signalWidth, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
  form->addRow(tr("Width"), _signalWidth);
  
  // color
  set = _settings->get(QString("signalColor"));
  
  _signalColor = new ColorButton(this, QColor(set->toString()));
  connect(_signalColor, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
  form->addRow(tr("Color"), _signalColor);

  // ma type
  set = _settings->get(QString("signalMA"));

  _signalMA = new QComboBox;
  _signalMA->addItems(mat.list());
  _signalMA->setCurrentIndex(_fastMA->findText(set->toString(), Qt::MatchExactly));
  connect(_signalMA, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
  form->addRow(tr("MA"), _signalMA);
  
  // period
  set = _settings->get(QString("signalPeriod"));

  _signalPeriod = new QSpinBox;
  _signalPeriod->setRange(1, 999999);
  _signalPeriod->setValue(set->toInt());
  connect(_signalPeriod, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
  form->addRow(tr("Period"), _signalPeriod);
  
  // show
  set = _settings->get(QString("signalShow"));

  _signalShow = new QCheckBox;
  _signalShow->setChecked(set->toBool());
  connect(_signalShow, SIGNAL(toggled(bool)), this, SLOT(modified()));
  form->addRow(tr("Show"), _signalShow);

  _tabs->addTab(w, tr("Signal"));

  // HIST page
  w = new QWidget;
  
  form = new QFormLayout;
  w->setLayout(form);

  // color
  set = _settings->get(QString("histColor"));
  
  _histColor = new ColorButton(this, QColor(set->toString()));
  connect(_histColor, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
  form->addRow(tr("Color"), _histColor);
  
  // show
  set = _settings->get(QString("histShow"));

  _histShow = new QCheckBox;
  _histShow->setChecked(set->toBool());
  connect(_histShow, SIGNAL(toggled(bool)), this, SLOT(modified()));
  form->addRow(tr("Show"), _histShow);

  _tabs->addTab(w, tr("Histogram"));
}
Example #7
0
void STOCHSDialog::setGUI (Entity *settings)
{
    _settings = settings;

    // %K page
    QWidget *w = new QWidget;

    QFormLayout *form = new QFormLayout;
    w->setLayout(form);

    // color
    QVariant *set = _settings->get(QString("kColor"));

    _kColor = new ColorButton(this, QColor(set->toString()));
    connect(_kColor, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
    form->addRow(tr("Color"), _kColor);

    // fast period
    set = _settings->get(QString("fkPeriod"));

    _fkPeriod = new QSpinBox;
    _fkPeriod->setRange(1, 999999);
    _fkPeriod->setValue(set->toInt());
    connect(_fkPeriod, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
    form->addRow(tr("Fast Period"), _fkPeriod);

    // k period
    set = _settings->get(QString("kPeriod"));

    _kPeriod = new QSpinBox;
    _kPeriod->setRange(1, 999999);
    _kPeriod->setValue(set->toInt());
    connect(_kPeriod, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
    form->addRow(tr("Period"), _kPeriod);

    // ma type
    set = _settings->get(QString("kType"));

    MAType mat;
    _kType = new QComboBox;
    _kType->addItems(mat.list());
    _kType->setCurrentIndex(_kType->findText(set->toString(), Qt::MatchExactly));
    connect(_kType, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
    form->addRow(tr("Type"), _kType);

    // style
    set = _settings->get(QString("kStyle"));

    CurveLineType clt;
    _kStyle = new QComboBox;
    _kStyle->addItems(clt.list());
    _kStyle->setCurrentIndex(_kStyle->findText(set->toString(), Qt::MatchExactly));
    connect(_kStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
    form->addRow(tr("Style"), _kStyle);

    // width
    set = _settings->get(QString("kWidth"));

    _kWidth = new QSpinBox;
    _kWidth->setRange(1, 99);
    _kWidth->setValue(set->toInt());
    connect(_kWidth, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
    form->addRow(tr("Width"), _kWidth);

    _tabs->addTab(w, QString("%K"));


    // %D page
    w = new QWidget;

    form = new QFormLayout;
    w->setLayout(form);

    // type
    set = _settings->get(QString("dType"));

    _dType = new QComboBox;
    _dType->addItems(mat.list());
    _dType->setCurrentIndex(_dType->findText(set->toString(), Qt::MatchExactly));
    connect(_dType, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
    form->addRow(tr("Type"), _dType);

    // style
    set = _settings->get(QString("dStyle"));

    _dStyle = new QComboBox;
    _dStyle->addItems(clt.list());
    _dStyle->setCurrentIndex(_dStyle->findText(set->toString(), Qt::MatchExactly));
    connect(_dStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
    form->addRow(tr("Style"), _dStyle);

    // width
    set = _settings->get(QString("dWidth"));

    _dWidth = new QSpinBox;
    _dWidth->setRange(1, 99);
    _dWidth->setValue(set->toInt());
    connect(_dWidth, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
    form->addRow(tr("Width"), _dWidth);

    // color
    set = _settings->get(QString("dColor"));

    _dColor = new ColorButton(this, QColor(set->toString()));
    connect(_dColor, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
    form->addRow(tr("Color"), _dColor);

    // period
    set = _settings->get(QString("dPeriod"));

    _dPeriod = new QSpinBox;
    _dPeriod->setRange(1, 999999);
    _dPeriod->setValue(set->toInt());
    connect(_dPeriod, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
    form->addRow(tr("Period"), _dPeriod);

    _tabs->addTab(w, QString("%D"));


    // buy marker page
    w = new QWidget;

    form = new QFormLayout;
    w->setLayout(form);

    // color
    set = _settings->get(QString("buyMarkerColor"));

    _ref1Color = new ColorButton(this, QColor(set->toString()));
    connect(_ref1Color, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
    form->addRow(tr("Color"), _ref1Color);

    // value
    set = _settings->get(QString("buyMarkerPrice"));

    _ref1 = new QDoubleSpinBox;
    _ref1->setRange(-99999999.0, 99999999.0);
    _ref1->setValue(set->toDouble());
    connect(_ref1, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
    form->addRow(tr("Value"), _ref1);

    _tabs->addTab(w, tr("Buy Marker"));


    // REF2 page
    w = new QWidget;

    form = new QFormLayout;
    w->setLayout(form);

    // color
    set = _settings->get(QString("sellMarkerColor"));

    _ref2Color = new ColorButton(this, QColor(set->toString()));
    connect(_ref2Color, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
    form->addRow(tr("Color"), _ref2Color);

    // value
    set = _settings->get(QString("sellMarkerPrice"));

    _ref2 = new QDoubleSpinBox;
    _ref2->setRange(-99999999.0, 99999999.0);
    _ref2->setValue(set->toDouble());
    connect(_ref2, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
    form->addRow(tr("Value"), _ref2);

    _tabs->addTab(w, tr("Sell Marker"));
}
Example #8
0
void VolumeDialog::setGUI (Entity *settings)
{
  _settings = settings;

  // Volume page
  QWidget *w = new QWidget;
  
  QFormLayout *form = new QFormLayout;
  w->setLayout(form);
  
  // up color
  QVariant *set = _settings->get(QString("upColor"));
  
  _upColor = new ColorButton(this, QColor(set->toString()));
  connect(_upColor, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
  form->addRow(tr("Up Color"), _upColor);
  
  // down color
  set = _settings->get(QString("downColor"));
  
  _downColor = new ColorButton(this, QColor(set->toString()));
  connect(_downColor, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
  form->addRow(tr("Down Color"), _downColor);
  
  // neutral color
  set = _settings->get(QString("neutralColor"));
  
  _neutralColor = new ColorButton(this, QColor(set->toString()));
  connect(_neutralColor, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
  form->addRow(tr("Neutral Color"), _neutralColor);
  
  _tabs->addTab(w, QString("Volume"));

  // MA page
  w = new QWidget;
  
  form = new QFormLayout;
  w->setLayout(form);

  // type
  set = _settings->get(QString("maType"));

  MAType mat;
  _maType = new QComboBox;
  _maType->addItems(mat.list());
  _maType->setCurrentIndex(_maType->findText(set->toString(), Qt::MatchExactly));
  connect(_maType, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
  form->addRow(tr("Type"), _maType);
  
  // style
  set = _settings->get(QString("maStyle"));

  CurveLineType clt;
  _maStyle = new QComboBox;
  _maStyle->addItems(clt.list());
  _maStyle->setCurrentIndex(_maStyle->findText(set->toString(), Qt::MatchExactly));
  connect(_maStyle, SIGNAL(currentIndexChanged(int)), this, SLOT(modified()));
  form->addRow(tr("Style"), _maStyle);

  // width
  set = _settings->get(QString("maWidth"));

  _maWidth = new QSpinBox;
  _maWidth->setRange(1, 99);
  _maWidth->setValue(set->toInt());
  connect(_maWidth, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
  form->addRow(tr("Width"), _maWidth);
  
  // color
  set = _settings->get(QString("maColor"));
  
  _maColor = new ColorButton(this, QColor(set->toString()));
  connect(_maColor, SIGNAL(valueChanged(QColor)), this, SLOT(modified()));
  form->addRow(tr("Color"), _maColor);
  
  // period
  set = _settings->get(QString("maPeriod"));

  _maPeriod = new QSpinBox;
  _maPeriod->setRange(1, 999999);
  _maPeriod->setValue(set->toInt());
  connect(_maPeriod, SIGNAL(valueChanged(const QString &)), this, SLOT(modified()));
  form->addRow(tr("Period"), _maPeriod);
  
  _tabs->addTab(w, QString("MA"));
  
}