-
I have taken some time in recent months to learn PowerBASIC, and specifically for creating DLL’s that expand upon the industry leading offering of Neuroshell built-in and custom indicators. One of the areas of interest for me is normality testing (ie. time series data distribution analysis).
I am by no-means a statistician, but John Ehlers article, “Probability—Probably A Good Thing To Know” (Oct, 2018 – TASC) discusses the importance of normally distributed mean reverting indicators and trading strategies. Ward Systems took the time to create a Neuroshell indicator that exports the binned dataset to an Excel csv file, which can be visually studied for normality characteristics (Ward TASC Indicator).
Rather than boring the group with another “Scholarly” article, I instead have included the PB code below. This code implements a simple rolling/moving Jarque-Bera (JB) statistic calculation. As opposed to visually interpreting the output, this indicator can be used as a rule-based interpretation of the time series. Simple internet browser searches will allow you to arrive at explanations for this JB normality test.
If you are interested in expanding your horizons as it pertains to Normality Testing, the following article breaks down the basics:
PowerBASIC Code:
SUB JB_Test ALIAS "Jarque-Bera" ( BYVAL PRC_input AS DOUBLE PTR , _ BYVAL Per AS LONG , _ BYVAL signal AS DOUBLE PTR , _ BYVAL cnt AS LONG ) EXPORT REGISTER i&, j& DIM s_ave#, s_sdev#, s_var#, s_skew#, s_kurt#, missing# DIM s_sum#, s_diff#, s_p#, s_adev#, s_sumsq#, s_sumsk#, s_sumku#, s_JB# DIM cf_1#, cf_2#, cf_3# ' Cheater Functions missing=3.4e38 FOR i=0 TO cnt-1 ' go through the entire chart IF i < Per-1 THEN ' there are not yet enough of the time series for the first average s_var = missing ELSE 'Step 1 - Calculate Windowed (Period) Mean s_sum=0 FOR j=i-(Per-1) TO i s_sum = s_sum + @PRC_input[j] NEXT j s_ave = s_sum / Per 'Step 2 - Calculate Windowed Variance & StDev j=0 s_sumsq = 0 FOR j=i-(Per-1) TO i cf_1 = (@PRC_input[j] - s_ave) s_sumsq = s_sumsq + (cf_1 * cf_1) NEXT j s_var = s_sumsq / (Per - 1) s_sdev = SQR(s_var) 'Step 3 - Skewness j=0 s_sumsk = 0 FOR j=i-(Per-1) TO i cf_2 = ((@PRC_input[j] - s_ave)/s_sdev) s_sumsk = s_sumsk + (cf_2 * cf_2 * cf_2) NEXT j s_skew = s_sumsk * (Per / ((Per-1)*(Per-2))) 'Step 4 - Kurtosis j=0 s_sumku = 0 FOR j=i-(Per-1) TO i cf_3 = ((@PRC_input[j] - s_ave)/s_sdev) s_sumku = s_sumku + (cf_3 * cf_3 * cf_3 * cf_3) NEXT j s_kurt = s_sumku * (Per * (Per + 1) / ((Per - 1) * (Per - 2) * (Per - 3))) - (3 * (Per - 1) ^ 2 / ((Per - 2) * (Per - 3))) 'Step 5 - Jarque-Bera Test Calcs s_JB = Per * ((s_skew * s_skew)/6 + (s_kurt * s_kurt)/24) @signal = s_JB END IF NEXT i END SUB
Nate
AS a follow-up to the prior post, attached is a Zip file containing the following items:
– Example NSDT Cht File
– Compiled DLL***
I tried to post these files, however had to edit with this note given the forum appears to restrict posting certain file types. I have submitted a request to customer support and will post as soon as I get a response
***Nate
The forum now has the ability to attach .cht and .zip files. However, .DLL files are not allowed to be posted.
Attachments:
You must be logged in to access attached files.
Arnaud Legoux Moving Average (ALMA)
I have spent some time over the last couple of days analyzing some smoothing indicators (Moving Averages), and stumbled across some discussion regarding the ALMA indicator. This is one of the newest additions (2009) to the the moving average family and shows some really good characteristics.
I noticed that there was an ALMA filter already within my template file, however it’s performance is far different than the one that I coded.
In an effort to visualize the performance of the indicator, attached you will find a chart export from Neuroshell.
The charting is broken down into two views:
- Performance for artificial impulse (20 per, .5 amplitude)
- Performance for EOD stock ticker
Also attached is a ZIP file containing the compiled indicator DLL, BAS file, CHT file and TPL files.
As a final note, I also attached the Original document describing the development of the ALMA indicator.
Regards,
Nate
Attachments:
You must be logged in to access attached files.
Very nice…ALMA performance jpg…try also Cybenetic Analysis Netlead with Price, Close and Open compare those three to the ALMA indicator. I use the three Netlead indicators for eyeballing potential entry/exits…but I will have to look into the ALMA indicator some more.
I will try to post a chart here with that info within this next week.
I am looking for FOREX trading entry strategies to hold for a few hours to a day or two.
Trader Cleve
You must be logged in to reply to this topic.