package com.lighthouse.strategies;

import java.util.*;

import com.dukascopy.api.*;

public class SlowBacktest implements IStrategy {
  private IEngine engine;
    private IConsole console;
    private IHistory history;
    private IContext context;
    private IIndicators indicators;
    private IUserInterface userInterface;
    @Configurable("Instrument")
    public Instrument selectedInstrument = Instrument.EURUSD;    
    ////////////////////////////////////////////////////////

    /*
     * Techincal settings:
     */
    private boolean logEnabled = false;
    private int counter = 0;


    
    public void onStart(IContext context) throws JFException {
        this.engine = context.getEngine();
        this.console = context.getConsole();
        this.history = context.getHistory();
        this.context = context;
        this.indicators = context.getIndicators();
        this.userInterface = context.getUserInterface();
        engine = context.getEngine();
        indicators = context.getIndicators();
        console = context.getConsole();
        history = context.getHistory();

        
        if(context.getChart(selectedInstrument) != null) {
            
            context.getChart(selectedInstrument).addIndicator(indicators.getIndicator("HT_SINE"));
            //context.getChart(selectedInstrument).addIndicator(indicators.getIndicator("HT_TRENDMODE"));
            context.getChart(selectedInstrument).addIndicator(indicators.getIndicator("HT_TRENDLINE"));
            
        }  
        
  
    }
 
    public void onTick(Instrument instrument, ITick tick) throws JFException {
        //throw new UnsupportedOperationException("Not supported yet.");
    }

    public void onBar(Instrument instrument, Period period, IBar askBar, IBar bidBar) throws JFException {

    }
    
    public void onMessage(IMessage message) throws JFException {
        console.getOut().println("Broadcast : " + message);
    }

    public void onAccount(IAccount account) throws JFException {
        
    }

    public void onStop() throws JFException {

    }
    
    private void print(Object message) {
        if ( message != null) {
            console.getOut().println(message);
        }
        //logger.info(message.toString());
        

        
    }       



}