Better NN EA development - page 72

 

Thank you

very nice forum and articles.

 

Parzen PNN

I find Iris database and try realize PNN parzen

see 2 attach files, I hope that the large errors in the implementation is not

result:

PNN_Iris EURUSD,M1: probality SETOSA recognate as SETOSA res_versi3=0.77667

PNN_Iris EURUSD,M1: probality SETOSA recognate as VIRGI res_versi2=0.00000

PNN_Iris EURUSD,M1: probality SETOSA recognate as VERSI res_versi1=0.00137

PNN_Iris EURUSD,M1: probality VIRGI recognate as SETOSA res_versi3=0.00000

PNN_Iris EURUSD,M1: probality VIRGI recognate as VIRGI res_versi2=0.43941

PNN_Iris EURUSD,M1: probality VIRGI recognate as VERSI res_versi1=0.35948

PNN_Iris EURUSD,M1: probality VERSI recognate as SETOSA res_versi3=0.00045

PNN_Iris EURUSD,M1: probality VERSI recognate as VIRGI res_versi2=0.11141

PNN_Iris EURUSD,M1: probality VERSI recognate as VERSI res_versi1=0.60281

Files:
pnn_iris.mq4  10 kb
 

any ideas

still think of how to define two CLASS (BUY / SELL), what indicators to use and more ...

and through the PNN will be possible to predict, with probability, i think...

 

Interesting!!!!!!!! Strat. continued

From this came his very simple method:

Buy when it goes up and sell when it goes down.

He went on to make $millions doing this and I subsequently learned he passed away a very rich and contented man knowing that he had beaten the “w....” at their own game.

I learned all this in a few telephone conversations with him but he lost his patience with me when I still questioned his method. He wouldn’t answer my calls so I reverted back to faxes. Again, I can’t remember it word for word but I sent a simple fax saying:

“How do you know when to stop buying?”

On the same fax was his handwritten reply, “When it stops going up.”

So I wrote on it, “How do you know when it stops going up?”

His handwritten reply, “When it starts going down.”

So I wrote on it, “How do you know when it stops going up and starts going down?”

His handwritten reply, “When people start selling.”

After going round like this in riddles, I pleaded with him to “just give it to me straight”.

He sent a fax saying this would be his last communication with me and that if I didn’t understand how to buy when it goes up and sell when it goes down, I had no business trading.

His final paragraph was one which I ignored, like everything else he told me, until a couple of years ago when I realized what a dumb, stupid, arrogant, stubborn idiot I had been:

He said I would only be wrong twice using his simple method:

“Once when you buy at the top and once when you sell at the bottom.”

I just ignored this as a smart – ass answer but still tried to do what he said. Unfortunately, and as Sod’s law dictates, I tried to do it in a consolidation and lost on every trade which had me buying when I should have been selling etc.

I tried and lost again and then eventually lost my way in the quest for the Holy Grail in Indicator Land.

Now, with all my experience and thousands of lost $ behind me, the light came on!

My understanding of what he was telling me is this:

Buy when prices are moving up. Buy each retrace/dip. Keep buying until the last retrace becomes a trend change which is the one trade you lose on.

Sell when prices are moving down. Sell each retrace/rally. Keep selling until the last retrace becomes a trend change which is the second trade you lose on.

I have not traded like this as I have my own method/style now but on the look backs I have done it works very well. Obviously, the trendier the price, the better it works.

In my later communications with other floor traders, I told them about Dr. Joe and what he told me, and asked them if it was true. As you would expect, each and everyone vehemently rejected it as absolute rubbish.

Sometimes I wonder if old Dr. Joe was smoking something but then when I see those long legged neutral dojis before a significant move, I know he was right.

Thank you, Dr. Joe

Rock n Roll,

Strat

 

Interesting!!!!!!!! Strat.

dear PNN contributors,

I have seen this post from a good trader in other forum (Strat),

it has some interesting things that would be useful for all of us,

please read it carefully and see what things (forex price actions) the PNN tries to classify or NN tries to curve fit/predict....

you can find finally a simple trading method and if it can be coded,...

regards

OTR.

Forex Factory - View Single Post - Strat's Long Term Stress Free Trading

Mar 2, 2009 4:33 (36 hr ago)

