zhangliangzs / kdemo Goto Github PK
View Code? Open in Web Editor NEWAndroid开发专业k线图表组件,支持JDK,MACD,MA,VOL等指标,后续指标陆续更新
Android开发专业k线图表组件,支持JDK,MACD,MA,VOL等指标,后续指标陆续更新
好像是说只能设置三十多条?不是吧?
如题
https://trans.chbtc.com/api/m/V1_7/ 代码里的数据api已经被弃掉,有知道现在要用哪个吗?
MACD算法公式:
(1)12日的EMA计算:EMA(12)=昨日EMA(12)×11 + c(今日)×2
13 13 13
(2)26日的EMA计算:EMA(26)=昨日EMA(26)×25 + c(今日)×2
27 27 27
(3)DIFF=EMA(12)-EMA(26)
(4)9日的DEA计算:DEA=昨日DEA×8 + 今日DIF×2
10 10
(5)MACD计算:MACD=(DIFF-DEA)×2
从后面往前面取值这种算法不是很可取,我认为的正确算法:
public class MACD {
private List<Double> DEAs;
private List<Double> DIFs;
private List<Double> BARs;
private List<Double> EMA12;
private List<Double> EMA26;
private EMAEntity mEMAEntity9;
private EMAEntity mEMAEntity12;
private EMAEntity mEMAEntity26;
public MACD(List<Float> OHLCData) {
......
if (OHLCData != null && OHLCData.size() > 0) {
for (int i = 0; i <= OHLCData.size() - 1; i++) {
dIF = EMA12.get(i)-EMA26.get(i);
if (i == 0) {
dEA = 0+dIF*(2/10);
mBAR = 0.0;
} else {
dEA = dEA*0.8 + dIF*0.2;
mBAR = 2*(dIF-dEA);
}
dEAs.add(dEA);
dIFs.add(dIF);
mBARs.add(mBAR);
}
DEAs.addAll(dEAs);
DIFs.addAll(dIFs);
BARs.addAll(mBARs);
}
......
}
public class EMAEntity {
private List EMAs;
public EMAEntity(List<MarketChartData> OHLCData, int n)
{
EMAs = new ArrayList<Double>();
if (OHLCData != null && OHLCData.size() > 0) {
double close = 0;
double EMA12 = 0.0;
MarketChartData oHLCEntity;
for (int i = 0; i <= OHLCData.size() - 1; i++) {
close = OHLCData.get(i).getClosePrice();
oHLCEntity = OHLCData.get(i);
if (i ==0) {
EMA12 = oHLCEntity.getClosePrice();
EMAs.add(EMA12);
}else
{
EMA12 = EMAs.get(EMAs.size()-1)*(n-1)/(n+1)+close*(2)/(n+1);
EMAs.add(EMA12);
}
}
}
}
public List<Double> getnEMA() {
return EMAs;
}
}
Scrollview套Kview,kview就显示不出来了
为什么我下载了demo之后,运行,根本没有数据显示出来?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.