IndicatorMetadata.java

注意事項:
サンプルソースコードには実際にオーダーを発注するものがあります。
サンプルソースコードのストラテジーを起動する場合は、注意して下さい。



// Copyright (c) 2009 Dukascopy (Suisse) SA. All Rights Reserved.
package jforex.indicators.test;

import com.dukascopy.api.*;
import com.dukascopy.api.indicators.IIndicator;
import com.dukascopy.api.indicators.IndicatorInfo;

// このストラテジーはCOGインジケータのインジケータメタデータをログ出力します
@RequiresFullAccess   
public class IndicatorMetadata implements IStrategy {

    private IConsole console;

    @Override
    public void onStart(IContext context) throws JFException {
        console           = context.getConsole();
        IIndicator indCOG = context.getIndicators().getIndicator("COG");
        printIndicatorInfos(indCOG);
    }
    
    private void printIndicatorInfos(IIndicator ind){

        IndicatorInfo info = ind.getIndicatorInfo();
        print(String.format("%s: インプット数=%s, オプションインプット数=%s, アウトプット数=%s", 
                info.getTitle(), info.getNumberOfInputs(), info.getNumberOfOptionalInputs(), info.getNumberOfOutputs()));

        for (int i = 0; i < ind.getIndicatorInfo().getNumberOfInputs(); i++){
            print(String.format("インプット %s: %s - %s",
                  i, ind.getInputParameterInfo(i).getName(), ind.getInputParameterInfo(i).getType()));
        }

        for (int i = 0; i < ind.getIndicatorInfo().getNumberOfOptionalInputs(); i++){
            print(String.format("オプションインプット %s: %s - %s",
                  i, ind.getOptInputParameterInfo(i).getName(), ind.getOptInputParameterInfo(i).getType()));
        }

        for (int i = 0; i < ind.getIndicatorInfo().getNumberOfOutputs(); i++){
            print(String.format("アウトプット %s: %s - %s",
                  i, ind.getOutputParameterInfo(i).getName(), ind.getOutputParameterInfo(i).getType()));
        }
    }
    
    private void print(Object o){
        console.getOut().println(o);
    }
    

    @Override
    public void onTick(Instrument instrument, ITick tick) throws JFException {}
    @Override
    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {    }
    @Override
    public void onMessage(IMessage message) throws JFException {    }
    @Override
    public void onAccount(IAccount account) throws JFException {    }
    @Override
    public void onStop() throws JFException {    }
}







COGインジケータ



スポンサーリンク

スポンサーリンク
検索
リファレンスツリー


Copyright ©2016 JForexAPIで自動売買させ隊! All Rights Reserved.


Top

inserted by FC2 system