Explorar o código

图表指标提交

jieyu %!s(int64=4) %!d(string=hai) anos
pai
achega
5869440517

+ 2 - 2
RMA/app/src/main/java/cn/muchinfo/rma/view/base/app/Constant.kt

@@ -9,7 +9,7 @@ object Constant {
 //    const val baseurl = "http://103.40.249.123:38280/cfg?key=mtp_20" // 天津麦顿
 //    const val baseurl = "http://103.40.249.123:28280/cfg?key=mtp_20"//云融大宗
 //    const val baseurl = "http://103.40.249.123:8280/cfg?key=mtp_20"//千海金外盘
-//    const val baseurl = "http://103.40.249.127:28280/cfg?key=mtp_20"
+    const val baseurl = "http://103.40.249.127:28280/cfg?key=mtp_20"
 
 
 
@@ -20,7 +20,7 @@ object Constant {
 
 //    const val baseurl = "http://192.168.31.175:8080/cfg?key=test_175" // 8888  123123
 //    const val baseurl = "http://192.168.31.223:8080/cfg?key=test_223"
-//    const val baseurl: String = "http://192.168.31.139:8080/cfg?key=test_139"// 邓工
+//    const val baseurl: String = "http://192.168.31.139:8080/cfg?key=test_139"// 邓工    
 //
 //    const val baseurl = "http://192.168.31.176:8080/cfg?key=test_176" // 9999  123123  黄老板千海金
 //    const val baseurl = "http://192.168.31.171:8080/cfg?key=test_171" // 邓工 签约解约环境

+ 76 - 0
RMA/app/src/main/java/cn/muchinfo/rma/view/base/chart/ChartDataAdapter.kt

@@ -5,10 +5,14 @@ import cn.muchinfo.rma.global.data.GoodsInfoAndQuotes
 import cn.muchinfo.rma.global.data.chart.HistoryDatas
 import cn.muchinfo.rma.global.toShowTime
 import cn.muchinfo.rma.global.toTimeData
+import cn.muchinfo.rma.view.base.chart.old.controls.MTPChartControl
 import com.blankj.utilcode.util.TimeUtils
+import com.desfate.chart.data.ChartData
 import com.desfate.chart.entity.OHLCEntity
+import com.desfate.chart.entity.StickEntity
 import java.text.SimpleDateFormat
 import java.util.*
+import kotlin.collections.ArrayList
 
 /**
  * 数据在这里适配
@@ -73,5 +77,77 @@ class ChartDataAdapter {
         return arrayListOf()
     }
 
+    fun historyDataToChartData(history: List<HistoryDatas>): List<ChartData>{
+        if(history.isNotEmpty()){
+            return history.map {
+                val ohlcEntity = ChartData()
+                ohlcEntity.close = it.getClosePrice().toDouble()
+                ohlcEntity.high = it.getHighestPrice().toDouble()
+                ohlcEntity.low = it.getLowestPrice().toDouble()
+                ohlcEntity.open = it.getOpeningPrice().toDouble()
+                ohlcEntity.time = it.getTime().toShowTime()
+                ohlcEntity
+            }
+        }
+        return arrayListOf()
+    }
+
+    fun historyDataToStickList(history: List<HistoryDatas>, ohldate: ArrayList<OHLCEntity>): List<StickEntity>{
+        val stickList = arrayListOf<StickEntity>()
+        if(history.isNotEmpty()){
+            var dClose = 0.0
+            var dEMA12 = 0.0
+            var dEMA26 = 0.0
+            var dDIF = 0.0
+            var dDEA = 0.0
+            var dMACD = 0.0
+            ohldate.clear()
+            ohldate.addAll(historyDataToChartData(history))
+            ohldate.forEachIndexed { index, historyDatas ->
+                val chartData = historyDatas as ChartData
+                dClose = chartData.getClose()
+                if (index == 0) {
+                    dEMA12 = dClose
+                    dEMA26 = dClose
+                    dDIF = 0.0
+                    dDEA = 0.0
+                    dMACD = 0.0
+                } else {
+                    val lastChartData = ohldate[index - 1] as ChartData
+                    dEMA12 = MTPChartControl.getEMA12(lastChartData.getEMA12(), dClose)
+                    dEMA26 = MTPChartControl.getEMA26(lastChartData.getEMA26(), dClose)
+                    dDIF = MTPChartControl.getDIF(dEMA12, dEMA26)
+                    dDEA = MTPChartControl.getDEA(lastChartData.getDEA(), dDIF)
+                    dMACD = MTPChartControl.getMACD(dDIF, dDEA)
+                }
+
+                chartData.setEMA12(dEMA12)
+                chartData.setEMA26(dEMA26)
+                chartData.setDIF(dDIF)
+                chartData.setDEA(dDEA)
+                chartData.setMACD(dMACD)
+
+                if (index < stickList.size) {
+                    if (dMACD > 0) {
+                        stickList.get(index).setHigh(dMACD)
+                        stickList.get(index).setLow(0.0)
+                    } else {
+                        stickList.get(index).setHigh(0.0)
+                        stickList.get(index).setLow(dMACD)
+                    }
+                } else {
+                    if (dMACD > 0) {
+                        stickList.add(StickEntity(dMACD, 0.0, 2014))
+                    } else {
+                        stickList.add(StickEntity(0.0, dMACD, 2014))
+                    }
+                }
+            }
+        }
+        return stickList
+
+    }
+
+
 
 }

+ 320 - 344
RMA/app/src/main/java/cn/muchinfo/rma/view/base/chart/old/timeCharts/KChartFragment.java

@@ -273,8 +273,7 @@ public class KChartFragment extends Fragment {
         // 这里比较关键,某些事件OTCChartActivity.java需要监控到
         mtp_chart_target.addNotify(mtp_chart_k);
 
-        String[] tem = null;
-        if(getActivity() instanceof OTCChartActivity){
+//        if(getActivity() instanceof OTCChartActivity){
 //            if (((OTCChartActivity) getActivity()).getTradeMode() == MTPEnums.TRADEMODE_BIDDING) {// 竞价
 //                tem = getResources().getStringArray(R.array.chart_k_tab_bid);
 //            } else if (((OTCChartActivity) getActivity()).getTradeMode() == MTPEnums.TRADEMODE_MARKETMAKE) {// 做市--连续现货
@@ -284,8 +283,16 @@ public class KChartFragment extends Fragment {
 //            } else {
 //                tem = getResources().getStringArray(R.array.chart_k_tab_market);
 //            }
-        }
-
+        String[] tem = new String[8];
+            tem[0] = "VOL";
+            tem[1] = "MACD";
+            tem[2] = "RSI";
+            tem[3] = "PSY";
+            tem[4] = "DMA";
+            tem[5] = "KDJ";
+            tem[6] = "BIAS";
+            tem[7] = "CCI";
+//        }
         mtp_chart_k_tab.show(tem, false);
         mtp_chart_k_tab.selectTab(mtp_chart_k_tab.getCurrentIndxe());
     }
@@ -449,90 +456,90 @@ public class KChartFragment extends Fragment {
             minusstickchart.postInvalidate();
             return;
         }
-        ChartKDJDatas chartKDJDatas = new TargetControl().getKDJs(dataContainer);
-        List<LineEntity> lines = new ArrayList<LineEntity>();
-
-        /**
-         * k
-         */
-        LineEntity k = new LineEntity();
-        k.setLineData(chartKDJDatas.getK());
-        if(getActivity() instanceof OTCChartActivity) {
-            k.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getKDJKColor());
-        }
-        k.setStartIndex(8);
-        lines.add(k);
-
-        /**
-         * d
-         */
-        LineEntity d = new LineEntity();
-        d.setLineData(chartKDJDatas.getD());
-        if(getActivity() instanceof OTCChartActivity) {
-            d.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getKDJDColor());
-        }
-        d.setStartIndex(8);
-        lines.add(d);
-
-        /**
-         * j
-         */
-        LineEntity j = new LineEntity();
-        j.setLineData(chartKDJDatas.getJ());
-        if(getActivity() instanceof OTCChartActivity) {
-            j.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getKDJJColor());
-        }
-        j.setStartIndex(8);
-        lines.add(j);
-
-        minusstickchart.setLineData(lines);
-
-        minusstickchart.setShowStick(false);
-        List<StickEntity> stickDataList = new ArrayList<StickEntity>();
-        StickEntity stickEntity = null;
-        /**
-         * 计算出当前数据的最大最小值
-         */
-        for (int i = 0; i < chartKDJDatas.getK().size(); i++) {
-            if (i >= stickDataList.size()) {
-                stickEntity = new StickEntity();
-                stickDataList.add(stickEntity);
-            }
-            if (stickDataList.get(i).getHigh() < chartKDJDatas.getK().get(i) || stickDataList.get(i).getHigh() == 0) {
-                stickDataList.get(i).setHigh(chartKDJDatas.getK().get(i));
-            }
-            if (stickDataList.get(i).getLow() > chartKDJDatas.getK().get(i)) {
-                stickDataList.get(i).setLow(chartKDJDatas.getK().get(i));
-            }
-        }
-        for (int i = 0; i < chartKDJDatas.getD().size(); i++) {
-            if (i >= stickDataList.size()) {
-                stickEntity = new StickEntity();
-                stickDataList.add(stickEntity);
-            }
-            if (stickDataList.get(i).getHigh() < chartKDJDatas.getD().get(i)) {
-                stickDataList.get(i).setHigh(chartKDJDatas.getD().get(i));
-            }
-            if (stickDataList.get(i).getLow() > chartKDJDatas.getD().get(i)) {
-                stickDataList.get(i).setLow(chartKDJDatas.getD().get(i));
-            }
-        }
-        for (int i = 0; i < chartKDJDatas.getJ().size(); i++) {
-            if (i >= stickDataList.size()) {
-                stickEntity = new StickEntity();
-                stickDataList.add(stickEntity);
-            }
-            if (stickDataList.get(i).getHigh() < chartKDJDatas.getJ().get(i)) {
-                stickDataList.get(i).setHigh(chartKDJDatas.getJ().get(i));
-            }
-            if (stickDataList.get(i).getLow() > chartKDJDatas.getJ().get(i)) {
-                stickDataList.get(i).setLow(chartKDJDatas.getJ().get(i));
-            }
-        }
-        minusstickchart.setStickData(stickDataList);
-
-        minusstickchart.setDecimalNum(mDecimalNum);
-        minusstickchart.postInvalidate();
+//        ChartKDJDatas chartKDJDatas = new TargetControl().getKDJs(dataContainer);
+//        List<LineEntity> lines = new ArrayList<LineEntity>();
+//
+//        /**
+//         * k
+//         */
+//        LineEntity k = new LineEntity();
+//        k.setLineData(chartKDJDatas.getK());
+//        if(getActivity() instanceof OTCChartActivity) {
+//            k.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getKDJKColor());
+//        }
+//        k.setStartIndex(8);
+//        lines.add(k);
+//
+//        /**
+//         * d
+//         */
+//        LineEntity d = new LineEntity();
+//        d.setLineData(chartKDJDatas.getD());
+//        if(getActivity() instanceof OTCChartActivity) {
+//            d.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getKDJDColor());
+//        }
+//        d.setStartIndex(8);
+//        lines.add(d);
+//
+//        /**
+//         * j
+//         */
+//        LineEntity j = new LineEntity();
+//        j.setLineData(chartKDJDatas.getJ());
+//        if(getActivity() instanceof OTCChartActivity) {
+//            j.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getKDJJColor());
+//        }
+//        j.setStartIndex(8);
+//        lines.add(j);
+//
+//        minusstickchart.setLineData(lines);
+//
+//        minusstickchart.setShowStick(false);
+//        List<StickEntity> stickDataList = new ArrayList<StickEntity>();
+//        StickEntity stickEntity = null;
+//        /**
+//         * 计算出当前数据的最大最小值
+//         */
+//        for (int i = 0; i < chartKDJDatas.getK().size(); i++) {
+//            if (i >= stickDataList.size()) {
+//                stickEntity = new StickEntity();
+//                stickDataList.add(stickEntity);
+//            }
+//            if (stickDataList.get(i).getHigh() < chartKDJDatas.getK().get(i) || stickDataList.get(i).getHigh() == 0) {
+//                stickDataList.get(i).setHigh(chartKDJDatas.getK().get(i));
+//            }
+//            if (stickDataList.get(i).getLow() > chartKDJDatas.getK().get(i)) {
+//                stickDataList.get(i).setLow(chartKDJDatas.getK().get(i));
+//            }
+//        }
+//        for (int i = 0; i < chartKDJDatas.getD().size(); i++) {
+//            if (i >= stickDataList.size()) {
+//                stickEntity = new StickEntity();
+//                stickDataList.add(stickEntity);
+//            }
+//            if (stickDataList.get(i).getHigh() < chartKDJDatas.getD().get(i)) {
+//                stickDataList.get(i).setHigh(chartKDJDatas.getD().get(i));
+//            }
+//            if (stickDataList.get(i).getLow() > chartKDJDatas.getD().get(i)) {
+//                stickDataList.get(i).setLow(chartKDJDatas.getD().get(i));
+//            }
+//        }
+//        for (int i = 0; i < chartKDJDatas.getJ().size(); i++) {
+//            if (i >= stickDataList.size()) {
+//                stickEntity = new StickEntity();
+//                stickDataList.add(stickEntity);
+//            }
+//            if (stickDataList.get(i).getHigh() < chartKDJDatas.getJ().get(i)) {
+//                stickDataList.get(i).setHigh(chartKDJDatas.getJ().get(i));
+//            }
+//            if (stickDataList.get(i).getLow() > chartKDJDatas.getJ().get(i)) {
+//                stickDataList.get(i).setLow(chartKDJDatas.getJ().get(i));
+//            }
+//        }
+//        minusstickchart.setStickData(stickDataList);
+//
+//        minusstickchart.setDecimalNum(mDecimalNum);
+//        minusstickchart.postInvalidate();
 
     }
 
@@ -546,48 +553,48 @@ public class KChartFragment extends Fragment {
         if (dataContainer.mSize == 0) {
             return;
         }
-        BidChartTotalDatas bidChartTotalDatas = new TargetControl().getBidTotalData(dataContainer);
-        List<LineEntity> lines = new ArrayList<LineEntity>();
-
-        LineEntity total5 = new LineEntity();
-        total5.setStartIndex(5);
-        total5.setLineData(bidChartTotalDatas.getTotal5());
-        if(getActivity() instanceof OTCChartActivity) {
-            total5.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getVOL5Color());
-        }
-        lines.add(total5);
-
-        LineEntity total10 = new LineEntity();
-        total10.setStartIndex(10);
-        total10.setLineData(bidChartTotalDatas.getTotal10());
-        if(getActivity() instanceof OTCChartActivity) {
-            total10.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getVOL10Color());
-        }
-        lines.add(total10);
-
-        minusstickchart.setLineData(lines);
-        minusstickchart.setShowStick(true);
-        List<StickEntity> stickDataList = new ArrayList<StickEntity>();
-        StickEntity tem = null;
-        for (int i = 0; i < dataContainer.mOHLCList.size(); i++) {
-            tem = new StickEntity();
-            try {
-                tem.setHigh(Double.parseDouble(((ChartData) dataContainer.mOHLCList.get(i)).getVolume()));
-                if (dataContainer.mOHLCList.get(i).getClose() > dataContainer.mOHLCList.get(i).getOpen()) {
-                    tem.setColorFlag(1);
-                } else if (dataContainer.mOHLCList.get(i).getClose() == dataContainer.mOHLCList.get(i).getOpen()) {
-                    tem.setColorFlag(0);
-                } else {
-                    tem.setColorFlag(-1);
-                }
-                stickDataList.add(tem);
-            } catch (Exception e) {
-                e.printStackTrace();
-            }
-        }
-        minusstickchart.setStickData(stickDataList);
-        minusstickchart.setDecimalNum(mDecimalNum);
-        minusstickchart.postInvalidate();
+//        BidChartTotalDatas bidChartTotalDatas = new TargetControl().getBidTotalData(dataContainer);
+//        List<LineEntity> lines = new ArrayList<LineEntity>();
+//
+//        LineEntity total5 = new LineEntity();
+//        total5.setStartIndex(5);
+//        total5.setLineData(bidChartTotalDatas.getTotal5());
+//        if(getActivity() instanceof OTCChartActivity) {
+//            total5.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getVOL5Color());
+//        }
+//        lines.add(total5);
+//
+//        LineEntity total10 = new LineEntity();
+//        total10.setStartIndex(10);
+//        total10.setLineData(bidChartTotalDatas.getTotal10());
+//        if(getActivity() instanceof OTCChartActivity) {
+//            total10.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getVOL10Color());
+//        }
+//        lines.add(total10);
+//
+//        minusstickchart.setLineData(lines);
+//        minusstickchart.setShowStick(true);
+//        List<StickEntity> stickDataList = new ArrayList<StickEntity>();
+//        StickEntity tem = null;
+//        for (int i = 0; i < dataContainer.mOHLCList.size(); i++) {
+//            tem = new StickEntity();
+//            try {
+//                tem.setHigh(Double.parseDouble(((ChartData) dataContainer.mOHLCList.get(i)).getVolume()));
+//                if (dataContainer.mOHLCList.get(i).getClose() > dataContainer.mOHLCList.get(i).getOpen()) {
+//                    tem.setColorFlag(1);
+//                } else if (dataContainer.mOHLCList.get(i).getClose() == dataContainer.mOHLCList.get(i).getOpen()) {
+//                    tem.setColorFlag(0);
+//                } else {
+//                    tem.setColorFlag(-1);
+//                }
+//                stickDataList.add(tem);
+//            } catch (Exception e) {
+//                e.printStackTrace();
+//            }
+//        }
+//        minusstickchart.setStickData(stickDataList);
+//        minusstickchart.setDecimalNum(mDecimalNum);
+//        minusstickchart.postInvalidate();
     }
 
     private void setBIASLine(MinusStickChart minusstickchart, ChartDataContainer dataContainer) {
@@ -596,89 +603,89 @@ public class KChartFragment extends Fragment {
             return;
         }
 
-        ChartBIASDatas chartBIASDatas = new TargetControl().getBIASs(dataContainer);
-        List<LineEntity> lines = new ArrayList<LineEntity>();
-
-        /**
-         * bias6
-         */
-        LineEntity bias6 = new LineEntity();
-        bias6.setLineData(chartBIASDatas.getBias6());
-        if(getActivity() instanceof OTCChartActivity) {
-            bias6.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getBIAS6Color());
-        }
-        bias6.setStartIndex(5);
-        lines.add(bias6);
-
-        /**
-         * bias12
-         */
-        LineEntity bias12 = new LineEntity();
-        bias12.setLineData(chartBIASDatas.getBias12());
-        if(getActivity() instanceof OTCChartActivity) {
-            bias12.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getBIAS12Color());
-        }
-        bias12.setStartIndex(11);
-        lines.add(bias12);
-
-        /**
-         * bias24
-         */
-        LineEntity bias24 = new LineEntity();
-        bias24.setLineData(chartBIASDatas.getBias24());
-        if(getActivity() instanceof OTCChartActivity) {
-            bias24.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getBIAS24Color());
-        }
-        bias24.setStartIndex(23);
-        lines.add(bias24);
-
-        minusstickchart.setLineData(lines);
-
-        minusstickchart.setShowStick(false);
-        List<StickEntity> stickDataList = new ArrayList<StickEntity>();
-        StickEntity stickEntity = null;
-
-        for (int i = 0; i < chartBIASDatas.getBias6().size(); i++) {
-            if (i >= stickDataList.size()) {
-                stickEntity = new StickEntity();
-                stickDataList.add(stickEntity);
-            }
-            if (stickDataList.get(i).getHigh() < chartBIASDatas.getBias6().get(i)) {
-                stickDataList.get(i).setHigh(chartBIASDatas.getBias6().get(i));
-            }
-            if (stickDataList.get(i).getLow() > chartBIASDatas.getBias6().get(i)) {
-                stickDataList.get(i).setLow(chartBIASDatas.getBias6().get(i));
-            }
-        }
-        for (int i = 0; i < chartBIASDatas.getBias12().size(); i++) {
-            if (i >= stickDataList.size()) {
-                stickEntity = new StickEntity();
-                stickDataList.add(stickEntity);
-            }
-            if (stickDataList.get(i).getHigh() < chartBIASDatas.getBias12().get(i)) {
-                stickDataList.get(i).setHigh(chartBIASDatas.getBias12().get(i));
-            }
-            if (stickDataList.get(i).getLow() > chartBIASDatas.getBias12().get(i)) {
-                stickDataList.get(i).setLow(chartBIASDatas.getBias12().get(i));
-            }
-        }
-        for (int i = 0; i < chartBIASDatas.getBias24().size(); i++) {
-            if (i >= stickDataList.size()) {
-                stickEntity = new StickEntity();
-                stickDataList.add(stickEntity);
-            }
-            if (stickDataList.get(i).getHigh() < chartBIASDatas.getBias24().get(i)) {
-                stickDataList.get(i).setHigh(chartBIASDatas.getBias24().get(i));
-            }
-            if (stickDataList.get(i).getLow() > chartBIASDatas.getBias24().get(i)) {
-                stickDataList.get(i).setLow(chartBIASDatas.getBias24().get(i));
-            }
-        }
-
-        minusstickchart.setStickData(stickDataList);
-
-        minusstickchart.setDecimalNum(mDecimalNum);
-        minusstickchart.postInvalidate();
+//        ChartBIASDatas chartBIASDatas = new TargetControl().getBIASs(dataContainer);
+//        List<LineEntity> lines = new ArrayList<LineEntity>();
+//
+//        /**
+//         * bias6
+//         */
+//        LineEntity bias6 = new LineEntity();
+//        bias6.setLineData(chartBIASDatas.getBias6());
+//        if(getActivity() instanceof OTCChartActivity) {
+//            bias6.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getBIAS6Color());
+//        }
+//        bias6.setStartIndex(5);
+//        lines.add(bias6);
+//
+//        /**
+//         * bias12
+//         */
+//        LineEntity bias12 = new LineEntity();
+//        bias12.setLineData(chartBIASDatas.getBias12());
+//        if(getActivity() instanceof OTCChartActivity) {
+//            bias12.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getBIAS12Color());
+//        }
+//        bias12.setStartIndex(11);
+//        lines.add(bias12);
+//
+//        /**
+//         * bias24
+//         */
+//        LineEntity bias24 = new LineEntity();
+//        bias24.setLineData(chartBIASDatas.getBias24());
+//        if(getActivity() instanceof OTCChartActivity) {
+//            bias24.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getBIAS24Color());
+//        }
+//        bias24.setStartIndex(23);
+//        lines.add(bias24);
+//
+//        minusstickchart.setLineData(lines);
+//
+//        minusstickchart.setShowStick(false);
+//        List<StickEntity> stickDataList = new ArrayList<StickEntity>();
+//        StickEntity stickEntity = null;
+//
+//        for (int i = 0; i < chartBIASDatas.getBias6().size(); i++) {
+//            if (i >= stickDataList.size()) {
+//                stickEntity = new StickEntity();
+//                stickDataList.add(stickEntity);
+//            }
+//            if (stickDataList.get(i).getHigh() < chartBIASDatas.getBias6().get(i)) {
+//                stickDataList.get(i).setHigh(chartBIASDatas.getBias6().get(i));
+//            }
+//            if (stickDataList.get(i).getLow() > chartBIASDatas.getBias6().get(i)) {
+//                stickDataList.get(i).setLow(chartBIASDatas.getBias6().get(i));
+//            }
+//        }
+//        for (int i = 0; i < chartBIASDatas.getBias12().size(); i++) {
+//            if (i >= stickDataList.size()) {
+//                stickEntity = new StickEntity();
+//                stickDataList.add(stickEntity);
+//            }
+//            if (stickDataList.get(i).getHigh() < chartBIASDatas.getBias12().get(i)) {
+//                stickDataList.get(i).setHigh(chartBIASDatas.getBias12().get(i));
+//            }
+//            if (stickDataList.get(i).getLow() > chartBIASDatas.getBias12().get(i)) {
+//                stickDataList.get(i).setLow(chartBIASDatas.getBias12().get(i));
+//            }
+//        }
+//        for (int i = 0; i < chartBIASDatas.getBias24().size(); i++) {
+//            if (i >= stickDataList.size()) {
+//                stickEntity = new StickEntity();
+//                stickDataList.add(stickEntity);
+//            }
+//            if (stickDataList.get(i).getHigh() < chartBIASDatas.getBias24().get(i)) {
+//                stickDataList.get(i).setHigh(chartBIASDatas.getBias24().get(i));
+//            }
+//            if (stickDataList.get(i).getLow() > chartBIASDatas.getBias24().get(i)) {
+//                stickDataList.get(i).setLow(chartBIASDatas.getBias24().get(i));
+//            }
+//        }
+//
+//        minusstickchart.setStickData(stickDataList);
+//
+//        minusstickchart.setDecimalNum(mDecimalNum);
+//        minusstickchart.postInvalidate();
     }
 
     private void setDMALine(MinusStickChart minusstickchart, ChartDataContainer dataContainer) {
@@ -686,38 +693,38 @@ public class KChartFragment extends Fragment {
             minusstickchart.postInvalidate();
             return;
         }
-        ChartDMADatas chartDMADatas = new TargetControl().getDMAs(dataContainer);
-        List<LineEntity> lines = new ArrayList<LineEntity>();
-
-        /**
-         * DMA
-         */
-        LineEntity dma = new LineEntity();
-        dma.setLineData(chartDMADatas.getDMA());
-        if(getActivity() instanceof OTCChartActivity) {
-            dma.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getDMAColor());
-        }
-        dma.setStartIndex(49);
-        lines.add(dma);
-
-        /**
-         * AMA
-         */
-        LineEntity ama = new LineEntity();
-        ama.setLineData(chartDMADatas.getAMA());
-        if(getActivity() instanceof OTCChartActivity) {
-            ama.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getDMAAMAColor());
-        }
-        ama.setStartIndex(5);
-        lines.add(ama);
-
-        minusstickchart.setLineData(lines);
-
-        minusstickchart.setShowStick(false);
-        minusstickchart.setStickData(dataContainer.mStickList.subList(0, dataContainer.mSize));
-
-        minusstickchart.setDecimalNum(mDecimalNum);
-        minusstickchart.postInvalidate();
+//        ChartDMADatas chartDMADatas = new TargetControl().getDMAs(dataContainer);
+//        List<LineEntity> lines = new ArrayList<LineEntity>();
+//
+//        /**
+//         * DMA
+//         */
+//        LineEntity dma = new LineEntity();
+//        dma.setLineData(chartDMADatas.getDMA());
+//        if(getActivity() instanceof OTCChartActivity) {
+//            dma.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getDMAColor());
+//        }
+//        dma.setStartIndex(49);
+//        lines.add(dma);
+//
+//        /**
+//         * AMA
+//         */
+//        LineEntity ama = new LineEntity();
+//        ama.setLineData(chartDMADatas.getAMA());
+//        if(getActivity() instanceof OTCChartActivity) {
+//            ama.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getDMAAMAColor());
+//        }
+//        ama.setStartIndex(5);
+//        lines.add(ama);
+//
+//        minusstickchart.setLineData(lines);
+//
+//        minusstickchart.setShowStick(false);
+//        minusstickchart.setStickData(dataContainer.mStickList.subList(0, dataContainer.mSize));
+//
+//        minusstickchart.setDecimalNum(mDecimalNum);
+//        minusstickchart.postInvalidate();
     }
 
     /**
@@ -731,27 +738,27 @@ public class KChartFragment extends Fragment {
             minusstickchart.postInvalidate();
             return;
         }
-        List<Double> cci = new TargetControl().getCCIs(dataContainer);
-        List<LineEntity> lines = new ArrayList<LineEntity>();
-
-        /**
-         * cci
-         */
-        LineEntity cciLine = new LineEntity();
-        cciLine.setLineData(cci);
-        if(getActivity() instanceof OTCChartActivity) {
-            cciLine.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getCCIColor());
-        }
-        cciLine.setStartIndex(12);
-        lines.add(cciLine);
-
-        minusstickchart.setLineData(lines);
-
-        minusstickchart.setShowStick(false);
-        minusstickchart.setStickData(dataContainer.mStickList.subList(0, dataContainer.mSize));
-
-        minusstickchart.setDecimalNum(mDecimalNum);
-        minusstickchart.postInvalidate();
+//        List<Double> cci = new TargetControl().getCCIs(dataContainer);
+//        List<LineEntity> lines = new ArrayList<LineEntity>();
+//
+//        /**
+//         * cci
+//         */
+//        LineEntity cciLine = new LineEntity();
+//        cciLine.setLineData(cci);
+//        if(getActivity() instanceof OTCChartActivity) {
+//            cciLine.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getCCIColor());
+//        }
+//        cciLine.setStartIndex(12);
+//        lines.add(cciLine);
+//
+//        minusstickchart.setLineData(lines);
+//
+//        minusstickchart.setShowStick(false);
+//        minusstickchart.setStickData(dataContainer.mStickList.subList(0, dataContainer.mSize));
+//
+//        minusstickchart.setDecimalNum(mDecimalNum);
+//        minusstickchart.postInvalidate();
     }
 
     /**
@@ -815,52 +822,52 @@ public class KChartFragment extends Fragment {
             return;
         }
 
-        /**
-         * RSI 5
-         */
-        List<LineEntity> lines = new ArrayList<LineEntity>();
-        ChartRSIDatas rsiData = new TargetControl().getRSI(dataContainer);
-
-        LineEntity rsi = new LineEntity();
-        rsi.setLineData(rsiData.getRsi6());
-        if(getActivity() instanceof OTCChartActivity) {
-            rsi.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getRSI6Color());
-        }
-        rsi.setStartIndex(5);
-        lines.add(rsi);
-
-        LineEntity rsi12 = new LineEntity();
-        rsi12.setLineData(rsiData.getRsi12());
-        if(getActivity() instanceof OTCChartActivity) {
-            rsi12.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getRSI12Color());
-        }
-        rsi12.setStartIndex(11);
-        lines.add(rsi12);
-
-
-        LineEntity rsi24 = new LineEntity();
-        rsi24.setLineData(rsiData.getRsi24());
-        if(getActivity() instanceof OTCChartActivity) {
-            rsi24.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getRSI24Color());
-        }
-        rsi24.setStartIndex(23);
-        lines.add(rsi24);
-
-        minusstickchart.setLineData(lines);
-
-        List<StickEntity> entities = new ArrayList<StickEntity>();
-        StickEntity entity = null;
-        for (int i = 0; i < dataContainer.mStickList.subList(0, dataContainer.mSize).size(); i++) {
-            entity = new StickEntity();
-            entity.setHigh(100.0);
-            entity.setLow(0.0);
-            entities.add(entity);
-        }
-
-        minusstickchart.setShowStick(false);
-        minusstickchart.setStickData(entities);
-        minusstickchart.setDecimalNum(mDecimalNum);
-        minusstickchart.postInvalidate();
+//        /**
+//         * RSI 5
+//         */
+//        List<LineEntity> lines = new ArrayList<LineEntity>();
+//        ChartRSIDatas rsiData = new TargetControl().getRSI(dataContainer);
+//
+//        LineEntity rsi = new LineEntity();
+//        rsi.setLineData(rsiData.getRsi6());
+//        if(getActivity() instanceof OTCChartActivity) {
+//            rsi.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getRSI6Color());
+//        }
+//        rsi.setStartIndex(5);
+//        lines.add(rsi);
+//
+//        LineEntity rsi12 = new LineEntity();
+//        rsi12.setLineData(rsiData.getRsi12());
+//        if(getActivity() instanceof OTCChartActivity) {
+//            rsi12.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getRSI12Color());
+//        }
+//        rsi12.setStartIndex(11);
+//        lines.add(rsi12);
+//
+//
+//        LineEntity rsi24 = new LineEntity();
+//        rsi24.setLineData(rsiData.getRsi24());
+//        if(getActivity() instanceof OTCChartActivity) {
+//            rsi24.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getRSI24Color());
+//        }
+//        rsi24.setStartIndex(23);
+//        lines.add(rsi24);
+//
+//        minusstickchart.setLineData(lines);
+//
+//        List<StickEntity> entities = new ArrayList<StickEntity>();
+//        StickEntity entity = null;
+//        for (int i = 0; i < dataContainer.mStickList.subList(0, dataContainer.mSize).size(); i++) {
+//            entity = new StickEntity();
+//            entity.setHigh(100.0);
+//            entity.setLow(0.0);
+//            entities.add(entity);
+//        }
+//
+//        minusstickchart.setShowStick(false);
+//        minusstickchart.setStickData(entities);
+//        minusstickchart.setDecimalNum(mDecimalNum);
+//        minusstickchart.postInvalidate();
     }
 
     /**
@@ -873,38 +880,7 @@ public class KChartFragment extends Fragment {
         if (dataContainer.mSize == 0) {
             return;
         }
-        ChartPSYDatas chartPSYDatas = new TargetControl().getPSYs(dataContainer);
-        List<LineEntity> lines = new ArrayList<LineEntity>();
-
-        /**
-         * psy
-         */
-        LineEntity psy = new LineEntity();
-        psy.setLineData(chartPSYDatas.getPsy());
-        if(getActivity() instanceof OTCChartActivity) {
-            psy.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getPSYColor());
-        }
-        psy.setStartIndex(25);
-        lines.add(psy);
-
-        /**
-         * psyMa
-         */
-        LineEntity psyMa = new LineEntity();
-        psyMa.setLineData(chartPSYDatas.getPsyMa());
-            if(getActivity() instanceof OTCChartActivity) {
-                psyMa.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getPSYMAColor());
-            }
-        psyMa.setStartIndex(25);
-        lines.add(psyMa);
-
-        minusstickchart.setLineData(lines);
-
-        minusstickchart.setShowStick(false);
-        minusstickchart.setStickData(dataContainer.mStickList.subList(0, dataContainer.mSize));
-
-        minusstickchart.setDecimalNum(mDecimalNum);
-        minusstickchart.postInvalidate();
+//       setCCILine
     }
 
     private int getNowPriceColor() {

+ 91 - 5
RMA/app/src/main/java/cn/muchinfo/rma/view/base/chart/old/timeCharts/KChartView.java

@@ -1,5 +1,7 @@
 package cn.muchinfo.rma.view.base.chart.old.timeCharts;
 
+import static com.blankj.utilcode.util.StringUtils.getString;
+
 import android.content.Context;
 import android.graphics.Color;
 import android.util.AttributeSet;
@@ -13,8 +15,12 @@ import androidx.annotation.Nullable;
 import com.desfate.chart.ChartConstant;
 import com.desfate.chart.GridChart;
 import com.desfate.chart.MACandleStickChart;
+import com.desfate.chart.MTPTabHost;
+import com.desfate.chart.MTPTabHostListener;
 import com.desfate.chart.MinusStickChart;
+import com.desfate.chart.data.ChartDataContainer;
 import com.desfate.chart.entity.LineEntity;
+import com.desfate.chart.event.ITouchEventResponse;
 
 import java.util.ArrayList;
 import java.util.List;
@@ -23,6 +29,7 @@ import cn.muchinfo.rma.R;
 import cn.muchinfo.rma.global.data.chart.HistoryDatas;
 import cn.muchinfo.rma.view.base.chart.ChartDataAdapter;
 import cn.muchinfo.rma.view.base.chart.KChartTools;
+import cn.muchinfo.rma.view.base.chart.old.controls.OTCChartControl;
 
 public class KChartView extends FrameLayout {
 
@@ -30,9 +37,10 @@ public class KChartView extends FrameLayout {
     Context context;
     MACandleStickChart candle_chart;
     MinusStickChart minusStickChart;
+    MTPTabHost tab;
     TextView info_text;
     String state = ChartConstant.BIAS;
-
+    List<HistoryDatas> history = new ArrayList<>();
     public KChartView(@NonNull Context context) {
         super(context);
         this.context = context;
@@ -50,9 +58,22 @@ public class KChartView extends FrameLayout {
         candle_chart = view.findViewById(R.id.candle_chart);
         minusStickChart = view.findViewById(R.id.minus_chart);
         info_text = view.findViewById(R.id.info_text);
-
+        tab = view.findViewById(R.id.mtp_chart_k_tab);
         setCandleChartConfig();
         setMinusStickChartConfig();
+
+        initMinusInfo();
+
+        tab.setOnMtpTabHostListener(new MTPTabHostListener() {
+            @Override
+            public void onTabChanged(int current, int last, View view) {
+                if (current == last) {
+                    return;
+                }
+                setStickChart();
+                showSum(minusStickChart, 0);
+            }
+        });
     }
 
     /**
@@ -128,6 +149,8 @@ public class KChartView extends FrameLayout {
      */
     public void setDates(String goodsCode, List<HistoryDatas> history){
         if(history == null || history.isEmpty()) return; // 没有数据
+        this.history.clear();
+        this.history.addAll(history);
         // 这是需要画的线
         List<LineEntity> lines = new ArrayList<>();
         LineEntity M5Line = new LineEntity();;
@@ -158,20 +181,83 @@ public class KChartView extends FrameLayout {
         LineEntity MA5 = candle_chart.getLineData().get(0);
         LineEntity MA10 = candle_chart.getLineData().get(1);
         LineEntity MA15 = candle_chart.getLineData().get(2);
+        if (MA5.getLineData() == null || MA10.getLineData() == null || MA15.getLineData() == null) {
+            setStickChart();
+            return;
+        }
         double ma5Val = MA5.getLineData().get(MA5.getLineData().size() - 1);
         double ma10Val = MA10.getLineData().get(MA10.getLineData().size() - 1);
         double ma15Val = MA15.getLineData().get(MA15.getLineData().size() - 1);
 
         candle_chart.setDecimalNum(new ChartDataAdapter().getGoodsInfoMarket(goodsCode).getGoodsInfo().getDecimalplace());
         candle_chart.invalidate();
+        setStickChart();
     }
 
 
+    public void initMinusInfo(){
+        minusStickChart.addNotify(candle_chart);
+//        mtp_chart_k.addNotify((ITouchEventResponse) getActivity());// FIXME :
+        // 这里比较关键,某些事件OTCChartActivity.java需要监控到
+        candle_chart.addNotify(minusStickChart);
+        String[] tem = new String[7];
+//        tem[0] = "VOL";
+        tem[0] = "MACD";
+        tem[1] = "RSI";
+        tem[2] = "PSY";
+        tem[3] = "DMA";
+        tem[4] = "KDJ";
+        tem[5] = "BIAS";
+        tem[6] = "CCI";
+        tab.show(tem, false);
+        tab.selectTab(tab.getCurrentIndxe());
+    }
 
+    public void setStickChart(){
+        try {
+            String textString = tab.getCurrentValue();
 
+            if (getString(R.string.mtp_rsi).equals(textString)) {
+                StickChartTools.setRSILine(context, minusStickChart, this.history);
+            }
+            else if (getString(R.string.mtp_macd).equals(textString)) {
+                StickChartTools.setMinusStickData(context, minusStickChart, this.history);
+            }
+            else if (getString(R.string.mtp_psy).equals(textString)) {
+                StickChartTools.setPSYLine(context, minusStickChart, this.history);
+            }
+            else if (getString(R.string.mtp_cci).equals(textString)) {
+                StickChartTools.setCCILine(context, minusStickChart, this.history);
+            }
+            else if (getString(R.string.mtp_dma).equals(textString)) {
+                StickChartTools.setDMALine(context ,minusStickChart, this.history);
+            }
+            else if (getString(R.string.mtp_kdj).equals(textString)) {
+                StickChartTools.setKDJLine(context, minusStickChart, this.history);
+            }
+            else if (getString(R.string.mtp_bias).equals(textString)) {
+                StickChartTools.setBIASLine(context, minusStickChart, this.history);
+            }
+            else if (getString(R.string.tas_total).equals(textString)) {
+                StickChartTools.setBidTotalLine(context, minusStickChart, this.history);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 
-
-
-
+    /**
+     * 显示最后一笔的值
+     *
+     * @param minusStickChart
+     * @param index
+     */
+    private void showSum(MinusStickChart minusStickChart, int index) {
+        try {
+            String textString = tab.getCurrentValue();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
 
 }

+ 393 - 15
RMA/app/src/main/java/cn/muchinfo/rma/view/base/chart/old/timeCharts/StickChartTools.java

@@ -3,16 +3,24 @@ package cn.muchinfo.rma.view.base.chart.old.timeCharts;
 import android.content.Context;
 
 import com.desfate.chart.MinusStickChart;
+import com.desfate.chart.data.BidChartTotalDatas;
+import com.desfate.chart.data.ChartBIASDatas;
+import com.desfate.chart.data.ChartDMADatas;
+import com.desfate.chart.data.ChartData;
 import com.desfate.chart.data.ChartDataContainer;
+import com.desfate.chart.data.ChartKDJDatas;
 import com.desfate.chart.data.ChartPSYDatas;
 import com.desfate.chart.data.ChartRSIDatas;
 import com.desfate.chart.entity.LineEntity;
+import com.desfate.chart.entity.OHLCEntity;
 import com.desfate.chart.entity.StickEntity;
 import com.desfate.chart.ui.old.OTC.controls.TargetControl;
 
 import java.util.ArrayList;
 import java.util.List;
 
+import cn.muchinfo.rma.global.data.chart.HistoryDatas;
+import cn.muchinfo.rma.view.base.chart.ChartDataAdapter;
 import cn.muchinfo.rma.view.base.chart.old.OTCChartActivity;
 
 /**
@@ -24,10 +32,11 @@ public class StickChartTools {
      * RSI 周期为6
      *
      * @param minusstickchart
-     * @param dataContainer
      */
-    private void setRSILine(Context context, MinusStickChart minusstickchart, ChartDataContainer dataContainer) {
-        if (dataContainer.mSize == 0) {
+     public static void setRSILine(Context context, MinusStickChart minusstickchart, List<HistoryDatas> history) {
+         List<OHLCEntity> ohlcList = new ChartDataAdapter().historyDataToOHLDate(history);
+
+        if (ohlcList.size() == 0) {
             minusstickchart.postInvalidate();
             return;
         }
@@ -36,7 +45,7 @@ public class StickChartTools {
          * RSI 5
          */
         List<LineEntity> lines = new ArrayList<LineEntity>();
-        ChartRSIDatas rsiData = new TargetControl().getRSI(dataContainer);
+        ChartRSIDatas rsiData = new TargetControl().getRSI(ohlcList);
 
         LineEntity rsi = new LineEntity();
         rsi.setLineData(rsiData.getRsi6());
@@ -61,7 +70,7 @@ public class StickChartTools {
 
         List<StickEntity> entities = new ArrayList<StickEntity>();
         StickEntity entity = null;
-        for (int i = 0; i < dataContainer.mStickList.subList(0, dataContainer.mSize).size(); i++) {
+        for (int i = 0; i < ohlcList.size(); i++) {
             entity = new StickEntity();
             entity.setHigh(100.0);
             entity.setLow(0.0);
@@ -78,13 +87,15 @@ public class StickChartTools {
      * 26 6 PSY
      *
      * @param minusstickchart
-     * @param dataContainer
      */
-    private void setPSYLine(MinusStickChart minusstickchart, ChartDataContainer dataContainer) {
-        if (dataContainer.mSize == 0) {
+    public static void setPSYLine(Context context, MinusStickChart minusstickchart, List<HistoryDatas> history) {
+        if (history.size() == 0) {
             return;
         }
-        ChartPSYDatas chartPSYDatas = new TargetControl().getPSYs(dataContainer);
+        ArrayList<OHLCEntity> ohlcList = new ArrayList<>();
+        List<StickEntity> stickEntity = new ChartDataAdapter().historyDataToStickList(history, ohlcList);
+
+        ChartPSYDatas chartPSYDatas = new TargetControl().getPSYs(ohlcList);
         List<LineEntity> lines = new ArrayList<LineEntity>();
 
         /**
@@ -92,8 +103,7 @@ public class StickChartTools {
          */
         LineEntity psy = new LineEntity();
         psy.setLineData(chartPSYDatas.getPsy());
-
-//        psy.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getPSYColor());
+        psy.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_psy));
 
         psy.setStartIndex(25);
         lines.add(psy);
@@ -103,8 +113,7 @@ public class StickChartTools {
          */
         LineEntity psyMa = new LineEntity();
         psyMa.setLineData(chartPSYDatas.getPsyMa());
-
-//        psyMa.setLineColor(((OTCChartActivity) getActivity()).getMtpChartControl().getPSYMAColor());
+        psy.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_psy_ma));
 
         psyMa.setStartIndex(25);
         lines.add(psyMa);
@@ -112,9 +121,378 @@ public class StickChartTools {
         minusstickchart.setLineData(lines);
 
         minusstickchart.setShowStick(false);
-        minusstickchart.setStickData(dataContainer.mStickList.subList(0, dataContainer.mSize));
+        minusstickchart.setStickData(stickEntity);
 
-//        minusstickchart.setDecimalNum(mDecimalNum);
+        minusstickchart.setDecimalNum(2);
+        minusstickchart.postInvalidate();
+    }
+
+    /**
+     * xia
+     *
+     * @param minusstickchart
+     */
+    public static void setMinusStickData(Context context, MinusStickChart minusstickchart, List<HistoryDatas> history) {
+        ArrayList<OHLCEntity> ohlcList = new ArrayList<>();
+        List<StickEntity> stickEntity = new ChartDataAdapter().historyDataToStickList(history, ohlcList);
+        if (ohlcList.size() == 0) {
+            minusstickchart.postInvalidate();
+            return;
+        }
+        List<LineEntity> lines = new ArrayList<LineEntity>();
+
+        // 计算 DEA 的移动平均
+        LineEntity DEA = new LineEntity();
+
+        DEA.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_macd_dea));
+        // 计算 DIF 线,这个就是 MACD 的核心线
+        LineEntity DIF = new LineEntity();
+        DIF.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_macd_dif));
+
+        List<Double> DEAValues = new ArrayList<Double>();
+        List<Double> DIFValues = new ArrayList<Double>();
+        ChartData chartData;
+        for (int i = 0; i < ohlcList.size(); i++) {
+            if (ohlcList.size() != i) {
+                chartData = (ChartData) ohlcList.get(i);
+                DEAValues.add(chartData.getDEA());
+                DIFValues.add(chartData.getDIF());
+            }
+        }
+
+        DEA.setLineData(DEAValues);
+        DEA.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_macd_dea));
+
+        lines.add(DEA);
+        DIF.setLineData(DIFValues);
+        lines.add(DIF);
+        minusstickchart.setLineData(lines);
+        minusstickchart.setShowStick(true);
+        minusstickchart.setStickData(stickEntity);
+        minusstickchart.setDecimalNum(2);
+        minusstickchart.postInvalidate();
+    }
+
+    /**
+     * cci
+     *
+     * @param minusstickchart
+     */
+    public static void setCCILine(Context context, MinusStickChart minusstickchart, List<HistoryDatas> history) {
+        ArrayList<OHLCEntity> ohlcList = new ArrayList<>();
+        List<StickEntity> stickEntity = new ChartDataAdapter().historyDataToStickList(history, ohlcList);
+        if (history.size() == 0) {
+            minusstickchart.postInvalidate();
+            return;
+        }
+        List<Double> cci = new TargetControl().getCCIs(ohlcList);
+        List<LineEntity> lines = new ArrayList<LineEntity>();
+
+        /**
+         * cci
+         */
+        LineEntity cciLine = new LineEntity();
+        cciLine.setLineData(cci);
+
+        cciLine.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_cci));
+
+
+        cciLine.setStartIndex(12);
+        lines.add(cciLine);
+
+        minusstickchart.setLineData(lines);
+
+        minusstickchart.setShowStick(false);
+        minusstickchart.setStickData(stickEntity);
+
+        minusstickchart.setDecimalNum(2);
+        minusstickchart.postInvalidate();
+    }
+
+
+    public static void setDMALine(Context context, MinusStickChart minusstickchart, List<HistoryDatas> history) {
+        ArrayList<OHLCEntity> ohlcList = new ArrayList<>();
+        List<StickEntity> stickEntity = new ChartDataAdapter().historyDataToStickList(history, ohlcList);
+        if (history.size() == 0) {
+            minusstickchart.postInvalidate();
+            return;
+        }
+        ChartDMADatas chartDMADatas = new TargetControl().getDMAs(ohlcList);
+        List<LineEntity> lines = new ArrayList<LineEntity>();
+
+        /**
+         * DMA
+         */
+        LineEntity dma = new LineEntity();
+        dma.setLineData(chartDMADatas.getDMA());
+
+        dma.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_dma));
+
+
+        dma.setStartIndex(49);
+        lines.add(dma);
+
+        /**
+         * AMA
+         */
+        LineEntity ama = new LineEntity();
+        ama.setLineData(chartDMADatas.getAMA());
+        ama.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_dma_ama));
+
+        ama.setStartIndex(5);
+        lines.add(ama);
+
+        minusstickchart.setLineData(lines);
+
+        minusstickchart.setShowStick(false);
+        minusstickchart.setStickData(stickEntity);
+
+        minusstickchart.setDecimalNum(2);
+        minusstickchart.postInvalidate();
+    }
+
+    public static void setKDJLine(Context context, MinusStickChart minusstickchart,  List<HistoryDatas> history) {
+        ArrayList<OHLCEntity> ohlcList = new ArrayList<>();
+        List<StickEntity> stickEntity2 = new ChartDataAdapter().historyDataToStickList(history, ohlcList);
+        if (history.size() == 0) {
+            minusstickchart.postInvalidate();
+            return;
+        }
+        ChartKDJDatas chartKDJDatas = new TargetControl().getKDJs(ohlcList);
+        List<LineEntity> lines = new ArrayList<LineEntity>();
+
+        /**
+         * k
+         */
+        LineEntity k = new LineEntity();
+        k.setLineData(chartKDJDatas.getK());
+
+        k.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_kdj_k));
+
+
+        k.setStartIndex(8);
+        lines.add(k);
+
+        /**
+         * d
+         */
+        LineEntity d = new LineEntity();
+        d.setLineData(chartKDJDatas.getD());
+        d.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_kdj_d));
+
+
+        d.setStartIndex(8);
+        lines.add(d);
+
+        /**
+         * j
+         */
+        LineEntity j = new LineEntity();
+        j.setLineData(chartKDJDatas.getJ());
+
+        j.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_kdj_j));
+
+
+        j.setStartIndex(8);
+        lines.add(j);
+
+        minusstickchart.setLineData(lines);
+
+        minusstickchart.setShowStick(false);
+        List<StickEntity> stickDataList = new ArrayList<StickEntity>();
+        StickEntity stickEntity = null;
+        /**
+         * 计算出当前数据的最大最小值
+         */
+        for (int i = 0; i < chartKDJDatas.getK().size(); i++) {
+            if (i >= stickDataList.size()) {
+                stickEntity = new StickEntity();
+                stickDataList.add(stickEntity);
+            }
+            if (stickDataList.get(i).getHigh() < chartKDJDatas.getK().get(i) || stickDataList.get(i).getHigh() == 0) {
+                stickDataList.get(i).setHigh(chartKDJDatas.getK().get(i));
+            }
+            if (stickDataList.get(i).getLow() > chartKDJDatas.getK().get(i)) {
+                stickDataList.get(i).setLow(chartKDJDatas.getK().get(i));
+            }
+        }
+        for (int i = 0; i < chartKDJDatas.getD().size(); i++) {
+            if (i >= stickDataList.size()) {
+                stickEntity = new StickEntity();
+                stickDataList.add(stickEntity);
+            }
+            if (stickDataList.get(i).getHigh() < chartKDJDatas.getD().get(i)) {
+                stickDataList.get(i).setHigh(chartKDJDatas.getD().get(i));
+            }
+            if (stickDataList.get(i).getLow() > chartKDJDatas.getD().get(i)) {
+                stickDataList.get(i).setLow(chartKDJDatas.getD().get(i));
+            }
+        }
+        for (int i = 0; i < chartKDJDatas.getJ().size(); i++) {
+            if (i >= stickDataList.size()) {
+                stickEntity = new StickEntity();
+                stickDataList.add(stickEntity);
+            }
+            if (stickDataList.get(i).getHigh() < chartKDJDatas.getJ().get(i)) {
+                stickDataList.get(i).setHigh(chartKDJDatas.getJ().get(i));
+            }
+            if (stickDataList.get(i).getLow() > chartKDJDatas.getJ().get(i)) {
+                stickDataList.get(i).setLow(chartKDJDatas.getJ().get(i));
+            }
+        }
+        minusstickchart.setStickData(stickDataList);
+
+        minusstickchart.setDecimalNum(2);
+        minusstickchart.postInvalidate();
+
+    }
+
+    public static void setBIASLine(Context context, MinusStickChart minusstickchart,  List<HistoryDatas> history) {
+        ArrayList<OHLCEntity> ohlcList = new ArrayList<>();
+        List<StickEntity> stickEntity2 = new ChartDataAdapter().historyDataToStickList(history, ohlcList);
+        if (history.size() == 0) {
+            minusstickchart.postInvalidate();
+            return;
+        }
+
+        ChartBIASDatas chartBIASDatas = new TargetControl().getBIASs(ohlcList);
+        List<LineEntity> lines = new ArrayList<LineEntity>();
+
+        /**
+         * bias6
+         */
+        LineEntity bias6 = new LineEntity();
+        bias6.setLineData(chartBIASDatas.getBias6());
+
+        bias6.setLineColor( context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_bias_6));
+
+        bias6.setStartIndex(5);
+        lines.add(bias6);
+
+        /**
+         * bias12
+         */
+        LineEntity bias12 = new LineEntity();
+        bias12.setLineData(chartBIASDatas.getBias12());
+        bias12.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_bias_12));
+        bias12.setStartIndex(11);
+        lines.add(bias12);
+
+        /**
+         * bias24
+         */
+        LineEntity bias24 = new LineEntity();
+        bias24.setLineData(chartBIASDatas.getBias24());
+
+        bias24.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_bias_24));
+
+        bias24.setStartIndex(23);
+        lines.add(bias24);
+
+        minusstickchart.setLineData(lines);
+
+        minusstickchart.setShowStick(false);
+        List<StickEntity> stickDataList = new ArrayList<StickEntity>();
+        StickEntity stickEntity = null;
+
+        for (int i = 0; i < chartBIASDatas.getBias6().size(); i++) {
+            if (i >= stickDataList.size()) {
+                stickEntity = new StickEntity();
+                stickDataList.add(stickEntity);
+            }
+            if (stickDataList.get(i).getHigh() < chartBIASDatas.getBias6().get(i)) {
+                stickDataList.get(i).setHigh(chartBIASDatas.getBias6().get(i));
+            }
+            if (stickDataList.get(i).getLow() > chartBIASDatas.getBias6().get(i)) {
+                stickDataList.get(i).setLow(chartBIASDatas.getBias6().get(i));
+            }
+        }
+        for (int i = 0; i < chartBIASDatas.getBias12().size(); i++) {
+            if (i >= stickDataList.size()) {
+                stickEntity = new StickEntity();
+                stickDataList.add(stickEntity);
+            }
+            if (stickDataList.get(i).getHigh() < chartBIASDatas.getBias12().get(i)) {
+                stickDataList.get(i).setHigh(chartBIASDatas.getBias12().get(i));
+            }
+            if (stickDataList.get(i).getLow() > chartBIASDatas.getBias12().get(i)) {
+                stickDataList.get(i).setLow(chartBIASDatas.getBias12().get(i));
+            }
+        }
+        for (int i = 0; i < chartBIASDatas.getBias24().size(); i++) {
+            if (i >= stickDataList.size()) {
+                stickEntity = new StickEntity();
+                stickDataList.add(stickEntity);
+            }
+            if (stickDataList.get(i).getHigh() < chartBIASDatas.getBias24().get(i)) {
+                stickDataList.get(i).setHigh(chartBIASDatas.getBias24().get(i));
+            }
+            if (stickDataList.get(i).getLow() > chartBIASDatas.getBias24().get(i)) {
+                stickDataList.get(i).setLow(chartBIASDatas.getBias24().get(i));
+            }
+        }
+
+        minusstickchart.setStickData(stickDataList);
+
+        minusstickchart.setDecimalNum(2);
+        minusstickchart.postInvalidate();
+    }
+
+    /**
+     * 竞价总量
+     *
+     * @param minusstickchart
+     */
+    public static void setBidTotalLine(Context context, MinusStickChart minusstickchart, List<HistoryDatas> history) {
+
+        ArrayList<OHLCEntity> ohlcList = new ArrayList<>();
+        List<StickEntity> stickEntity2 = new ChartDataAdapter().historyDataToStickList(history, ohlcList);
+        if (history.size() == 0) {
+            minusstickchart.postInvalidate();
+            return;
+        }
+        BidChartTotalDatas bidChartTotalDatas = new TargetControl().getBidTotalData(ohlcList);
+        List<LineEntity> lines = new ArrayList<LineEntity>();
+
+        LineEntity total5 = new LineEntity();
+        total5.setStartIndex(5);
+        total5.setLineData(bidChartTotalDatas.getTotal5());
+
+        total5.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_total5));
+
+        lines.add(total5);
+
+        LineEntity total10 = new LineEntity();
+        total10.setStartIndex(10);
+        total10.setLineData(bidChartTotalDatas.getTotal10());
+
+        total10.setLineColor(context.getResources().getColor(com.desfate.chart.R.color.mtp_chart_k_total10));
+
+
+        lines.add(total10);
+
+        minusstickchart.setLineData(lines);
+        minusstickchart.setShowStick(true);
+        List<StickEntity> stickDataList = new ArrayList<StickEntity>();
+        StickEntity tem = null;
+        for (int i = 0; i < ohlcList.size(); i++) {
+            tem = new StickEntity();
+            try {
+                tem.setHigh(Double.parseDouble(((ChartData) ohlcList.get(i)).getVolume()));
+                if (ohlcList.get(i).getClose() > ohlcList.get(i).getOpen()) {
+                    tem.setColorFlag(1);
+                } else if (ohlcList.get(i).getClose() == ohlcList.get(i).getOpen()) {
+                    tem.setColorFlag(0);
+                } else {
+                    tem.setColorFlag(-1);
+                }
+                stickDataList.add(tem);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        minusstickchart.setStickData(stickDataList);
+        minusstickchart.setDecimalNum(2);
         minusstickchart.postInvalidate();
     }
 }

