当前位置: 首页>>代码示例>>C++>>正文


C++ PlotLine::setType方法代码示例

本文整理汇总了C++中PlotLine::setType方法的典型用法代码示例。如果您正苦于以下问题:C++ PlotLine::setType方法的具体用法?C++ PlotLine::setType怎么用?C++ PlotLine::setType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlotLine的用法示例。


在下文中一共展示了PlotLine::setType方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: calculateMA

void BARS::calculateMA (Indicator *output)
{
  if (maPeriod > 1)
  {
    PlotLine *in = data->getInput(maInput);
    if (in)
    {
      PlotLine *ma = getMA(in, maType, maPeriod);
      ma->setColor(maColor);
      ma->setType(maLineType);
      ma->setLabel(maLabel);
      output->addLine(ma);
      delete in;
    }
  }

  if (maPeriod2 > 1)
  {
    PlotLine *in = data->getInput(maInput2);
    if (in)
    {
      PlotLine *ma = getMA(in, maType2, maPeriod2);
      ma->setColor(maColor2);
      ma->setType(maLineType2);
      ma->setLabel(maLabel2);
      output->addLine(ma);
      delete in;
    }
  }

  if (maPeriod3 > 1)
  {
    PlotLine *in = data->getInput(maInput3);
    if (in)
    {
      PlotLine *ma = getMA(in, maType3, maPeriod3);
      ma->setColor(maColor3);
      ma->setType(maLineType3);
      ma->setLabel(maLabel3);
      output->addLine(ma);
      delete in;
    }
  }

  if (maPeriod4 > 1)
  {
    PlotLine *in = data->getInput(maInput4);
    if (in)
    {
      PlotLine *ma = getMA(in, maType4, maPeriod4);
      ma->setColor(maColor4);
      ma->setType(maLineType4);
      ma->setLabel(maLabel4);
      output->addLine(ma);
      delete in;
    }
  }
}
开发者ID:DigitalPig,项目名称:qtstalker-qt4,代码行数:58,代码来源:BARS.cpp

示例2:

/* Modified/Relative Japanese Candlesticks */
PlotLine * BARS::calculateCandle ()
{
  PlotLine *line = new PlotLine;

  for (int loop = 0; loop < (int) data->count(); loop++)
  {
    double O = data->getOpen(loop);
    double C = data->getClose(loop);
    QColor color = barNeutralColor;

    if (loop > 0)
    {
      if (C > data->getClose(loop - 1))
        color = barUpColor;
      if (C < data->getClose(loop - 1))
        color = barDownColor;
    }

    bool fillFlag = C < O ? TRUE : FALSE;

    line->append(color, O, data->getHigh(loop), data->getLow(loop), C, fillFlag);

    QDateTime dt;
    data->getDate(loop, dt);
    line->append(dt);
  }

  line->setType(PlotLine::Candle);
  line->setLabel(label);
  return line;
}
开发者ID:DigitalPig,项目名称:qtstalker-qt4,代码行数:32,代码来源:BARS.cpp

示例3: createPlot

void CUS::createPlot (QString &d, QDict<PlotLine> &lines, Indicator *output)
{
  if (! d.contains("plot"))
    return;

  QStringList l = QStringList::split("(", d, FALSE);
  if (l.count() != 2)
  {
    qDebug("CUS::createPlot: bad plot format: %s", d.ascii());
    return;
  }

  QString parms = l[1];
  parms.truncate(parms.find(")", -1, TRUE));
  l = QStringList::split(",", parms, FALSE);
  if (l.count() != 4)
  {
    qDebug("CUS::createPlot: missing plot parms: %s",d.ascii());
    return;
  }

  // 1.var name
  l[0] = l[0].stripWhiteSpace();
  PlotLine *pl = lines.find(l[0]);
  if (! pl)
  {
    qDebug("CUS::createPlot: bad plot parm 1: %s",d.ascii());
    return;
  }

  // 2.color
  l[1] = l[1].stripWhiteSpace();
  pl->setColor(l[1]);

  // 3.label
  l[2] = l[2].stripWhiteSpace();
  pl->setLabel(l[2]);

  // 4.linetype
  l[3] = l[3].stripWhiteSpace();
  pl->setType(l[3]);

  PlotLine *tline = new PlotLine;
  tline->copy(pl);
  output->addLine(tline);
}
开发者ID:botvs,项目名称:FinancialAnalytics,代码行数:46,代码来源:CUS.cpp

