building text based point and figure charts in Matlab or R

tdzidic

Newbie
4 0
I am wondering if anybody has some advice how to program point and figure on your own. I know that I shoud use array, and I know how to export it to ascii file, but algorithm for building that array just eludes me.

My goal is to produce charts like this
110 .X.........................
105 OXO........................
100 OXO........................
095 O.O........................


I would appreciate any help and pointers to solution.

Thank you.

Tom
 

tdzidic

Newbie
4 0
finished in R

I will post it tomorrow.
Now I need methodology for backtesting (pattern recognition).

Thanks.

T.
 

tdzidic

Newbie
4 0
asking for answers clarifies thinking

This is what I came up with, written for R (www.r-project.org).
Any suggestions and questions welcome.
Of course tips on developing backtesting engine for testing signals and optimizations are also welcome.

T.
 

Attachments

dick_dastardly

Established member
843 152
I am wondering if anybody has some advice how to program point and figure on your own. I know that I shoud use array, and I know how to export it to ascii file, but algorithm for building that array just eludes me.

My goal is to produce charts like this
110 .X.........................
105 OXO........................
100 OXO........................
095 O.O........................


I would appreciate any help and pointers to solution.

Thank you.

Tom
Not sure I understand but is this the sort of thing you're trying to do ?

dd
 

Attachments

tdzidic

Newbie
4 0
Not sure I understand but is this the sort of thing you're trying to do ?

dd
Yes, exactly. I have almost usable solution, (prev. post) but if you have something better (polished) I would appreciate it.

T.
 

dick_dastardly

Established member
843 152
Yes, exactly. I have almost usable solution, (prev. post) but if you have something better (polished) I would appreciate it.

T.
I did it using Visual Basic.

Same as you I used a 2 dimension string array and set each value in the array to a single empty space ( I see you used a period ???? ). All I did then was to plot the P+F chart within the array by overwriting the empty spaces with X's or 0's. After that it's just a simple matter or printing the result out to a txt file in a series of horizontal strips ( strings ).

The complex part is calculating the plot from the original price data.

I suppose it would be better to create a csv file then you could open it with Excel. That way you could draw lines and use conditional formating to add colour to the chart.

dd

[edit] thinking about it, if you used a macro in Excel you could just output the X's and 0's straight into the empty cells on a spread sheet. I wonder if P+F is available as a chart in Excel ? Never thought of that ! I'll go check.
 
Last edited:

ab112358

Newbie
4 0
VB Code

dd,
I've been trying to look for an excel based P&F charting system, no luck yet! Have you come across one yet?
Cheers'
A

I did it using Visual Basic.

Same as you I used a 2 dimension string array and set each value in the array to a single empty space ( I see you used a period ???? ). All I did then was to plot the P+F chart within the array by overwriting the empty spaces with X's or 0's. After that it's just a simple matter or printing the result out to a txt file in a series of horizontal strips ( strings ).

The complex part is calculating the plot from the original price data.

I suppose it would be better to create a csv file then you could open it with Excel. That way you could draw lines and use conditional formating to add colour to the chart.

dd

[edit] thinking about it, if you used a macro in Excel you could just output the X's and 0's straight into the empty cells on a spread sheet. I wonder if P+F is available as a chart in Excel ? Never thought of that ! I'll go check.
 

dick_dastardly

Established member
843 152
Thanks dd,

Would it be possible for you to send me the code which you used to create the OXO.txt file? I will try to modify that to create a P&F module in excel/VBA.
abhi112358@gmail.com

Cheers
A
I knew someone was going to ask me that. I think it got lost when my old desktop PC had a stroke. I'll see if I can find a backup copy on a disk.

Failing that, if I get a spare moment I'll have a go at building a simple macro in excel.

The original code was written in a old version Visual Basic Editor ( not excel ) so the code wouldn't have worked in a macro anyway.

dd
 

ab112358

Newbie
4 0
I knew someone was going to ask me that. I think it got lost when my old desktop PC had a stroke. I'll see if I can find a backup copy on a disk.

Failing that, if I get a spare moment I'll have a go at building a simple macro in excel.

The original code was written in a old version Visual Basic Editor ( not excel ) so the code wouldn't have worked in a macro anyway.

dd
Hehe..
Thanks for looking. Don't worry about re-writing the code if you don't have it handy. I know the algorithm, I can get someone to convert it to a VBA code.
And apologies for the delay in the response...
Cheers
AB
 

timsk

