Help writing accutrack code

Hello:

There is a formula on the site for accutrack, but it does not work properly and does not match fasttrack results.

Can someone help produce the equivalent of this in amibroker? Thank you.

AccuTrack Indicator (A Chart)
AccuTrack Parameter 1 is a smoothing
factor. Parameter 2 governs the length of
the moving averages used internally in
the computation of AccuTrack. To com-
pute each day's AccuTrack bar:

  1. Compute a daily change for the fund
    and the index by the formula:
    Change= (TodayNAV - YesterdayNAV)/YesterdayNAV
  2. Exponentially smooth FundChange
    and IndexChange by Parameter 2
    starting from the 1st date in the data-
    base.
  3. Subtract the smoothed FundChange
    and IndexChange computed above.
    Diff= FundChange - IndexChange
  4. Exponentially smooth Diff by Parameter 1.
  5. Check the data for the maximum and
    minimum values. Then scale the data
    to fit in the range 1 to 100.
  6. Plot each day's value as a vertical bar
    with 50 falling at the centerline.
    The default parameter values are,
    Param1 = 12 x 4.5/SD
    Param2 = 4 X Param1

Standard Deviation (SD=)
FastTrack's Standard Deviation is done
for consecutive 21 market day periods
when the number of market days dis-
played>105 or for consecutive 7 market-
day periods when the number of market
days is <=105. The computation is always
performed for the number of days
displayed OR for the number of days that
the fund (red line) existed, whichever is
shorter.

Hello @HarryL,

I think you're asking someone to do some work for you, for nothing!?

There are plenty of professional programmers who'd be willing to help you out:

Or, perhaps you'd like to have a go at it yourself, share what you've done - others might then be willing help you with it.

Sorry, guess I didn't understand the protocol here.

@HarryL,

See How to ask a good question.

No problem @HarryL - the norms of a "city" aren't always obvious for first-time visitors.

The post mentioned by @TrendSurfer is a good starting point, and here're a couple more:

If you read some of the older posts on the forum, you'll see that a lot of less experienced traders/ AmiBroker users tend to demand all sorts of freebies, claiming a handicap (not good at IT/ programming/ etc.), don't or aren't prepared to put-in much effort themselves, and don't really understand what they're asking for - it wastes a lot of time and people's goodwill.

The description you've provided is an excellent starting point, and way better that the one-liners we get. There are a few things that aren't clear though:

  • what does "NAV" mean in "TodayNAV"? How is it defined/ calculated?
  • I presume that "5. Check the data for the maximum and minimum values. Then scale the data to fit in the range 1 to 100.", simple means rescaling the data. What's the formula/ algorithm for doing so?
  • Can you simplify the statement for the standard deviation calculation "FastTrack's Standard Deviation is done for consecutive 21 market day periods ...", as it's a bit confusing.

@HarryL unfortunately you gave a verbose description of building an indicator but
(A) you made no effort to show us your attempt and where you are stuck
(B) you left out key specifics of the formula's needed to make the calculations

A quick search yield's some important info. You want to consturct a Relative Performance Indicator (should have mentioned that Harry). And a sample of the output you are looking for (again you could have included this Harry),
image

FWIW AmiBroker has built in relative performance charting.

Back to your description, if you are to compare the price of the current chart symbol to another security you can use various different AmiBroker functions. Get familiar with Foreign and SetForeign

https://www.amibroker.com/guide/afl/foreign.html
https://www.amibroker.com/guide/afl/setforeign.html

An example to get you started.

Index = "$SPX";

// use the current symbol as your "Fund"
Fund = Close;
Index = Foreign( Index, "Close" );
SetForeign
// "compute the daily change"
// you could use the built in ROC indicator
IndexDailyChange = ROC( Index, 1 ); // expressed as percentage
FundDailyChange = ROC( Fund, 1 );

// smooth the above, I'll plug in some numbers
// Standard Deviation of which security? Both?
IndexParam1 = 12 * ( 4.5 / StDev( Index, 21 ) );
FundParam1 = 12 * ( 4.5 / StDev( Fund, 21 ) );

IndexParam2 = 4 * IndexParam1;
FundParam2 = 4 * FundParam1;

// because you have created an array for the smoothing parameters
// need to use AmiBroker's AMA, as the EMA function requires a scalar
Diff = AMA( FundDailyChange, FundParam2 ) - AMA( IndexDailyChange, IndexParam2 );

// oops, I'm stuck here.  What parameter do I use??
SmoothDiff = 

If I make some educated guesses and plug in parameters it is then fairly straightforward to get this type of plot

image

But without the exact detailed (and probably proprietary) information, then you will not be able to obtain an exact duplication of your other software's indicator.

Let us know how it goes and good luck.

7 Likes