+ 11 - 1
RMA/app/src/main/res/layout/k_chart_view.xml

@@ -32,9 +32,19 @@
         app:layout_constraintTop_toBottomOf="@+id/info_text"
         app:layout_constraintLeft_toLeftOf="parent"
         app:layout_constraintRight_toRightOf="parent"
-        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintBottom_toTopOf="@+id/mtp_chart_k_tab"
         app:layout_constraintVertical_weight="1"
         />
 
+    <com.desfate.chart.MTPTabHost
+        android:id="@+id/mtp_chart_k_tab"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        app:layout_constraintTop_toBottomOf="@+id/minus_chart"
+        app:layout_constraintStart_toStartOf="parent"
+        app:layout_constraintEnd_toEndOf="parent"
+        app:layout_constraintBottom_toBottomOf="parent"
+        android:orientation="horizontal"/>
+
 
 </androidx.constraintlayout.widget.ConstraintLayout>

+ 4 - 4
RMA/chart/src/main/java/com/desfate/chart/MTPTabHost.java

@@ -117,7 +117,7 @@ public class MTPTabHost extends LinearLayout {
             TextView line = childAt.findViewById(R.id.line);
             TextView name = childAt.findViewById(R.id.order_names);
             line.setVisibility(View.INVISIBLE);
-            name.setTextColor(this.context.getResources().getColor(R.color.p_global_write_color));
+            name.setTextColor(this.context.getResources().getColor(R.color.manager_title_bg));
             name.setTextSize(13);
         }
         View checkView = mRadioGroup_content.getChildAt(tab_postion);
