TeeChart 8.02 Darvas Boxes
TeeChart 8.02 Darvas Boxes
How do I find the top and bottom of a darvas box? That is, I want to develop additional logic based on whether a new value will be within or outside a particular Darvas box.
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Nina,
You can do something like this:
You can do something like this:
Code: Select all
for i:=0 to Series1.Count - 1 do
begin
tmpL:=Series1.Boxes[i].Left;
tmpR:=Series1.Boxes[i].Right;
tmpT:=Series1.Boxes[i].Top;
tmpB:=Series1.Boxes[i].Bottom;
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
More on Darvas Boxes
After trying the suggestion several times I am still unable to get the values for the hinges of the darvas boxes. What am I doing wrong?
I have defined the Darvas Series as:
I am adding data into the Darvas Series using:
Some of the sample data is:
Date,Open,High,Low,Close,Volume,Adj Close
080416,29.34,30.60,29.34,30.40,2882600,30.40
080417,30.51,30.69,29.88,30.09,1966100,30.09
080418,30.63,31.30,30.54,30.97,2172800,30.97
080421,30.72,30.99,30.38,30.66,1798900,30.66
080422,30.48,30.61,29.96,30.15,1512000,30.15
080423,30.14,31.19,30.13,31.04,2317800,31.04
080424,31.03,31.75,30.85,31.44,2384000,31.44
080425,31.54,31.79,30.95,31.53,2077600,31.53
The generated graph is at: http://winors.tzo.com/cgi-bin/darvas/a.jpg
When I used the suggested code (shown below) to access the last darvas boxes’ hinge, the values I get for Left, Right, Top, and Bottom are: 20905284.00, 0.00, 280.00, 16973824.00,
I am obviously doing something wrong. Please help.
Thanks,
Nina[/img]
I have defined the Darvas Series as:
Code: Select all
DarvasSeries1: TDarvasSeries;
Code: Select all
DarvasSeries1.AddOHLC(ADate,AOpen,AHigh,ALow,AClose);
Date,Open,High,Low,Close,Volume,Adj Close
080416,29.34,30.60,29.34,30.40,2882600,30.40
080417,30.51,30.69,29.88,30.09,1966100,30.09
080418,30.63,31.30,30.54,30.97,2172800,30.97
080421,30.72,30.99,30.38,30.66,1798900,30.66
080422,30.48,30.61,29.96,30.15,1512000,30.15
080423,30.14,31.19,30.13,31.04,2317800,31.04
080424,31.03,31.75,30.85,31.44,2384000,31.44
080425,31.54,31.79,30.95,31.53,2077600,31.53
The generated graph is at: http://winors.tzo.com/cgi-bin/darvas/a.jpg
When I used the suggested code (shown below) to access the last darvas boxes’ hinge, the values I get for Left, Right, Top, and Bottom are: 20905284.00, 0.00, 280.00, 16973824.00,
Code: Select all
With DarvasSeries1 Do
begin
tmpL:=(Boxes[count-1].Left);
tmpR:=(Boxes[count-1].Right);
tmpT:=(Boxes[count-1].Top);
tmpB:=(Boxes[count-1].Bottom);
end;
Thanks,
Nina[/img]
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Nina,
Could you please send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Thanks in advance.
Could you please send us a simple example project we can run "as-is" to reproduce the problem here?
You can either post your files at news://www.steema.net/steema.public.attachments newsgroup or at our upload page.
Thanks in advance.
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Nina,
Thanks for the example project. You get an Access Violation because you are trying to retrieve Darvas boxes when they haven't been calculated because the chart hasn't being painted yet. A solution to this is making a call to TChart's Draw method before as shown in the code snippet below.
Thanks for the example project. You get an Access Violation because you are trying to retrieve Darvas boxes when they haven't been calculated because the chart hasn't being painted yet. A solution to this is making a call to TChart's Draw method before as shown in the code snippet below.
Code: Select all
(* HERE IS WHERE I GET AN ACCESS VIOLATION *)
AssignFile(Dfl,'DarvasHinges.txt');
Rewrite(Dfl);
showmessage(floattostr(darvasseries1.count)) ;
Chart1.Draw;
With DarvasSeries1 Do
for ii := 0 to Count-1 Do
begin
tmpL:=(Boxes[ii].Left);
tmpR:=(Boxes[ii].Right);
tmpT:=(Boxes[ii].Top);
tmpB:=(Boxes[ii].Bottom);
Writeln(Dfl,TickerSS+' ',tmpR,' ',tmpR,' ',tmpT,' ',tmpB);
end;
CloseFile(Dfl);
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Darvas Hinges
Hi,
The Chart1.Draw did solve the access violation. However, the numbers for the darvas hinges are still out of range -- that is they do not represent anything that i see on the screen.
~ nina
The Chart1.Draw did solve the access violation. However, the numbers for the darvas hinges are still out of range -- that is they do not represent anything that i see on the screen.
~ nina
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Nina,
Using code below, in DarvasHinges.txt you get the candle's point indexes for the boxes in tmpL, tmpR, tmpT and tmpB.
If you want to get the screen coordinates of the boxes you need to change the for loop like this:
And if you want to retrieve series values corresponding to the boxes:
Hope this helps!
Using code below, in DarvasHinges.txt you get the candle's point indexes for the boxes in tmpL, tmpR, tmpT and tmpB.
Code: Select all
(* HERE IS WHERE I GET AN ACCESS VIOLATION *)
AssignFile(Dfl,'DarvasHinges.txt');
Rewrite(Dfl);
//showmessage(floattostr(darvasseries1.count)) ;
Chart1.Draw;
With DarvasSeries1 Do
//for ii := 0 to Count-1 Do
for ii := 0 to Length(Boxes) Do
begin
tmpL:=(Boxes[ii].Left);
tmpR:=(Boxes[ii].Right);
tmpT:=(Boxes[ii].Top);
tmpB:=(Boxes[ii].Bottom);
Writeln(Dfl,TickerSS+' ',tmpL,' ',tmpR,' ',tmpT,' ',tmpB);
end;
CloseFile(Dfl);
Code: Select all
for ii := 0 to Length(Boxes) Do
begin
tmpL:=CalcXPos(Boxes[ii].Left);
tmpR:=GetVertAxis.CalcYPosValue(HighValues.Value[Boxes[ii].Right]);
tmpT:=CalcXPos(Boxes[ii].Top);
tmpB:=GetVertAxis.CalcYPosValue(LowValues.Value[Boxes[ii].Bottom]);
Writeln(Dfl,TickerSS+' ',tmpL,' ',tmpR,' ',tmpT,' ',tmpB);
end;
Code: Select all
for ii := 0 to Length(Boxes) Do
begin
tmpL:=XValue[Boxes[ii].Left];
tmpR:=HighValues.Value[Boxes[ii].Right];
tmpT:=XValue[Boxes[ii].Top];
tmpB:=LowValues.Value[Boxes[ii].Bottom];
Writeln(Dfl,TickerSS+' ',tmpL,' ',tmpR,' ',tmpT,' ',tmpB);
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Nina,
Sorry but there's an error with my last 2 examples, tmpL, tmpR, tmpT and tmpB should be like this:
Sorry but there's an error with my last 2 examples, tmpL, tmpR, tmpT and tmpB should be like this:
Code: Select all
tmpL:=CalcXPos(Boxes[ii].Left);
tmpT:=GetVertAxis.CalcYPosValue(HighValues.Value[Boxes[ii].Top]);
tmpR:=CalcXPos(Boxes[ii].Right);
tmpB:=GetVertAxis.CalcYPosValue(LowValues.Value[Boxes[ii].Bottom]);
Code: Select all
tmpL:=XValue[Boxes[ii].Left];
tmpT:=HighValues.Value[Boxes[ii].Top];
tmpR:=XValue[Boxes[ii].Right];
tmpB:=LowValues.Value[Boxes[ii].Bottom];
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Nina,
You're welcome. I'm glad to hear that helped.
Yes, sorry, my fault, it should be like this:
You're welcome. I'm glad to hear that helped.
Yes, sorry, my fault, it should be like this:
Code: Select all
for ii := 0 to Length(Boxes)-1 Do
begin
tmpL:=XValue[Boxes[ii].Left];
tmpR:=HighValues.Value[Boxes[ii].Right];
tmpT:=XValue[Boxes[ii].Top];
tmpB:=LowValues.Value[Boxes[ii].Bottom];
Writeln(Dfl,TickerSS+' ',tmpL,' ',tmpR,' ',tmpT,' ',tmpB);
end;
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |