Australian (ASX) Stock Market Forum

GP_Trendlines AmiBroker Plugin and AFL Files

GreatPig

Pigs In Space
Joined
9 July 2004
Posts
2,368
Reactions
14
Here is the trend line drawing plugin for AmiBroker and AFL code to use it. Instructions are included in a PDF file as well as at the start of each AFL file.

While I think it works reasonably well now (although the backtester is pretty slow), I'll probably keep working on it and updating it here occasionally.

You are free to use it for personal, non-commercial use, and all use is at your own risk. While I haven't had any problems yet, I can't guarantee that there aren't any bugs in the DLL.

Any feedback welcome.

Cheers,
GP
 

Attachments

  • GP_Trendlines.zip
    53.6 KB · Views: 1,029
It's very decent of you GP to share the fruits of your labours, even though I have no idea what this coding stuff is I'm sure you've saved a lot of people a lot of trouble. Keep it up! It's very considerate and in the right spirit imo. Traders helping Traders, sounds nice.
 
GP -I have not used it yet but it looks very useful.
Thanks very much for sharing this with everyone.
 
I'm getting a syntax error on the line-

fit = GP_DrawTrendLines(Bottom, Top, 2, startIx, 0, tchg, 0, closeOver, 0, isUp, Prefs(24));

and have AB 4.7.

Sorry to rain on your parade :eek:
 
loakglen said:
I'm getting a syntax error on the line-

fit = GP_DrawTrendLines(Bottom, Top, 2, startIx, 0, tchg, 0, closeOver, 0, isUp, Prefs(24));

and have AB 4.7.
Hmm... I'm using 4.7 now and don't get that. Is that with the indicator or exploration - or perhaps both?

And is it using my original AFL file or have you modified it?

Just looking at it, I can't imagine why it would give a syntax error. Try changing "Prefs(24)" to either zero or one (zero for linear display or one for log), although that function still works on my version.

Anyone else tried it and is getting this error?

Cheers,
GP
 
kaveman said:
Prefs() have disappeared and no longer required
Okay. I'll have work out how else to find the linear/log display setting then.

Thanks.

GP
 
Set chart view in the Parameters popup window
You can set a single preference in AFL using SetChartOptions
 
So you can only set the chart options, not get the current settings (ie. read the standard Axes Type parameter)?

I don't see any GetChartOptions function.

GP
 
What I mean is if you set the chart linear/log setting in the Axes & Grid parameters (the one called "Type"), is it possible to read that particular setting in AFL code, similar to how Prefs(24) would read it for the main chart in 4.60 (and still does seem to in 4.70)?

Cheers,
GP
 
the original prefs all were in the preferencs for the chart & indicator settings. The majority of these are no longer in the preferences being replaced with the list of dragndrop indicator/charts. You can now set the prefs you want within the afl files for these by changing the default value in the Param statements.
Sorry did not mean that the prefs as such were not there, just not settable in preferences window.
As I have never used these myself, or any result from them I cannot comment. As far as the values of the indicator settings can be easily coded into the title line. Getting result as to if the chart is log or linear unless you have internal settings to make a value zero or null depending on if log or linear cannot see much use for it as just looking at the chart tells you what axis setting is. What purpose do you need to display the axis settings?
 
kaveman said:
cannot see much use for it as just looking at the chart tells you what axis setting is. What purpose do you need to display the axis settings?
I don't want to display them, but I need to know the log/linear display setting to be able to draw trend lines correctly.

A straight line on a log display uses a different formula to a straight line on a linear display. If the formula doesn't match the actual mode in use, then the lines will appear curved.

Cheers,
GP
 
ok wondered about that. I think the stylelog disappeared a long time ago, so prefs(24) would not provide any results now regardless
btw I found prefs still available in help files. Was surprised but guess it had to remain due to older AFL using them

perhaps an email to AB support could tell you if axis type can be detected in AFL
 
Top