@@ -159,9 +159,9 @@ public class MTPTabHost extends LinearLayout {
         // this.setLayoutParams(layoutParams);
         // this.setOrientation(LinearLayout.HORIZONTAL);
         linear_lay = view.findViewById(R.id.linear_lay);
-        if(Configs.Chart_Color){
-            linear_lay.setBackground(getResources().getDrawable(R.color.manager_body_bg));
-        }
+//        if(Configs.Chart_Color){
+        linear_lay.setBackground(getResources().getDrawable(R.color.p_global_write_color));
+//        }
         addView(view);
         mColumnHorizontalScrollView = view.findViewById(R.id.mColumnHorizontalScrollView);
         mRadioGroup_content = view.findViewById(R.id.mRadioGroup_content);

+ 5 - 5
RMA/chart/src/main/java/com/desfate/chart/data/ChartData.java

@@ -31,11 +31,11 @@ public class ChartData extends OHLCEntity implements Parcelable {
     private String mAmount = "";//!< @brief 成交金额
     private String mVolume = "";//!< @brief 总量
 
-    private double mEMA12;//!< @brief EMA(12)
-    private double mEMA26;//!< @brief EMA(26)
-    private double mDIF;//!< @brief DIF
-    private double mDEA;//!< @brief DEA
-    private double mMACD;//!< @brief MACD
+    private double mEMA12 = 0;//!< @brief EMA(12)
+    private double mEMA26 = 0;//!< @brief EMA(26)
+    private double mDIF = 0;//!< @brief DIF
+    private double mDEA = 0;//!< @brief DEA
+    private double mMACD = 0;//!< @brief MACD
 
     /**
      * 数据类型

+ 39 - 44
RMA/chart/src/main/java/com/desfate/chart/ui/old/OTC/controls/TargetControl.java

@@ -10,6 +10,7 @@ import com.desfate.chart.data.ChartKDJDatas;
 import com.desfate.chart.data.ChartMADatas;
 import com.desfate.chart.data.ChartPSYDatas;
 import com.desfate.chart.data.ChartRSIDatas;
+import com.desfate.chart.entity.OHLCEntity;
 import com.desfate.chart.util.MathUtil;
 
 import java.util.ArrayList;
@@ -38,7 +39,7 @@ public class TargetControl {
         return sum / (end + 1);
     }
 
-    public ChartRSIDatas getRSI(ChartDataContainer chartDatas) {
+    public ChartRSIDatas getRSI(List<OHLCEntity> chartDatas) {
         ChartRSIDatas chartRSIDatas = new ChartRSIDatas();
         chartRSIDatas.setRsi6(getRSI(chartDatas, 6));
         chartRSIDatas.setRsi12(getRSI(chartDatas, 12));
@@ -50,10 +51,10 @@ public class TargetControl {
      * 强弱指标的计算公式:
      * 可查看分析系统公式管理器
      *
-     * @param chartDatas ChartDataContainer中的高开低收数据本身是倒序的,也就是说,0位就是最早的数据
+     * @param mOHLCList ChartDataContainer中的高开低收数据本身是倒序的,也就是说,0位就是最早的数据
      * @return RS
      */
-    public List<Double> getRSI(ChartDataContainer chartDatas, int rate) {
+    public List<Double> getRSI(List<OHLCEntity> mOHLCList, int rate) {
         List<Double> doubles = new ArrayList<Double>();
         // 初始化5个0值
         int lastRate = rate - 1;
@@ -65,11 +66,11 @@ public class TargetControl {
         List<Double> smas = new ArrayList<Double>();
         List<Double> absSmas = new ArrayList<Double>();
         returns.add(0.0);
-        for (int i = 0; i < chartDatas.mOHLCList.size(); i++) {
+        for (int i = 0; i < mOHLCList.size(); i++) {
             if (i == 0) {
                 continue;
             }
-            returns.add(chartDatas.mOHLCList.get(i).getClose() - chartDatas.mOHLCList.get(i - 1).getClose());
+            returns.add(mOHLCList.get(i).getClose() - mOHLCList.get(i - 1).getClose());
         }
 
         for (int i = lastRate; i < returns.size(); i++) {
@@ -134,10 +135,9 @@ public class TargetControl {
      * <li>J值=3*第9日K值-2*第9日D值
      * <li>若无前一日K值与D值,则可以分别用50代替。
      *
-     * @param chartDatas ChartDataContainer中的高开低收数据本身是倒序的,也就是说,0位就是最早的数据
      * @return
      */
-    public ChartKDJDatas getKDJs(ChartDataContainer chartDatas) {
+    public ChartKDJDatas getKDJs(List<OHLCEntity> mOHLCList) {
         ChartKDJDatas chartKDJDatas = new ChartKDJDatas();
 
         for (int i = 0; i < 8; i++) {
@@ -150,16 +150,16 @@ public class TargetControl {
 
         double heightPrice = 0.0;
         double lowPrice = Double.MAX_VALUE;
-        for (int i = 8; i < chartDatas.mOHLCList.size(); i++) {
+        for (int i = 8; i < mOHLCList.size(); i++) {
             heightPrice = 0;
             lowPrice = Double.MAX_VALUE;
             for (int j = i - 8; j < i + 1; j++) {// 取前9个元素的索引,对比出最低和最高价
 
-                if (heightPrice < chartDatas.mOHLCList.get(j).getHigh()) {
-                    heightPrice = chartDatas.mOHLCList.get(j).getHigh();
+                if (heightPrice < mOHLCList.get(j).getHigh()) {
+                    heightPrice = mOHLCList.get(j).getHigh();
                 }
-                if (lowPrice == 0 || lowPrice > chartDatas.mOHLCList.get(j).getLow()) {
-                    lowPrice = chartDatas.mOHLCList.get(j).getLow();
+                if (lowPrice == 0 || lowPrice > mOHLCList.get(j).getLow()) {
+                    lowPrice = mOHLCList.get(j).getLow();
                 }
             }
 
@@ -173,7 +173,7 @@ public class TargetControl {
                  * n日RSV=(Cn-Ln)÷(Hn-Ln)×100
                  * 公式中,Cn为第n日收盘价;Ln为n日内的最低价;Hn为n日内的最高价。
                  */
-                double rsv = ((chartDatas.mOHLCList.get(i).getClose() - lowPrice) / (heightPrice - lowPrice)) * 100;
+                double rsv = ((mOHLCList.get(i).getClose() - lowPrice) / (heightPrice - lowPrice)) * 100;
                 chartKDJDatas.getRsv().add(Double.parseDouble(MathUtil.roundNum(rsv, 2)));
             }
 
@@ -211,9 +211,8 @@ public class TargetControl {
      * cci 周期13
      * 具体公式可查看分析系统公式管理器
      *
-     * @param chartDatas ChartDataContainer中的高开低收数据本身是倒序的,也就是说,0位就是最早的数据
      */
-    public List<Double> getCCIs(ChartDataContainer chartDatas) {
+    public List<Double> getCCIs(List<OHLCEntity> mOHLCList) {
         List<Double> ccis = new ArrayList<Double>();
         List<Double> temMA = new ArrayList<Double>();
         List<Double> tps = new ArrayList<Double>();
@@ -222,19 +221,19 @@ public class TargetControl {
         for (int i = 0; i < N - 1; i++) {
             ccis.add(0.0);
             temMA.add(0.0);
-            double tp = (chartDatas.mOHLCList.get(i).getHigh() + chartDatas.mOHLCList.get(i).getLow() + chartDatas.mOHLCList.get(i).getClose()) / 3;
+            double tp = (mOHLCList.get(i).getHigh() + mOHLCList.get(i).getLow() + mOHLCList.get(i).getClose()) / 3;
             tps.add(tp);
         }
 
 
-        for (int i = N - 1; i < chartDatas.mOHLCList.size(); i++) {
+        for (int i = N - 1; i < mOHLCList.size(); i++) {
             double tpSum = 0;
             double tpMa = 0;
             double tpDevSum = 0;
             /**
              * TP = (最高价+最低价+收盘价) ÷ 3
              //			 */
-            double tp = (chartDatas.mOHLCList.get(i).getHigh() + chartDatas.mOHLCList.get(i).getLow() + chartDatas.mOHLCList.get(i).getClose()) / 3;
+            double tp = (mOHLCList.get(i).getHigh() + mOHLCList.get(i).getLow() + mOHLCList.get(i).getClose()) / 3;
             tps.add(tp);
             /**
              * MA = 最近N日收盘价的累计之和 ÷ N
@@ -264,11 +263,10 @@ public class TargetControl {
      * <li>DMA(10) = 10日平均值 — 50日平均值
      * <li>AMA(6) = dma的6日平均值
      *
-     * @param chartDatas ChartDataContainer中的高开低收数据本身是倒序的,也就是说,0位就是最早的数据
      */
-    public ChartDMADatas getDMAs(ChartDataContainer chartDatas) {
+    public ChartDMADatas getDMAs(List<OHLCEntity> mOHLCList) {
         ChartDMADatas chartDMADatas = new ChartDMADatas();
-        if (chartDatas.mSize <= 0) {
+        if (mOHLCList.size() <= 0) {
             return chartDMADatas;
         }
         ChartMADatas chartMADatas = new ChartMADatas();
@@ -279,12 +277,12 @@ public class TargetControl {
         double ma10Sum = 0.0;
         double ma50 = 0.0;
         double ma50Sum = 0.0;
-        for (int i = 0; i < chartDatas.mOHLCList.size(); i++) {
+        for (int i = 0; i < mOHLCList.size(); i++) {
             ma10Sum = 0.0;
             ma50Sum = 0.0;
             if (i >= 9) {
                 for (int j = i - 9; j <= i; j++) {
-                    ma10Sum += chartDatas.mOHLCList.get(j).getClose();
+                    ma10Sum += mOHLCList.get(j).getClose();
                 }
                 ma10 = ma10Sum / 10;
                 chartMADatas.getMA10().add(ma10);
@@ -294,7 +292,7 @@ public class TargetControl {
 
             if (i >= 49) {
                 for (int j = i - 49; j <= i; j++) {
-                    ma50Sum += chartDatas.mOHLCList.get(j).getClose();
+                    ma50Sum += mOHLCList.get(j).getClose();
                 }
                 ma50 = ma50Sum / 50;
                 chartMADatas.getMA50().add(ma50);
@@ -302,7 +300,7 @@ public class TargetControl {
                 chartMADatas.getMA50().add(0.0);
             }
         }
-        chartMADatas.setSize(chartDatas.mOHLCList.size());
+        chartMADatas.setSize(mOHLCList.size());
 
         /**
          * 计算出DMA 和 AMA值
@@ -338,9 +336,8 @@ public class TargetControl {
      * <li>BIAS=(当日指数或收盘价-N日平均指数或收盘价)÷N日平均指数或收盘价×100%
      * <li>N的参数一般确定为6日、12日、24日,并且同时设置成三条线。
      *
-     * @param chartDatas ChartDataContainer中的高开低收数据本身是倒序的,也就是说,0位就是最早的数据
      */
-    public ChartBIASDatas getBIASs(ChartDataContainer chartDatas) {
+    public ChartBIASDatas getBIASs( List<OHLCEntity> mOHLCList) {
         ChartBIASDatas chartBIASDatas = new ChartBIASDatas();
         double b6 = 0.0;
         double b12 = 0.0;
@@ -348,17 +345,17 @@ public class TargetControl {
 
         double bn = 0.0;
         double bnSum = 0.0;
-        for (int i = 0; i < chartDatas.mOHLCList.size(); i++) {
+        for (int i = 0; i < mOHLCList.size(); i++) {
             bnSum = 0.0;
             if (i >= 5) {
                 /**
                  * BIAS=(当日指数或收盘价-N日平均指数或收盘价)÷N日平均指数或收盘价×100%
                  */
                 for (int j = i - 5; j <= i; j++) {
-                    bnSum += chartDatas.mOHLCList.get(j).getClose();
+                    bnSum += mOHLCList.get(j).getClose();
                 }
                 bn = bnSum / 6;
-                b6 = ((chartDatas.mOHLCList.get(i).getClose() - bn) / bn) * 100;
+                b6 = ((mOHLCList.get(i).getClose() - bn) / bn) * 100;
                 chartBIASDatas.getBias6().add(b6);
             } else {
                 chartBIASDatas.getBias6().add(0.0);
@@ -369,10 +366,10 @@ public class TargetControl {
                  * BIAS=(当日指数或收盘价-N日平均指数或收盘价)÷N日平均指数或收盘价×100%
                  */
                 for (int j = i - 11; j <= i; j++) {
-                    bnSum += chartDatas.mOHLCList.get(j).getClose();
+                    bnSum += mOHLCList.get(j).getClose();
                 }
                 bn = bnSum / 12;
-                b12 = ((chartDatas.mOHLCList.get(i).getClose() - bn) / bn) * 100;
+                b12 = ((mOHLCList.get(i).getClose() - bn) / bn) * 100;
                 chartBIASDatas.getBias12().add(b12);
             } else {
                 chartBIASDatas.getBias12().add(0.0);
@@ -383,10 +380,10 @@ public class TargetControl {
                  * BIAS=(当日指数或收盘价-N日平均指数或收盘价)÷N日平均指数或收盘价×100%
                  */
                 for (int j = i - 23; j <= i; j++) {
-                    bnSum += chartDatas.mOHLCList.get(j).getClose();
+                    bnSum += mOHLCList.get(j).getClose();
                 }
                 bn = bnSum / 24;
-                b24 = ((chartDatas.mOHLCList.get(i).getClose() - bn) / bn) * 100;
+                b24 = ((mOHLCList.get(i).getClose() - bn) / bn) * 100;
                 chartBIASDatas.getBias24().add(b24);
             } else {
                 chartBIASDatas.getBias24().add(0.0);
@@ -401,22 +398,20 @@ public class TargetControl {
      * <li>1.PSY=N日内上涨天数/N*100
      * <li>2.PSYMA=PSY的M日简单移动平均
      * <li>3.参数N设置为12日,参数M设置为6日
-     *
-     * @param chartDatas ChartDataContainer中的高开低收数据本身是倒序的,也就是说,0位就是最早的数据
      */
-    public ChartPSYDatas getPSYs(ChartDataContainer chartDatas) {
+    public ChartPSYDatas getPSYs(List<OHLCEntity> mOHLCList) {
         ChartPSYDatas chartPSYDatas = new ChartPSYDatas();
         /**
          * 参数N设置为12日,计算psy
          */
         int upDays = 0;
-        for (int i = 0; i < chartDatas.mOHLCList.size(); i++) {
+        for (int i = 0; i < mOHLCList.size(); i++) {
             if (i >= 25) {
                 for (int j = i - 25; j < i + 1; j++) {
                     if (j == 0) {
                         continue;
                     }
-                    if (chartDatas.mOHLCList.get(j - 1).getClose() < chartDatas.mOHLCList.get(j).getClose()) {
+                    if (mOHLCList.get(j - 1).getClose() < mOHLCList.get(j).getClose()) {
                         upDays += 1;
                     }
                     // PSY=N日内上涨天数/N*100
@@ -450,19 +445,19 @@ public class TargetControl {
      * @param chartDatas
      * @return
      */
-    public BidChartTotalDatas getBidTotalData(ChartDataContainer chartDatas) {
+    public BidChartTotalDatas getBidTotalData(List<OHLCEntity> mOHLCList) {
         BidChartTotalDatas bidChartTotalDatas = new BidChartTotalDatas();
-        if (chartDatas.mOHLCList.isEmpty()) {
+        if (mOHLCList.isEmpty()) {
             return bidChartTotalDatas;
         }
         List<Double> total5 = bidChartTotalDatas.getTotal5();
         List<Double> total10 = bidChartTotalDatas.getTotal10();
 
-        for (int i = 0; i < chartDatas.mSize; i++) {
+        for (int i = 0; i < mOHLCList.size(); i++) {
             double sum = 0;
             if (i >= 4) {
                 for (int j = i - 4; j <= i; j++) {
-                    sum += Double.parseDouble(((ChartData) (chartDatas.mOHLCList.get(j))).getVolume());
+                    sum += Double.parseDouble(((ChartData) (mOHLCList.get(j))).getVolume());
                 }
                 total5.add(sum / 5.0);
 
@@ -473,7 +468,7 @@ public class TargetControl {
             sum = 0;
             if (i >= 9) {
                 for (int j = i - 9; j <= i; j++) {
-                    sum += Double.parseDouble(((ChartData) (chartDatas.mOHLCList.get(j))).getVolume());
+                    sum += Double.parseDouble(((ChartData) (mOHLCList.get(j))).getVolume());
                 }
                 total10.add(sum / 10.0);
             } else {