Legendary member
7,059 1,861
Hi All,
If you've still got unresolved issues regarding Excel and P&F charts, it might be worth contacting DaveJB - as he's something of an expert in this field. He doesn't post much these days, but he does look in from time to time.
Tim.
 

DaveJB

Experienced member
1,159 42
Hi,
saw this as I was browsing... my program is/was thousands of lines of Visual Basic code, not something that would be convertible to Excel, or any other program. As a general idea I stored price data in a whole bunch of arrays - O,H,L,C,Date for the price data, an array held info on what the columns of X's and O's should be like - primarily info such as 'date column started, is it X or O, price of lowest box in the column, price of highest box in column... and so forth.

This was quite memory hungry, it would never have worked on a ZX81!

Backtesting - this depends on what you want your tests to be like, I wanted to simulate actual trading so it got rather involved, but if you just want to know if the column continued up after a double top (say) then you can do that very easily by comparing the top prices in alternate columns (ie compare one X column with the previous X column).

Programming this got very complex, but much of that was due to trying to make it handle all markets - if you only want FTSE or USA you don't have to put so many extras in to handle huge price ranges, and if you are happy with a single method of box sizing that again simplifies it rather.

Dave
 

ab112358

Newbie
4 0
Hi,
saw this as I was browsing... my program is/was thousands of lines of Visual Basic code, not something that would be convertible to Excel, or any other program. As a general idea I stored price data in a whole bunch of arrays - O,H,L,C,Date for the price data, an array held info on what the columns of X's and O's should be like - primarily info such as 'date column started, is it X or O, price of lowest box in the column, price of highest box in column... and so forth.

This was quite memory hungry, it would never have worked on a ZX81!

Backtesting - this depends on what you want your tests to be like, I wanted to simulate actual trading so it got rather involved, but if you just want to know if the column continued up after a double top (say) then you can do that very easily by comparing the top prices in alternate columns (ie compare one X column with the previous X column).

Programming this got very complex, but much of that was due to trying to make it handle all markets - if you only want FTSE or USA you don't have to put so many extras in to handle huge price ranges, and if you are happy with a single method of box sizing that again simplifies it rather.

Dave

That's great Dave, thanks for sharing the info & logic.

I am currently in the early stages building this application. I am working on the first stage of constructing the P&F charts. (On that note, I have attached a basic EasyLanguage code for plotting P&F charts. I wouldn't mind if you have the time to skim through the logic to confirm that I am on the right track!) However, over the next few weeks, I intend to develop this into a full-fledged P&F application. I would be greatly benefited if you could possibly advise me regarding the kind of functionalities you incorporated in your trading simulation application. Also, let me know if there is any documentation you could share regarding this application.

If you have the time I would like to be in touch with you on a regular basis to get your feedback/advice on my progress with this application (using perosnal email if you prefer).

Thanks. Let me know.
My personal email is abhishekbhatewara@gmail.com
Regards
AB
 

Attachments

DaveJB

Experienced member
1,159 42
Hi,
I've emailed you one of the docs I used to supply with my program so you can get a feel for what was included - you'll note that it did candlecharts and various sorts of pattern finding on candle/bar charts as well as locating a couple of dozen P&F signals.

The backtesting was pretty involved, so a second email has the relevant manual attached so you can see how that went. This allowed different filters to be selected for entry and exit conditions, and worked by replaying each share, 1 day at a time, until entry/exit were signalled based on the price data that would be visible at the relevant close and open.

Whilst I don't mind the odd question I am not going to read code or be a consultant - I'm not being grumpy here but this program was a tremendous amount of work (60 hrs a week for several years) and I cannot conceive of being able to make a meaningful input that wouldn't involve me in a great deal of time and effort... I have a busy life and my current career already fills enough of my spare time up, I really don't have time to do more than pass the odd comment.

I will say that if you limit the scope to being functional rather than pretty, and only program it to do what you want yourself, the job isn't too huge... if you start thinking about releasing it to a wider audience (at which point you have to devote time to removing unsightly bits and fixing that routine that makes the chart go upside down on Tuesdays etc) then it's a whole new ball game...so if that's an aim email me and I'll explain some of the stuff that isn't immediately apparent when a good idea pops up.

I recommend the Carol Aby book for P&F charting, by the way.

Dave
 

AdBlock Detected

We get it, advertisements are annoying!

But it's thanks to our sponsors that access to Trade2Win remains free for all. By viewing our ads you help us pay our bills, so please support the site and disable your AdBlocker.

I've Disabled AdBlock