Stock Portfolio Organizer
The ultimate porfolio management solution.
WiseTrader Toolbox
#1 Selling Amibroker Plugin featuring:
N-Root Formula for Amibroker (AFL)
This function calculates the n-root of a number or array.
Indicator / Formula
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | //------------------------------------------------------------------------------ // // This function calculates the n-root of a number or array. // //------------------------------------------------------------------------------ /*_______________________________________________________________________________________ SYNTAX: nRoot(index,number) PURPOSE: This function calculates the n-root of a number or array. The n-root of a negative number returns a zero value. HOW TO USE: Copy this file in your "include" directory or append it to another file that You use as "functions database". EXAMPLE: 1. if you want to calculate the square-root of 100, you can use indifferently: Square_root = Sqrt(100); or n_Root = nRoot(2,100); 2. if you want to calculate the cube-root of 100 or whatever: n_Root = nRoot(3,100); n_Root = nRoot(10,100); n_Root = nRoot(-2,Close); ______________________________________________________________________________________ */ Function nRoot(index,number) { cond_r = index == 0 or number == 0 or number < 0; If_True = 0; If_False = ( Exp ( (1 / index) * Log (number))); result = iif (cond_r, If_True, If_False); Return result; } |
0 comments
Leave Comment
Please login here to leave a comment.
Back