strat

Default Indicators and Dr. Joe

Thank you for the PMs on indicators and price action. Rather than answer individually, I will do it through this post, if I may.

I’m not here to fight with anyone over whether to use indicators or not for we have a larger fight with the market makers than amongst us little guys. I respect the traders who can make consistent profits with indicators as it is something I have tried and cannot do. If anyone has an indicator that produces CONSISTENT profits then, please, show us the way.

In the meantime, I will continue with what works for me: raw price action using price, volume, S&R, momentum, exhaustion, cycles, time, harmonic analysis, market sentiment with a splash of funny mentals thrown in.

With regard to my transition from having indicators up the ying yang on my charts to now with just volume and the 20ema and the 50sma, I need to share my experience with an old time trader, Dr. Joe, which will also show how stubborn I was.

Back in the early 90s when I was getting really serious with my trading, I was buying signals via fax. In those days there was no email and no computer trading and we had to either plot our own charts or buy them from a charting service. We then had to calculate our own indicators and then hand draw them on our charts. This really helped in understanding what indicators did (take the data from “n” days ago) and how they worked.

One time I faxed my questions back to the signal service and the reply I got back was that I had sent it to the wrong number. Also written on my fax was that I was wasting my money on signals and to contact Dr. Joe. After a few fax exchanges, he sent a handwritten fax saying something like “trading is easy, you don’t need nuthin fancy (he was a good old Texas boy) just buy when it’s going up and sell when it’s going down, that’s all there is to it”.

Dr. Joe used to work for NASA as a nuclear physicist on the Space Program and was a Professor, PhD with just about every physics and maths qualifications there are or you could think of. He got fed up of the bureaucracy and politics at NASA and as a part time investor in stocks , decided to go full time as, in his own words, “the price cycles are just some sort of fancy sine waves with decay and acceleration distorting them and should be real easy to plot and forecast.”

Well after over 5 years doing triple integrated, double differentiated Fourier transforms, harmonic frequency analysis, fractal filters and theorems and goodness knows what else that, although I have a PhD, just ran circles around me. He said he got so frustrated that although he could plan and predict space craft trajectories, orbits, landings etc, he could not forecast even one bar of prices into the future. Not one to quit, he decided that there was some external force that he was not taking into consideration and the only place it could be was on the trading floor where the action took place.

Through his connections, he eventually got an invitation to the Chicago Mercantile Exchange (CME) and was shown the futures or commodities pit (can’t remember which). His sole purpose of going there was as a spy or detective to find out exactly how things worked so that he could write it into his software. He told me he was “amazed and dumbfounded” at what he saw and heard which forever changed his life. (I had all this written up in my trading notes in my files but I can’t find them so I’m using this post to “replenish my notes”).

He arrived at the pit before opening time and saw all the floor traders congregated together in a meeting. He saw this as strange as he thought they were out and out competitors with each other.

What he saw in the first 15 to 30 minutes he would never have believed even if his best friend had told him. At the open, the overnight trades, which were long positions, were put through but he detected the traders entering them were giving signals to the other traders. After the orders were put through there was “nothing” – they just waited to see how the market reacted to those orders.

He then observed what he thought were illegal practices but later learned it to be what actually goes on each and every day. During this “dead” time, the floor traders were reviewing their orders in the pipeline and then on a given signal, a group started selling followed by another group. Then when a certain lower price had been reached, another signal was given and the same groups then bought back amongst themselves. He later learned this was called “Running the Stops” and what they had done was found out where all the orders were, which were below lows, swing lows and elsewhere, and just driven the price down to fill them and take them out so that they had a clean order sheet! Not satisfied with that, they then collectively took the price back to where it opened!

After this and now with the market moving, orders started to come in and when a large order came in from a bank, fund or other large institution, the trader with the order gave a signal before entering it. After entering it, the traders went quiet again. They were looking to see how the market reacted to that order. When they saw more buy orders coming in, they just bought more and more and kept on buying until a signal from a trader that he had a large sell order. Again the sell order was entered and the traders went quiet as they waited for a reaction from the market. He learned that the floor traders were waiting to see whether the sell order was going to be accepted as profit taking or full blown shorting. He said this went on all day long with the floor traders just “piggy-backing” on which ever way the market moved. He said he could see no skills or qualifications (other than being a w.... – a very rich w...., he said) whatsoever in what the floor traders did.

