⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asi.java

📁 一份java写的期货交易程序
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   ASI.java

package gnnt.MEBS.HQApplet.Indicator;

import gnnt.MEBS.HQApplet.*;
import java.awt.Graphics;
import java.awt.Rectangle;

// Referenced classes of package gnnt.MEBS.HQApplet.Indicator:
//            IndicatorBase, IndicatorPos

public class ASI extends IndicatorBase
{

    public ASI(IndicatorPos pos, int Precision)
    {
        super(pos, Precision);
        m_strIndicatorName = "ASI";
        m_strParamName = (new String[] {
            ""
        });
        m_iPrecision = 2;
    }

    public void Paint(Graphics g, Rectangle rc, KLineData data[])
    {
        super.Paint(g, rc, data);
        Calculate();
        m_max = -1E+038F;
        m_min = 1E+038F;
        GetValueMaxMin(m_data[0], 1);
        DrawCoordinate(g, 2);
        DrawLine(g, m_data[0], 0, HQApplet.rhColor.clIndicator[0]);
    }

    public void Calculate()
    {
        m_data = new float[1][];
        if(m_kData == null || m_kData.length <= 0)
            return;
        m_data[0] = new float[m_kData.length];
        float asi[] = m_data[0];
        asi[0] = 0.0F;
        float si = 0.0F;
        for(int i = 1; i < m_kData.length; i++)
        {
            float a = Math.abs(m_kData[i].highPrice - m_kData[i - 1].closePrice);
            float b = Math.abs(m_kData[i].lowPrice - m_kData[i - 1].closePrice);
            float c = Math.abs(m_kData[i].highPrice - m_kData[i - 1].lowPrice);
            float d = Math.abs(m_kData[i - 1].closePrice - m_kData[i - 1].openPrice);
            float e = m_kData[i].closePrice - m_kData[i - 1].closePrice;
            float f = m_kData[i].closePrice - m_kData[i].openPrice;
            float g = m_kData[i - 1].closePrice - m_kData[i - 1].openPrice;
            float x = e + f / 2.0F + g;
            float r = 0.0F;
            if(a >= b && a >= c)
                r = a + b / 2.0F + d / 4F;
            if(b >= a && b >= c)
                r = b + a / 2.0F + d / 4F;
            if(c >= a && c >= b)
                r = c + d / 4F;
            float k = Math.max(a, b);
            if(k != 0.0F)
                si = (((50F * x) / r) * k) / 3F;
            asi[i] = asi[i - 1] + si;
        }

    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -