package roart.category.impl;

import java.util.List;
import java.util.Map;

import roart.common.config.MyMyConfig;
import roart.common.constants.Constants;
import roart.indicator.AbstractIndicator;
import roart.indicator.impl.IndicatorMACD;
import roart.indicator.impl.IndicatorMove;
import roart.indicator.impl.IndicatorRSI;
import roart.model.StockItem;
import roart.model.data.MarketData;
import roart.model.data.PeriodData;
import roart.pipeline.Pipeline;
import roart.result.model.ResultItemTableRow;
import roart.stockutil.MetaUtil;
import roart.stockutil.StockUtil;

public class CategoryPeriod extends Category {

    Map<String, MarketData> marketdatamap;
    Map<String, PeriodData> periodDataMap;
    private Integer cy;
    
    public CategoryPeriod(MyMyConfig conf, int i, String periodText, List<StockItem> stocks,             Map<String, MarketData> marketdatamap,
            Map<String, PeriodData> periodDataMap,
            List<StockItem>[] datedstocklists, Pipeline[] datareaders) throws Exception {
        super(conf, periodText, stocks, datareaders);
        period = i;
        createResultMap(conf, stocks);
        indicators.add(new IndicatorMove(conf, "Δ" + getTitle(), datedstocklists, period));
        String market = conf.getMarket();
        MarketData marketData = marketdatamap.get(market);
        if (MetaUtil.currentYear(marketData, periodText)) {
            indicators.add(new IndicatorMACD(conf, getTitle() + " MACD", getTitle(), i, datareaders, false));
            indicators.add(new IndicatorRSI(conf, getTitle() + " RSI", getTitle(), i, datareaders, false));
            cy = i;
        }
        createIndicatorMap(periodText);
    }

    @Override
    public void addResultItemTitle(ResultItemTableRow r) {
        try {
            if (StockUtil.hasStockPeriod(stocks, period)) {
                r.add(getTitle());
                for (AbstractIndicator indicator : indicators) {
                    if (indicator.isEnabled()) {
                        r.addarr(indicator.getResultItemTitle());
                    }
                }
            }
        } catch (Exception e) {
            log.error(Constants.EXCEPTION, e);
        }
    }

    @Override
    public void addResultItem(ResultItemTableRow r, StockItem stock) {
        try {
            if (StockUtil.hasStockPeriod(stocks, period)) {
                r.addarr(resultMap.get(stock.getId()));
                for (AbstractIndicator indicator : indicators) {
                    if (indicator.isEnabled()) {
                        r.addarr(indicator.getResultItem(stock));
                    }
                }
            }
        } catch (Exception e) {
            log.error(Constants.EXCEPTION, e);
        }
    }

}

@@ -191,16 +191,100 @@
 icator;%0A
+import roart.indicator.impl.IndicatorATR;%0Aimport roart.indicator.impl.IndicatorCCI;%0A
 import r
@@ -403,16 +403,107 @@
 torRSI;%0A
+import roart.indicator.impl.IndicatorSTOCH;%0Aimport roart.indicator.impl.IndicatorSTOCHRSI;%0A
 import r
@@ -1766,32 +1766,474 @@
 aders, false));%0A
+            indicators.add(new IndicatorSTOCHRSI(conf, getTitle() + %22 SRSI%22, getTitle(), i, datareaders, false));%0A            indicators.add(new IndicatorSTOCH(conf, getTitle() + %22 STOCH%22, getTitle(), i, datareaders, false));%0A            indicators.add(new IndicatorATR(conf, getTitle() + %22 ATR%22, getTitle(), i, datareaders, false));%0A            indicators.add(new IndicatorCCI(conf, getTitle() + %22 CCI%22, getTitle(), i, datareaders, false));%0A
             cy =

Use other new indicators (I60).