示例4: qDebug

Indicator * LOWPASS::calculate ()
{
  Indicator *output = new Indicator;
  output->setDateFlag(dateFlag);
  output->setLogScale(logScale);

  PlotLine *in = data->getInput(input);
  if (! in)
  {
    qDebug("LOWPASS::calculate: no input");
    return output;
  }

  PlotLine *line = getLowpass(in, freq, width);
  line->setColor(color);
  line->setType(lineType);
  line->setLabel(label);
  output->addLine(line);
  delete in;
  return output;
}
开发者ID:botvs,项目名称:FinancialAnalytics,代码行数:21,代码来源:LOWPASS.cpp

示例5: getPFSettings

/* Pont and Figure */
PlotLine * BARS::calculatePF ()
{
  PlotLine *line = new PlotLine;

  // determine start either x or o
  if (data->count() < 2)
    return line;

  getPFSettings();

  bool XOFlag = FALSE;
  if (data->getHigh(1) > data->getHigh(0))
    XOFlag = TRUE; // prices rising, we start with x's

  double high = 0;
  double d = data->getHigh(0) /  pfBoxSize;
  int t = (int) d;
  if (t * pfBoxSize <= data->getHigh(0))
    high = (t + 1) * pfBoxSize;
  else
    high = t * pfBoxSize;

  double low = 0;
  t = (int) (data->getLow(0) / pfBoxSize);
  low = t * pfBoxSize;

  int loop;
  for (loop = 1; loop < (int) data->count(); loop++)
  {
    if (XOFlag)
    {
      if (data->getHigh(loop) > high)
      {
        // new high
        d = data->getHigh(loop) /  pfBoxSize;
        t = (int) d;
        if (t * pfBoxSize <= data->getHigh(loop))
          high = (t + 1) * pfBoxSize;
        else
          high = t * pfBoxSize;
      }

      double reversal = high - (pfBoxSize * pfReversal);
      if (data->getLow(loop) < reversal)
      {
        // reversal to O's
        line->append(pfXColor, pfBoxSize, high, low, low, XOFlag);

        high = high - pfBoxSize; // lower high 1 box

        t = (int) (data->getLow(loop) / pfBoxSize);
        low = t * pfBoxSize;

        XOFlag = FALSE;
      }
    }
    else
    {
      if (data->getLow(loop) < low)
      {
        // new low
        t = (int) (data->getLow(loop) / pfBoxSize);
        low = t * pfBoxSize;
      }

      double reversal = low + (pfBoxSize * pfReversal);
      if (data->getHigh(loop) > reversal)
      {
        // reversal to X's
        line->append(pfOColor, pfBoxSize, high, low, low, XOFlag);

        low = low + pfBoxSize; // raise low 1 box

        d = data->getHigh(loop) /  pfBoxSize;
        t = (int) d;
        if (t * pfBoxSize <= data->getHigh(loop))
          high = (t + 1) * pfBoxSize;
        else
          high = t * pfBoxSize;

        XOFlag = TRUE;
      }
    }
  }

  if (XOFlag)
    line->append(pfXColor, pfBoxSize, high, low, low, XOFlag);
  else
    line->append(pfOColor, pfBoxSize, high, low, low, XOFlag);

  line->setType(PlotLine::PF);
  line->setLabel(label);
  return line;
}
开发者ID:DigitalPig,项目名称:qtstalker-qt4,代码行数:95,代码来源:BARS.cpp

示例6: color


//.........这里部分代码省略.........
        retCode = TA_SetOutputParamRealPtr(parmHolder, loop, &out2[0]);
        if (retCode != TA_SUCCESS)
          qDebug("TALIB::calculate:cannot set output2");
        break;      
      case 2:
        retCode = TA_SetOutputParamRealPtr(parmHolder, loop, &out3[0]);
        if (retCode != TA_SUCCESS)
          qDebug("TALIB::calculate:cannot set output3");
        break;
      default:
        break;
    }
  }

  // call the function
  TA_Integer start = 0;
  TA_Integer end = data->count() - 1;
  TA_Integer outstart;
  TA_Integer count;
  retCode = TA_CallFunc(parmHolder, start, end, &outstart, &count);
  if (retCode != TA_SUCCESS)
    qDebug("TALIB::calculate:call function failed");
  else
  {
    // create the plotlines
    const TA_OutputParameterInfo *outInfo;
    for (loop = 0; loop < (int) theInfo->nbOutput; loop++ )
    {
      TA_GetOutputParameterInfo(theInfo->handle, loop, &outInfo);
      QString base = outInfo->paramName;
      base = base.right(base.length() - 3);
      if (! base.left(4).compare("Real"))
        base = base.right(base.length() - 4);
      if (! base.left(7).compare("Integer"))
        base = base.right(base.length() - 7);
      if (! base.length())
        base = QObject::tr("Plot");

      PlotLine *line = new PlotLine;

      QString s = base + " " + QObject::tr("Color");
      parms.getData(s, ts);
      QColor color(ts);
      line->setColor(color);

      s = base + " " + QObject::tr("Label");
      parms.getData(s, ts);
      line->setLabel(ts);

      s = base + " " + QObject::tr("Line Type");
      line->setType((PlotLine::LineType)parms.getInt(s));

      retCode = TA_GetOutputParameterInfo(handle, loop, &outInfo);
      if (retCode != TA_SUCCESS)
      {
        qDebug("TALIB::calculate:cannot get output info");
        delete line;
        continue;
      }

      int loop2;
      switch (loop)
      {
        case 0:
          if (outInfo->type == TA_Output_Integer)
          {
            for (loop2 = 0; loop2 < count; loop2++)
              line->append((double) out4[loop2]);
          }
          else
          {
            for (loop2 = 0; loop2 < count; loop2++)
              line->append((double) out1[loop2]);
          }
          break;      
        case 1:
          for (loop2 = 0; loop2 < count; loop2++)
            line->append((double) out2[loop2]);
          break;      
        case 2:
          for (loop2 = 0; loop2 < count; loop2++)
            line->append((double) out3[loop2]);
          break;
        default:
          break;
      }

      if (line->getType() == PlotLine::Histogram || line->getType() == PlotLine::HistogramBar)
        output->prependLine(line);
      else
        output->addLine(line);
    }
  }

  retCode = TA_ParamHolderFree(parmHolder);
  if (retCode != TA_SUCCESS)
    qDebug("TALIB::calculate:can't delete parm holder");

  return output;
}
开发者ID:botvs,项目名称:FinancialAnalytics,代码行数:101,代码来源:TALIB.cpp

示例7: ba

PlotLine * ExScript::doScript ()
{
  if (proc)
  {
    delete proc;
    proc = 0;
  }

  PlotLine *line = new PlotLine();

  if (! scriptPath.length())
  {
    qDebug("ExScript::calculate: no script path");
    return line;
  }

  proc = new QProcess(this);
  connect(proc, SIGNAL(readyReadStdout()), this, SLOT(readFromStdout()));
  proc->setCommunication(QProcess::Stdin|QProcess::Stdout|QProcess::Stderr);
  proc->addArgument(scriptPath);

  QStringList l = QStringList::split(" ", comlineParms, FALSE);
  int loop;
  for (loop = 0; loop < (int) l.count(); loop++)
    proc->addArgument(l[loop]);

  buffer.truncate(0);

  QString s;
  if (dateFlag || openFlag || highFlag || lowFlag || closeFlag || volumeFlag || oiFlag)
    getInput(s);

  QByteArray ba(s.length());
  if (s.length())
  {
    for (loop = 0; loop < (int) s.length(); loop++)
      ba[loop] = s.at(loop).latin1();
  }

  if (! proc->launch(ba, NULL))
  {
    qDebug("ExScript::calculate: error starting script");
    delete proc;
    proc = 0;
    return line;
  }

  timer->start(seconds * 1000, FALSE);

  wakeup();

  while (proc->isRunning())
  {
    usleep(100);
    wakeup();
  }

  timer->stop();

  if (proc)
  {
    delete proc;
    proc = 0;
  }

  if (! buffer.length())
  {
    qDebug("ExScript::createOutput: output buffer empty");
    return line;
  }

  l = QStringList::split(",", buffer, FALSE);
  for (loop = 0; loop < (int) l.count(); loop++)
    line->append(l[loop].toDouble());

  line->setColor(color);
  line->setType(lineType);
  line->setLabel(label);
  return line;
}
开发者ID:botvs,项目名称:FinancialAnalytics,代码行数:80,代码来源:ExScript.cpp

示例8: getTHERM

void THERM::getTHERM (QPtrList<PlotLine> &pll)
{
  PlotLine *therm = new PlotLine();
  int loop;
  double thermometer = 0;
  for (loop = 1; loop < (int) data->count(); loop++)
  {
    double high = fabs(data->getHigh(loop) - data->getHigh(loop - 1));
    double lo = fabs(data->getLow(loop - 1) - data->getLow(loop));
    
    if (high > lo)
      thermometer = high;
    else
      thermometer = lo;

    therm->append(thermometer);
  }

  if (smoothing > 1)
  {
    PlotLine *ma = getMA(therm, smoothType, smoothing);
    pll.append(ma);
    delete therm;
    therm = ma;
  }
  else
    pll.append(therm);

  PlotLine *therm_ma = getMA(therm, maType, maPeriod);
  therm_ma->setColor(maColor);
  therm_ma->setType(maLineType);
  therm_ma->setLabel(maLabel);
  pll.append(therm_ma);

  // assign the therm colors

  therm->setColorFlag(TRUE);
  therm->setType(lineType);
  therm->setLabel(label);

  int thermLoop = therm->getSize() - 1;
  int maLoop = therm_ma->getSize() - 1;
  while (thermLoop > -1)
  {
    if (maLoop > -1)
    {
      double thrm = therm->getData(thermLoop);
      double thrmma = therm_ma->getData(maLoop);

      if (thrm > (thrmma * threshold))
        therm->setColorBar(thermLoop, threshColor);
      else
      {
        if (thrm > thrmma)
          therm->setColorBar(thermLoop, upColor);
        else
          therm->setColorBar(thermLoop, downColor);
      }
    }
    else
      therm->setColorBar(thermLoop, downColor);

    thermLoop--;
    maLoop--;
  }
}
开发者ID:botvs,项目名称:FinancialAnalytics,代码行数:66,代码来源:THERM.cpp

示例9: getPP

void PP::getPP (QPtrList<PlotLine> &pll)
{
  double high = data->getHigh(data->count() - 1);
  double low = data->getLow(data->count() - 1);
  double close = data->getClose(data->count() - 1);
  
  PlotLine *fr = new PlotLine();
  fr->setColor(resColor);
  fr->setType(resLineType);
  fr->setLabel(resLabel);
  double pp = (high + low + close) / 3;
  double t = (2 * pp) - low;
  fr->append(t);

  PlotLine *sr = new PlotLine();
  sr->setColor(resColor);
  sr->setType(resLineType);
  sr->setLabel(resLabel2);
  pp = (high + low + close) / 3;
  t = pp + (high - low);
  sr->append(t);

  PlotLine *thr = new PlotLine();
  thr->setColor(resColor);
  thr->setType(resLineType);
  thr->setLabel(resLabel3);
  pp = (high + low + close) / 3;
  t = (2 * pp) + (high - (2 * low));
  thr->append(t);

  PlotLine *fs = new PlotLine();
  fs->setColor(supColor);
  fs->setType(supLineType);
  fs->setLabel(supLabel);
  pp = (high + low + close) / 3;
  t = (2 * pp) - high;
  fs->append(t);

  PlotLine *ss = new PlotLine();
  ss->setColor(supColor);
  ss->setType(supLineType);
  ss->setLabel(supLabel2);
  pp = (high + low + close) / 3;
  t = pp - (high - low);
  ss->append(t);

  PlotLine *ts = new PlotLine();
  ts->setColor(supColor);
  ts->setType(supLineType);
  ts->setLabel(supLabel3);
  pp = (high + low + close) / 3;
  t = (2 * pp) - ((2 * high) - low);
  ts->append(t);

  pll.append(fr);
  pll.append(sr);
  pll.append(thr);
  pll.append(fs);
  pll.append(ss);
  pll.append(ts);
}
开发者ID:botvs,项目名称:FinancialAnalytics,代码行数:61,代码来源:PP.cpp


注:本文中的PlotLine::setType方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。