コード例 #1
0
  private HashMap<String, double[]> findMTMShorterAlligators(
      int width, Period basePeriod, int shift) throws JFException {
    HashMap<String, double[]> result = new HashMap<String, double[]>();

    int baseIndex = this.periods.indexOf(basePeriod);
    Period shortPeriod = this.periods.get(baseIndex + width);
    console.getOut().println("Short period " + shortPeriod.toString());

    IBar shortBar = history.getBar(instrument, shortPeriod, OfferSide.BID, shift);

    /*
     * not necessarily quickest double[][] longAlligator =
     * indicators.alligator(instrument, longPeriod, OfferSide.BID,
     * AppliedPrice.MEDIAN_PRICE, jaw, teeth, lips, longBar.getTime(),
     * longBar.getTime());
     *
     * double[][] shortAlligator = indicators.alligator(instrument,
     * shortPeriod, OfferSide.BID, AppliedPrice.MEDIAN_PRICE, jaw, teeth,
     * lips, shortBar.getTime(), shortBar.getTime());
     */

    double[] shortAlligator =
        indicators.alligator(
            instrument,
            shortPeriod,
            OfferSide.BID,
            AppliedPrice.MEDIAN_PRICE,
            jaw,
            teeth,
            lips,
            shift);

    double[] alligator =
        indicators.alligator(
            instrument,
            alligatorTimeframe,
            OfferSide.BID,
            AppliedPrice.MEDIAN_PRICE,
            jaw,
            teeth,
            lips,
            shift);

    result.put(shortPeriod.name(), shortAlligator);
    result.put(alligatorTimeframe.name(), alligator);

    console.getOut().println("result " + result.size());
    return result;
  }
コード例 #2
0
  private HashMap<String, double[]> findMTMLongerAlligators(int width, Period basePeriod, int shift)
      throws JFException {
    HashMap<String, double[]> result = new HashMap<String, double[]>();

    int baseIndex = this.periods.indexOf(basePeriod);
    Period longPeriod = this.periods.get(baseIndex - width);
    console.getOut().println("Long period " + longPeriod.toString());

    IBar longBar = history.getBar(instrument, longPeriod, OfferSide.BID, shift);

    double[] longAlligator =
        indicators.alligator(
            instrument,
            longPeriod,
            OfferSide.BID,
            AppliedPrice.MEDIAN_PRICE,
            jaw,
            teeth,
            lips,
            shift);

    double[] alligator =
        indicators.alligator(
            instrument,
            alligatorTimeframe,
            OfferSide.BID,
            AppliedPrice.MEDIAN_PRICE,
            jaw,
            teeth,
            lips,
            shift);

    result.put(alligatorTimeframe.name(), alligator);
    result.put(longPeriod.name(), longAlligator);

    return result;
  }