Better NN EA development - page 63

 

corrected converted papper. Van Gestel, T., Suykens, J.A.K., Lanckriet, G.R.G. , Lambrechts, A., Baestaens, D., De Moor, B., Vandewalle, J. (2001). Bayesian Interpretation of Least Squares Support Vector Machines for Financial Time Series Prediction . Proceedings of the 5th World Multi-Conference on Systemics, Cybernetics and Informatics , Vol. III, pp. 254-259, Orlando, Florida. Outstanding paper award.

Files:
papper_1.pdf  416 kb
 

another documents and error evaluation

Here are another documents describing usage of NN for financial series. I believe

you should find out the way to measure the statistical error of prediction for your EA and try to improve this.

What data it is using for training ?? Did you try with different input data sets

and compare the results ??

Krzysztof

 

This stuff is cool.

I wish I knew how to program.

 

Please Help with this Pending Orders Code if you can

// I am trying to use this Pending order code in NN EA that i am still trying to code. It is far from over i just started. Any help Please.

int CheckOpenPendingOrders() {

for (int i = 0; i < OrdersTotal(); i++) {

if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {

if (OrderSymbol() == Symbol() && OrderType() == OP_SELL || OrderType() == OP_BUY)

if (StringSubstr(OrderComment(), 0, 4) == "Open") return (OrderTicket());

}

}

return (0);

}

int CheckPendingOrders() {

for (int i = 0; i < OrdersTotal(); i++) {

if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES)) {

if (OrderSymbol() == Symbol() && OrderType() == OP_SELLSTOP || OrderType() == OP_BUYSTOP)

if (StringSubstr(OrderComment(), 0, 4) == "Pending") return (OrderTicket());

}

}

return (0);

}

// The Below Code does not seem to work it goes into a LOOP after after a few trades.

void ClosePendingOrders() {

double PendingOrderOpenPrice;

int ParentTicket;

int PendingTicket = CheckPendingOrders();

int OpenPendingOrderTicket = CheckOpenPendingOrders();

if (PendingTicket > 0 ) //Scan to see if there exists pendings Orders that needs to be cancelled

{

OrderSelect(PendingTicket, SELECT_BY_TICKET);

PendingOrderOpenPrice = OrderOpenPrice();

ParentTicket = OriginalOrderTicket(PendingTicket);

OrderSelect(ParentTicket, SELECT_BY_TICKET);

if (OrderCloseTime() > 0)

{

if (OrderProfit() <= 0.0 )return; // it should activate the Pending order ( into an open Sellstop or buystop) if the Parent order was a LOSS trade

// i.e the STOP LOSS was hit

// does not seem to work correctly it causes a LOOP. it is able to activate the pending order but

// then it starts to go into LOOP

OrderDelete(PendingTicket); // Deletes the Pending Order if the Parent order was a WIN

if (!(Outcome)) return;

return;

}

}

}

 

Hello, Progressapama above,

DIN KUSKUS EA in this forum has very nice local functions for order management. I in fact uses it as my EA framework. Take a look at his EA about the local function CloseOrder Part. Hopes it will help.

 
finimej:
Hello, Progressapama above, DIN KUSKUS EA in this forum has very nice local functions for order management. I in fact uses it as my EA framework. Take a look at his EA about the local function CloseOrder Part. Hopes it will help.

Thanks so much. I think i figured out the Problem

 

Here is the Parzen window classification math equations and here is the

The PNN EA code implemenation. However the PNN EA is doing good in backtest, because the trainer has calculated the bar price and put a buy or sell class for every bar there. Therefore the backtest will always be ok.

For the forward testing, the PNN EA seems not do the classfication right at all. Here is his classification code.

default is -1 for sesultClass. if the parzen window PDF here is his fx>fx, then the result is in the window, and return a result. However, here comes the problem, the orginal code return the counter i. It shall return a class buy or sell in fact. So later the forwarding test will have problem, when the current bar price is sent for classfication. Can someone who understand the code check it out and correct it? Thanks.

The end there, return (resultClass) there is the sucker, it only returned value 0, so the backtesting for the comming period, is all buying operation.

**

* Classify a vector in one class.

*/

int PNNClassifyVector(double vector[]) {

double length = ArrayRange(vector, 0);

double result = -99999999999999999999;

int resultClass = -1;

double fx[2] = {0, 0};

double classVectorCount[2] = {0, 0};

for (int i = 0; i < ArrayRange(pnn, 0); i++) {

int class = pnn[0];

double classVector[60];

for (int j = 0; j < length; j++) {

classVector[j] = pnn[j + 1];

}

classVectorCount[class]++;

fx[class] += MathExp((-1)

* euclideanScalarProduct(vector,

classVector) / (2 * MathPow(SIGMA, 2)));

}

for (i = 0; i < ArrayRange(fx, 0); i++) {

fx *= 1 / (MathPow(2 * 3.14159265, length / 2)

* MathPow(SIGMA, length))

* (1 / classVectorCount);

if (fx > result) {

result = fx;

resultClass = i;

}

}

return (resultClass);

}

Files:
pnn.zip  4 kb
 

I would like to simplify the task for Neural network. to identify the flat market and trend market, specially identify the trend market when it is in baby phase. Just give the digital output, flat or trend for each candle bar. In this way, we do not need to update the trainer continuelly.

1) input, is the current candlebar, and previous 4, 7, or 11 candlebars.

2) Neural network has the defined pattern for flat market, takes these pattern that defined by this attached PDF by Joe Ross here. The neural network thereafter check the incoming candle against the defined patterns. belongs the pattern, then it is flat market. Does not belongs the pattern, then it is a trend market.

3) Out from the neural network shall be an indicator that give the phase, flat or trend.

We can use the MA cross or Heiken Ashi bar to handle the trend market, and stay out or use the stochastic(5,3,3) to handle the flat or range trading market. WhatI really need is to distinguish the trend market when it is in baby phase, from the flat market.

Attached is the definition of the congestion phase

Here you can also download the Joe Ross' The Law of Charts ebook free

Trading Educators Inc. - Joe Ross - Day Trading and Online Trading

Get Joe Ross' Trader's Trick Entry (TTE) ebook free

Trading Educators Inc. - Joe Ross - Day Trading and Online Trading

I think that the same PNN framework can be used for this, the only differene is that the trainer to get the two group, flat trend candles and trend candles, then the classficiation will automatically take the new currect candle and with the previous 3 candels to compare the pattern in the trainer, to get the class.

 

Can someone please debug the pnn.zip there in the thread #627above?

The backtesting on the period after the training period, does not buying operation. I think there maybe something not right with the classification.

Need help, please.

 
Files:
debug.jpg  23 kb
Reason: