Built a quick example to run encog framework with Dukascopy (Forex broker)
https://github.com/fxmozart/DukasCopy-Encog
Runs (very basic EURUSD elman analysis) by command line (gets data from dukascopy).
you can run directly from the command line the compiled version in the downloads (for a quick example) by doing:
java -jar EncogDukascopy.jar USERNAME PASSWORD
Example output:
Epoch #6 Error:0.08144309815477535
Epoch #7 Error:0.14100546077892667
Epoch #8 Error:0.1581448235642699
Epoch #9 Error:0.05698126829554865
Year Actual Predict Closed Loop Predict Real Value Predcted Value
Train:101 0.5652 0.5695 0.5695 1.3782 1.3799
Train:102 0.5652 0.5468 0.5469 1.3782 1.3707
Train:103 0.5652 0.6173 0.6173 1.3782 1.3994
---------------------
Basically the whole thing only retrieves data :
public List GetBars() throws java.text.ParseException, JFException
{
SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyy HH:mm:ss");
dateFormat.setTimeZone(TimeZone.getTimeZone("GMT"));
Date dateFrom = dateFormat.parse("05/10/2008 00:00:00");
Date dateTo = dateFormat.parse("04/10/2010 00:00:00");
List bars = JForexContext.getHistory().getBars(Instrument.EURUSD, Period.ONE_HOUR, OfferSide.ASK, dateFrom.getTime(), dateTo.getTime());
return bars;
}
Then puts it in a dim array:
public double [][] IBarsToArray(List inputBars)
{
double [][] ohlcArray = new double[4][inputBars.size()];
for (int i = 0; i < inputBars.size(); i++){
ohlcArray[0][i] = inputBars.get(i).getOpen();
ohlcArray[1][i] = inputBars.get(i).getHigh();
ohlcArray[2][i] = inputBars.get(i).getLow();
ohlcArray[3][i] = inputBars.get(i).getClose();
}
return ohlcArray;
}
Then it's basically back to "Normal' encog and starting with training etc....
First lets pick which data field we want (let's get the closing values):
//Lets copy the closing values to sunspots
SUNSPOTS = GetWorkableArray(FullData,3);
public double[] GetWorkableArray(double [][] dukasArray, int whichArray)
{
double [] Arrayed = new double [dukasArray[whichArray].length];
Arrayed = dukasArray[whichArray];
return Arrayed;}
Then just run the usual sunspot Run command....
As simple as that...
Rest, drawing the indicator, other network types is back to either JForex or encog API's..
Cheers.
Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer
Thankyou for sharing that. I
Thankyou for sharing that. I added a link to it on the "other applications" wiki page.
http://www.heatonresearch.com/wiki/Projects_that_Use_Encog