AF,
One more thought. If we could read the properties of a study as
opposed to just the array of points, we could do more with creating
custom studies. However, even if we can only continue to get the
array out of the STUDY() function as is, a new type of study would
make the idea below a lot nicer. If we had a single point study, we
could arrange several of them as the needed points. They just need to
by represented by a symbol something like a medium hollow circle with
a handle at the center. That way each could be dragged to any point
on the chart by grabbing the central handle or selected by clicking on
the ring (needed to select in congested areas). Any other information
associated with the type of custom study desired or special
identification of the points or linking them together graphically, can
be done with AFL.
Writing the user interaction part for moving the study handle points
completely in AFL is functionally possible, but not acceptable due to
the single threaded nature of AFL. However, the study drawing
interactions is in a different thread from AFL and gets priority for
being dragged.
We have Studies for two point lines, vertical line of only the date
point, and a horizontal line of just price. This third single point
type would be quite useful and versatile.
I have written this up as a suggestion:
http://www.amibroker.com/feedback/view_bug.php?bug_id=1771
Best regards,
Dennis
On May 19, 2009, at 1:26 PM, af_1000000 wrote:
Dennis. Thanks for some thoughts. I will think about your solutions.
This is still about going around the problem rather than solving it,
but it is better than nothing. A set of points is a study of its
own, unfortunately not available currently in AB. What to do with
these points is up to the script. It is hard to believe that AB
missed the ball in this area. As I am aware, passing arrays from one
indicator to another without re-calculating is only available in AB
(KUDOS to TJ for it). There are some other features, so superior to
other software packages, but ..... missing collecting points before
script execution .. is a great and rather unexpected disappointment.
AF
On May 19, 2009, at 11:48 AM, Dennis Brown wrote:
AF,
Here is another approach that I have been thinking about (random
thoughts):
1. Create your current study using the built-in study drawing tools
to define points or lines.
2. Have one study ID for each type of study or point you want to
draw. You can keep the current study lines on chart.
3. Draw your custom study function on chart based on the start/end
points of the study ID.
4. On a param trigger or chart button, collect the current study
points of price/time list to a file for permanent storage.
5. Extend the line as far as desired in bars from the starting point
or extension from start and end points.
Erasing old studies in the list without erasing all the studies in
the
file may not be as easy.
Each study could be its own file, with temp storage in static
variables for speed -- a method I currently use.
Studies could be numbered and noted on the chart so it would be easy
to reference their number to delete them from a param trigger.
Best regards,
Dennis
PS. Please top post to make the threads readable in emails.
On May 19, 2009, at 12:54 PM, af_1000000 wrote:
[edited for continuity]
Sorry, I reposed it. The previous one was hardly readable.
Thanks for a prompt replay. Sorry TJ, but your response is a semi-
constructive one. I mentioned in my original posting that I do NOT
want to use GFX functionality for several reasons:
1. It would be nice to save AFL study the same way as any other
studies for future references (if I shut down AB and open it again
tomorrow or the day after tomorrow the study still should be
available - the anchor points never change unless they are
adjusted by the user).
2. If points anchors: A,B,C (mentioned in the original example)
are off the chart tomorrow (e.g. intra chart) , but still within
loaded bars I should be able to see the result of the study. For
that reason I would use LineArray()to plot any lines or other
polygon type shapes.
It seems that the project is doable. To accomplish the task the
script would have to:
1. Collect three mouse clicks (waiting every time for a chart
refresh - quite a difference from collecting values for other
parameters).
2. Store click coordinates in the external file (ASCII) for future
references using some kind of naming convention, so the file could
be found later on.
3. Every time a symbol is selected the script would have to check
if there are any studies (external files) available with the
number of coordinates required (equal to number of clicks handled
by this particular script). If studies are not available should it
wait to gather them ??? (even if studies for that symbol are not
needed). Well, the problem with templates, Chart_Ids is another
story better left for future considerations.
It should be obvious that the method described above is quite
primitive and rather rude. I hope that I am wrong and something
better exists.
Logically, AFL study should not differ from any other PARAM
function. PARAM functions accept values from users (either entry
or selection from the list) and remember them for any current or
future executions).
What is the difference between Length = Param("Len", 5) which
stores the length equal to 5 and e.g. Clicks = ParamClick(3) ?
(which could gather three mouse clicks and store cliks
coordinates) . To get individual coordinates: e.g. Click_1_X =
GetX(Clicks[ 1]),Click_ 1_Y = GetY(Clicks[ 1]), ... and so on. It
is up to the script to interpret parameter values as long as they
are available.
I realize that such functionality does not exist in AB, but maybe
there is something better than I described earlier ?
AF
--- In amibroker@yahoogroups.com, "Tomasz Janeczko" <gro...@...>
wrote:
All this is possible using these 3 building blocks:
1.
Reading X/Y pos and mouse clicks:
http://www.amibroker.com/guide/afl/afl_view.php?id=295
http://www.amibroker.com/guide/afl/afl_view.php?id=296
http://www.amibroker.com/guide/afl/afl_view.php?id=297
2.
Converting from var-value to pixel
http://www.amibroker.com/kb/2009/03/30/how-to-convert-from-bar-value-to-pixel-co-ordinates/
3.
Drawing:
http://www.amibroker.com/guide/h_lowlevelgfx.html
Best regards,
Tomasz Janeczko
amibroker.com
----- Original Message -----
From: "af_1000000" <af_1000...@...>
To: <amibroker@yahoogroups.com>
Sent: Monday, May 18, 2009 10:19 PM
Subject: [amibroker] AFL Studies
I have tried to re-create some studies created before in other
software packages with ease, but it seems that I hit the wall in
AB.
Let's start with a very simple, but very powerful.
1. Identify 3 swing pivot points A,B,C. B is between A and C.
2. Connect A and C and plot a parallel line through B.
3. Plot parallel lines to AC in 1.27, 1.68, 2.68, .... distance
between AC and parallel line trough B. Lines will be below or
above B depending on whether B is above or below AC.
4. Connect B and C.
5. Plot parallel lines to the right of A in 0.32, 0.5, 0.68, 0.72,
1, 1.28, 1.68, ... distance between A and C.
6. Watch the market and see what is going to happen. As a matter
of fact you can created such a study in the past and verify
results.
To accomplish the task three mouse clicks (on A,B,C) and the
ability to draw lines are needed. To draw lines is easy in AFL,
but
to collect A,B,C co-ordinates seems to be impossible. I do not
want to use GFX functionality, because the study should still work
even though A,B,C are no longer visible on the chart and I do not
want to display more bars on the chart to make them visible.
How to do it in AB ? Any constructive help will be appreciated.
And by the way. If collection of mouse clicks can be stored and
re-
created at any time your imagination is the only limit what you
can do with the studies (e.g. crating manual Elliot waves and
drawing waves projections,drawing geometric
shapes,................,
etc).
AF