On his way back to Houston, he thought about how to use what he witnessed to HIS advantage.

His first action was to throw out all his indicators, forecasts and technical analysis. He told me that there is no analysis, indicator or other program now or in the future, that can analyse or predict human behaviour and specifically, human emotions. He had seen for himself that there was nothing technical or logical in how the floor traders (now better known as Market Movers) traded and therefore any analysis or thinking from “off the floor” was an absolute waste of time.

His second action was how to beat “those w.....” on the floor as he called them. He said he thought over just about every scenario imaginable and just as he was running out of ideas, it came to him. If you can’t beat, them join them although as a very devout and God fearing Christian, he didn’t think it was ethical. Unable to find another alternative, he decided he had no options left but to try and do, “off the floor” what they did on the floor.

 

?

hi guys,

any thought for realization of this simple part of strat's post,

Buy when prices are moving up. Buy each retrace/dip. Keep buying until the last retrace becomes a trend change which is the one trade you lose on.

Sell when prices are moving down. Sell each retrace/rally. Keep selling until the last retrace becomes a trend change which is the second trade you lose on.

do we need to use some sort of image processing/recognition for identifying "when prices are moving up/down" and "each retrace/dip/top" ?

don't our study , based on charts/price actions that they are the images that have specifications for recognition?

do you have image processing/recognition knowledge to share here?

do the PNNs that are discussed here , are some special type of price chart image recognition (resulted calss)?

OTR

 

OTR,

what do you need PNN for (meaning this particular system)? Have you read the post? The guy said there is no way to predict the price movement (same applies to patterns I guess). This system is not new, problems start when you get caught in a whipsaw. To identify when the trend starts is an art. When it trends a couple of MAs and a pinbar are all you need to trade successfully.

Orest

OnTheRoad:
hi guys,

any thought for realization of this simple part of strat's post,

Buy when prices are moving up. Buy each retrace/dip. Keep buying until the last retrace becomes a trend change which is the one trade you lose on.

Sell when prices are moving down. Sell each retrace/rally. Keep selling until the last retrace becomes a trend change which is the second trade you lose on.

do we need to use some sort of image processing/recognition for identifying "when prices are moving up/down" and "each retrace/dip/top" ?

don't our study , based on charts/price actions that they are the images that have specifications for recognition?

do you have image processing/recognition knowledge to share here?

do the PNNs that are discussed here , are some special type of price chart image recognition (resulted calss)?

OTR
 

Suppose I created two classes of vectors, one for SELL, one for the BUY.

to properly classify the current vector ( to which class he belongs) need to determinate sigma. If him 0.0001 is the vector may be classified as a BUY, as if to let him 0.01 - then classified as the vector begins SELL.

For me, until the mystery of how to determine the optimum value for sigma.

 

Trading Strategy tester in java

SourceForge.net: Trading Strategy Runner: Files

Data file structure:

27/10/2008,00:00:01,2,1.2624,1.2623,1.2623,1.2624

27/10/2008,00:00:11,0,1.2623,1.2623,1.2623,1.2623

27/10/2008,00:00:21,2,1.2624,1.2623,1.2623,1.2624

27/10/2008,00:00:31,1,1.2623,1.2624,1.2623,1.2624

27/10/2008,00:00:41,0,1.2624,1.2624,1.2624,1.2624

Files:
screenshot.jpg  50 kb
testter1.jpg  29 kb
 

public enum SignalDirection {

BUY, SELL, NEUTRAL, CLOSE

}

///////////////////////////////////////////////////////////////////

public enum SignalType {

OPEN, CLOSE, INDICATION

}

///////////////////////////////////////////////////////////////////

public class Util {

static DecimalFormat decFormat = new DecimalFormat("0.0000");

static SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss");

public static synchronized String formatDate(Date date) {

return date == null ? "" : dateFormat.format(date);

}

public static synchronized Date parseDate(String date) throws ParseException {

return date == null ? null : dateFormat.parse(date);

}

public static synchronized String formatPrice(double totalProfit) {

return decFormat.format(totalProfit);

}

public static final double calcProfit(TradePosition pos, Tick currentTick) {

if (pos.getDirection() == SignalDirection.BUY) {

// long the security

return currentTick.getSellPrice() - pos.getTick().getBuyPrice();

} else {

// short the security

return pos.getTick().getSellPrice() - currentTick.getBuyPrice();

}

}

}

////////////////////////////////////////////////////////////////////////////////////////////////////////

public class TradePosition implements Serializable, Comparable {

private final Tick tick;

private final SignalDirection direction;

private final SignalType type;

/**

* The default constructor

* @param direction

* @param type

* @param tick

*/

public TradePosition(SignalDirection direction, SignalType type, Tick tick) {

if (direction != SignalDirection.BUY && direction != SignalDirection.SELL) {

throw new RuntimeException("Cannot create trade position with direction: " + direction);

}

this.direction = direction;

this.type = type;

this.tick = tick;

}

@Override

public String toString() {

DecimalFormat df = new DecimalFormat("0.0000");

StringBuilder sb = new StringBuilder(30).append(direction).append(",").

append(df.format(direction == SignalDirection.BUY ? -1d * tick.getBuyPrice() : tick.getSellPrice())).

append(",").

append(Util.formatDate(tick.getTimestamp())).append(", ").append(type);

return sb.toString();

}

/**

* Reference to the tick when this position is opened/closed

* @return

*/

public Tick getTick() {

return tick;

}

/**

* Get the direction of this position

* @return

*/

public SignalDirection getDirection() {

return direction;

}

/**

* Get the signal type of this position

* @return

*/

public SignalType getSignalType() {

return type;

}

@Override

public boolean equals(Object obj) {

if (obj instanceof TradePosition) {

TradePosition b = (TradePosition) obj;

return this.direction == b.direction && this.type == b.type && this.tick.equals(b.tick);

}

return false;

}

public int compareTo(TradePosition o) {

int i = this.tick.compareTo(o.getTick());

return (i == 0) ? this.direction.toString().compareTo(o.direction.toString()) : i;

}

@Override

public int hashCode() {

return tick.hashCode();

}

}

///////////////////////////////////////////////////////////////////////////////////////////////////////////////

public class Tick implements Comparable, Serializable {

/**

* The bid/offer spread, e.g. in EUR/USD, this is generally 2 pips, that is 0.0002.

* Set this value before running a strategy.

*/

public static double BID_OFFER_SPREAD = 0d; //0.0002d;

protected Date date;

protected long volume;

protected double open;

protected double close;

protected double low;

protected double high;

protected Tick() {

}

public Tick(Date date, long volume, double open, double close, double low, double high) {

this.date = date;

this.volume = volume;

this.open = open;

this.close = close;

this.low = low;

this.high = high;

}

public Date getTimestamp() {

return date;

}

public long getVolume() {

return volume;

}

public double getOpenPrice() {

return open;

}

public double getClosePrice() {

return close;

}

public double getLow() {

return low;

}

public double getHigh() {

return high;

}

/**

* Is a function of closing price + (SPREAD / 2);

* @return

*/

public double getBuyPrice() {

return close + (BID_OFFER_SPREAD / 2d);

}

/**

* Is a function of closing price - (SPREAD / 2);

* @return

*/

public double getSellPrice() {

return close - (BID_OFFER_SPREAD / 2d);

}

/**

* Compare the current tick's timestamp with the other's

*/

public int compareTo(Tick o) {

long thisVal = this.date.getTime();

long anotherVal = o.date.getTime();

return (thisVal < anotherVal ? -1 : (thisVal == anotherVal ? 0 : 1));

}

@Override

public String toString() {

StringBuilder sb = new StringBuilder();

sb.append(Util.formatDate(date)).append(" P: ").append(getSellPrice()).append("/").append(getBuyPrice()).

append(" H: ").append(high).

append(" L: ").append(low).

append(" O: ").append(open);

return sb.toString();

}

@Override

public boolean equals(Object obj) {

if (obj instanceof Tick) {

Tick o = (Tick) obj;

return this.close == o.close && this.getTimestamp() == o.getTimestamp() && this.high == o.high && this.low == o.low && this.open == o.open;

}

return false;

}

@Override

public int hashCode() {

return date.hashCode();

}

}