Field report: PNL and hit rate analysis for 5 basic strategies.

17/03/17- v0.1

por mrg


In [130]:
#Load packages
Pkg.add("TimeSeries");Pkg.add("MarketData");Pkg.add("Plots");Pkg.add("PlotlyJS");
Pkg.add("Gadfly");Pkg.add("StatsBase");Pkg.update(); Pkg.add("PlotRecipes");


INFO: Nothing to be done
INFO: Nothing to be done
INFO: Nothing to be done
INFO: Nothing to be done
INFO: Nothing to be done
INFO: No packages to install, update or remove
INFO: Package database updated
INFO: Updating METADATA...
INFO: Updating cache of DataFrames...
INFO: Updating cache of DataFrames...
INFO: Updating OhMyREPL master...
INFO: Updating Atom master...
INFO: Updating Tokenize master...
INFO: Computing changes...
INFO: No packages to install, update or remove
Update finished with errors.
=> Package DataFrames: unable to update cache.
GitError(Code:ERROR, Class:OS, Failed to receive response: The server returned an invalid or unrecognized response
)
 in macro expansion at .\libgit2\error.jl:99 [inlined]
 in #fetch#55(::Base.LibGit2.FetchOptions, ::String, ::Function, ::Base.LibGit2.GitRemote, ::Array{AbstractString,1}) at .\libgit2\remote.jl:70
 in (::Base.LibGit2.#kw##fetch)(::Array{Any,1}, ::Base.LibGit2.#fetch, ::Base.LibGit2.GitRemote, ::Array{AbstractString,1}) at .\<missing>:0
 in #fetch#96(::String, ::String, ::Array{AbstractString,1}, ::Nullable{Base.LibGit2.AbstractCredentials}, ::Function, ::Base.LibGit2.GitRepo) at .\libgit2\libgit2.jl:164
 in fetch(::Base.LibGit2.GitRepo) at .\libgit2\libgit2.jl:156
 in prefetch(::String, ::String, ::Array{String,1}) at .\pkg\cache.jl:64
 in update(::String, ::Set{String}) at .\pkg\entry.jl:403
 in (::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}})() at .\pkg\dir.jl:31
 in cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}}, ::String) at .\file.jl:48
 in #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N}) at .\pkg\dir.jl:31
 in update() at .\pkg\pkg.jl:210
 in include_string(::String, ::String) at .\loading.jl:441
 in execute_request(::ZMQ.Socket, ::IJulia.Msg) at C:\Users\miguel\.julia\v0.5\IJulia\src\execute_request.jl:157
 in eventloop(::ZMQ.Socket) at C:\Users\miguel\.julia\v0.5\IJulia\src\eventloop.jl:8
 in (::IJulia.##13#19)() at .\task.jl:360

 in update(::String, ::Set{String}) at .\pkg\entry.jl:463
 in (::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}})() at .\pkg\dir.jl:31
 in cd(::Base.Pkg.Dir.##2#3{Array{Any,1},Base.Pkg.Entry.#update,Tuple{String,Set{String}}}, ::String) at .\file.jl:48
 in #cd#1(::Array{Any,1}, ::Function, ::Function, ::String, ::Vararg{Any,N}) at .\pkg\dir.jl:31
 in update() at .\pkg\pkg.jl:210

In [1]:
using TimeSeries, MarketData, Plots, PlotlyJS, StatsBase,PlotRecipes;


INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\MarketData.ji for module MarketData.
INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\FixedSizeArrays.ji for module FixedSizeArrays.
INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\FixedPointNumbers.ji for module FixedPointNumbers.
INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\Colors.ji for module Colors.
INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\PlotUtils.ji for module PlotUtils.
INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\PlotThemes.ji for module PlotThemes.
INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\Showoff.ji for module Showoff.
INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\FileIO.ji for module FileIO.
INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\PlotlyJS.ji for module PlotlyJS.

Plotly javascript loaded.

To load again call

init_notebook(true)

INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\StatsBase.ji for module StatsBase.
INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\Distributions.ji for module Distributions.
INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\DataFrames.ji for module DataFrames.
INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\KernelDensity.ji for module KernelDensity.
INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\GeometryTypes.ji for module GeometryTypes.
WARNING: ColorTypes.U8 is deprecated, use FixedPointNumbers.Normed{UInt8, 8} instead.
  likely near C:\Users\miguel\.julia\v0.5\GeometryTypes\src\typealias.jl:90
INFO: Recompiling stale cache file C:\Users\miguel\.julia\lib\v0.5\LightGraphs.ji for module LightGraphs.

In [131]:
typeof(ohlc)


Out[131]:
TimeSeries.TimeArray{Float64,2,Date,Array{Float64,2}}

In [132]:
ohlc


Out[132]:
500x4 TimeSeries.TimeArray{Float64,2,Date,Array{Float64,2}} 2000-01-03 to 2001-12-31

             Open      High      Low       Close     
2000-01-03 | 104.88    112.5     101.69    111.94    
2000-01-04 | 108.25    110.62    101.19    102.5     
2000-01-05 | 103.75    110.56    103.0     104.0     
2000-01-06 | 106.12    107.0     95.0      95.0      
⋮
2001-12-26 | 21.35     22.3      21.14     21.49     
2001-12-27 | 21.58     22.25     21.58     22.07     
2001-12-28 | 21.97     23.0      21.96     22.43     
2001-12-31 | 22.51     22.66     21.83     21.9      

In [ ]:


In [6]:
α = .5
@code_llvm println("Helloworld")


; Function Attrs: uwtable
define %jl_value_t* @jlsys_println_52973(%jl_value_t*, %jl_value_t**, i32) #0 {
top:
  %3 = alloca %jl_value_t**, align 8
  store volatile %jl_value_t** %1, %jl_value_t*** %3, align 8
  %4 = call %jl_value_t*** @jl_get_ptls_states() #3
  %5 = alloca [7 x %jl_value_t*], align 8
  %.sub = getelementptr inbounds [7 x %jl_value_t*], [7 x %jl_value_t*]* %5, i64 0, i64 0
  %6 = getelementptr [7 x %jl_value_t*], [7 x %jl_value_t*]* %5, i64 0, i64 3
  %7 = getelementptr [7 x %jl_value_t*], [7 x %jl_value_t*]* %5, i64 0, i64 2
  %8 = bitcast %jl_value_t** %6 to i8*
  call void @llvm.memset.p0i8.i32(i8* %8, i8 0, i32 32, i32 8, i1 false)
  %9 = bitcast [7 x %jl_value_t*]* %5 to i64*
  store i64 10, i64* %9, align 8
  %10 = getelementptr [7 x %jl_value_t*], [7 x %jl_value_t*]* %5, i64 0, i64 1
  %11 = bitcast %jl_value_t*** %4 to i64*
  %12 = load i64, i64* %11, align 8
  %13 = bitcast %jl_value_t** %10 to i64*
  store i64 %12, i64* %13, align 8
  store %jl_value_t** %.sub, %jl_value_t*** %4, align 8
  %14 = load %jl_value_t*, %jl_value_t** inttoptr (i64 2216201192 to %jl_value_t**), align 8
  store %jl_value_t* %14, %jl_value_t** %7, align 8
  call void @jl_typeassert(%jl_value_t* %14, %jl_value_t* inttoptr (i64 2147425232 to %jl_value_t*))
  %15 = icmp eq i32 %2, 0
  br i1 %15, label %fail, label %pass

fail:                                             ; preds = %top
  call void @jl_bounds_error_tuple_int(%jl_value_t** %1, i64 0, i64 1)
  unreachable

pass:                                             ; preds = %top
  %16 = getelementptr [7 x %jl_value_t*], [7 x %jl_value_t*]* %5, i64 0, i64 4
  %17 = getelementptr [7 x %jl_value_t*], [7 x %jl_value_t*]* %5, i64 0, i64 5
  %18 = getelementptr [7 x %jl_value_t*], [7 x %jl_value_t*]* %5, i64 0, i64 6
  %19 = bitcast %jl_value_t** %1 to i64*
  %20 = load i64, i64* %19, align 8
  store %jl_value_t* inttoptr (i64 2153623744 to %jl_value_t*), %jl_value_t** %6, align 8
  store %jl_value_t* %14, %jl_value_t** %16, align 8
  %21 = bitcast %jl_value_t** %17 to i64*
  store i64 %20, i64* %21, align 8
  store %jl_value_t* inttoptr (i64 2159219968 to %jl_value_t*), %jl_value_t** %18, align 8
  %22 = call %jl_value_t* @jl_apply_generic(%jl_value_t** %6, i32 4)
  %23 = load i64, i64* %13, align 8
  store i64 %23, i64* %11, align 8
  ret %jl_value_t* inttoptr (i64 2147434512 to %jl_value_t*)
}

In [14]:
function hola1(x::Int64)
x +3 
end


Out[14]:
hola1 (generic function with 1 method)

In [12]:
hola(3)


Out[12]:
6

In [17]:
peakflops()


Out[17]:
1.9170163542126904e10

In [18]:
@time hola1(3)


  0.002490 seconds (13 allocations: 736 bytes)
Out[18]:
6

In [19]:
using BenchmarkTools

In [20]:
@benchmark hola1(3+5*4)


Out[20]:
BenchmarkTools.Trial: 
  memory estimate:  0 bytes
  allocs estimate:  0
  --------------
  minimum time:     1.698 ns (0.00% GC)
  median time:      2.039 ns (0.00% GC)
  mean time:        2.064 ns (0.00% GC)
  maximum time:     16.988 ns (0.00% GC)
  --------------
  samples:          10000
  evals/sample:     1000
  time tolerance:   5.00%
  memory tolerance: 1.00%

In [133]:
ohlc["Open"]


Out[133]:
500x1 TimeSeries.TimeArray{Float64,1,Date,Array{Float64,1}} 2000-01-03 to 2001-12-31

             Open      
2000-01-03 | 104.88    
2000-01-04 | 108.25    
2000-01-05 | 103.75    
2000-01-06 | 106.12    
⋮
2001-12-26 | 21.35     
2001-12-27 | 21.58     
2001-12-28 | 21.97     
2001-12-31 | 22.51     

In [134]:
import TimeSeries.moving

In [135]:
# Función ventana
function moving{T}(ta::TimeArray{T,1}, f::Function, window::Int; padding::Bool=false)
    tstamps = padding ? ta.timestamp : ta.timestamp[window:end]
    vals    = zeros(ta.values[window:end])
    @inbounds for i=1:length(vals)
        vals[i] = f(ta.values[(window-1)-i:])
    end
    padding && (vals = [NaN*ones(window-1); vals])
    TimeArray(tstamps, vals, ta.colnames, ta.meta)
end

function moving{T}(ta::TimeArray{T,2}, f::Function, window::Int; padding::Bool=false)
    tstamps = padding ? ta.timestamp : ta.timestamp[window:end]
    vals    = zeros(ta.values[window:end, :])
    @inbounds for i=1:size(vals,1), j=1:size(vals, 2)
        vals[i, j] = f(ta.values[i:i+(window-1), j])
    end
    padding && (vals = [NaN*ones(ta.values[1:(window-1), :]); vals])
    TimeArray(tstamps, vals, ta.colnames, ta.meta)
end


WARNING: Method definition moving(TimeSeries.TimeArray{#T<:Any, 1, 
Out[135]:
moving (generic function with 2 methods)

In [179]:
?first


search: first firstdayofyear firstdayofweek firstdayofmonth firstdayofquarter

Out[179]:
first(coll)

Get the first element of an iterable collection. Returns the start point of a Range even if it is empty.


In [175]:
#Nice, ya podemos tomar promedios en ventanas de tamaño N = 10
moving(ohlc,mean,10)


moving(ohlc,mean,10) = 491x4 TimeSeries.TimeArray{Float64,2,Date,Array{Float64,2}} 2000-01-14 to 2001-12-31

             Open      High      Low       Close     
2000-01-14 | 100.692   103.981   96.001    98.782    
2000-01-18 | 100.304   103.331   95.876    97.982    
2000-01-19 | 100.041   103.144   96.095    98.388    
2000-01-20 | 101.216   104.238   97.145    99.338    
⋮
2001-12-26 | 21.062    21.507    20.618    21.065    
2001-12-27 | 21.033    21.54     20.651    21.123    
2001-12-28 | 21.081    21.685    20.797    21.266    
2001-12-31 | 21.259    21.868    20.971    21.417    

Out[175]:
491x4 TimeSeries.TimeArray{Float64,2,Date,Array{Float64,2}} 2000-01-14 to 2001-12-31

             Open      High      Low       Close     
2000-01-14 | 100.692   103.981   96.001    98.782    
2000-01-18 | 100.304   103.331   95.876    97.982    
2000-01-19 | 100.041   103.144   96.095    98.388    
2000-01-20 | 101.216   104.238   97.145    99.338    
⋮
2001-12-26 | 21.062    21.507    20.618    21.065    
2001-12-27 | 21.033    21.54     20.651    21.123    
2001-12-28 | 21.081    21.685    20.797    21.266    
2001-12-31 | 21.259    21.868    20.971    21.417    

In [139]:
# Aquí se van a desarrollar las funciones estrategia

In [144]:
moving(ohlc,psnr,10)


MethodError: no method matching psnr(::Array{Float64,1})
Closest candidates are:
  psnr{T<:Real}(::AbstractArray{T<:Real,N}, ::AbstractArray{T<:Real,N}, ::Real) at C:\Users\miguel\.julia\v0.5\StatsBase\src\deviation.jl:183

 in #moving#6(::Bool, ::Function, ::TimeSeries.TimeArray{Float64,2,Date,Array{Float64,2}}, ::StatsBase.#psnr, ::Int64) at .\In[135]:16
 in moving(::TimeSeries.TimeArray{Float64,2,Date,Array{Float64,2}}, ::Function, ::Int64) at .\In[135]:13

In [145]:
?psnr


search: psnr specialized_bitwise_unary specialized_bitwise_binary flipsign

Out[145]:
psnr(a, b, maxv)

Compute the peak signal-to-noise ratio between two arrays a and b. maxv is the maximum possible value either array can take. The PSNR is computed as 10 * log10(maxv^2 / msd(a, b)).


In [149]:
using TimeSeries


WARNING: using TimeSeries.from in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.colnames in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.update in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.lag in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.dropnan in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.to in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.moving in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.collapse in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.findall in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.readtimearray in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.upto in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.meta in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.percentchange in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.uniformspaced in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.TimeArray in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.tail in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.head in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.findwhen in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.uniformspace in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.timestamp in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.by in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.AbstractTimeSeries in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.lead in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.basecall in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.rename in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.when in module Main conflicts with an existing identifier.
WARNING: using TimeSeries.writetimearray in module Main conflicts with an existing identifier.

In [150]:
@recipe function f{T<:TimeArray}(ta::T)
    st = get(d, :seriestype, :path)
    if in(st, [:candlestick, :heikinashi])
        Candlestick(ta)
    #elseif st == :ohlc #ohlc (meaning sticks with steps on the sides) should be passed on to Plots internal ohlc plot engine
    #    ta, ohlc = extract_ohlc(ta)
    #    collect(zip(ohlc)) # But there are currently issues with that
    else
        labels --> reshape(ta.colnames,1,length(ta.colnames))
        seriestype := st
        ta.timestamp, ta.values
    end
end

type Candlestick{D <: TimeType}
    time::Vector{D}
    open::AbstractVector
    high::AbstractVector
    low::AbstractVector
    close::AbstractVector
end

Candlestick(ta::TimeArray) = Candlestick(extract_ohlc(ta)...)

function extract_ohlc(ta::TimeArray)
    indices = [find(x->lowercase(x) == name, ta.colnames) for name in ["open", "high", "low", "close"]]
    minimum(length.(indices)) < 1 && error("The time array did not have variables named open, high, low and close")
    (ta.timestamp, [ta.values[:,i] for i in 1:4]...)
end

function HeikinAshi!(cs::Candlestick) #some values here are made too high!
    cs.close[1] = (cs.open[1] + cs.low[1] + cs.close[1] + cs.high[1]) / 4
    cs.open[1] = (cs.open[1] + cs.close[1])/2
    cs.high[1] = cs.high[1]
    cs.low[1] = cs.low[1]

    for i in 2:length(cs.open)
        cs.close[i] = (cs.open[i] + cs.low[i] + cs.close[i] + cs.high[i]) / 4
        cs.open[i] = (cs.open[i-1] + cs.close[i-1]) / 2
        cs.high[i] = maximum([cs.high[i], cs.open[i], cs.close[i]])
        cs.low[i] = minimum([cs.low[i], cs.open[i], cs.close[i]])
    end
end

@recipe function f(cs::Candlestick)
    st = get(d, :seriestype, :candlestick)
    st == :heikinashi && HeikinAshi!(cs)

    seriestype := :candlestick
    legend --> false
    linewidth --> 0.7
    grid --> false

    bw = get(d, :bar_width, nothing)
    bw == nothing && (bw = 0.8)
    bar_width := bw / 2 * minimum(diff(unique(Int.(cs.time))))

    # allow passing alternative colors as a vector
    cols = get(d, :seriescolor, nothing)
    cols = (isa(cols, Vector{Symbol}) && length(cols) == 2) ? cols : [:red, :blue]

    attributes = [
        Dict(:close_open => <, :close_prev => <, :bottombox => cs.close, :topbox => cs.open, :fill => cols[1], :line => cols[1], :fillalpha => 1),
        Dict(:close_open => <, :close_prev => >=, :bottombox => cs.close, :topbox => cs.open, :fill => cols[2], :line => cols[2], :fillalpha => 1),
        Dict(:close_open => >=, :close_prev => <, :bottombox => cs.open, :topbox => cs.close, :fill => :white, :line => cols[1], :fillalpha => 0),
        Dict(:close_open => >=, :close_prev => >=, :bottombox => cs.open, :topbox => cs.close, :fill => :white, :line => cols[2], :fillalpha => 0)
    ]


    for att in attributes
        inds = Vector{Int}(length(cs.close))
        inds[1] = att[:close_open](cs.close[1], cs.open[1]) & att[:close_prev](cs.close[1], cs.close[1])
        inds[2:end] .= att[:close_open].(cs.close[2:end], cs.open[2:end]) & att[:close_prev].(diff(cs.close), 0)
        inds = find(inds)

        if length(inds) > 0
            @series begin
                linecolor := att[:line]
                fillcolor := att[:fill]
                fillalpha := att[:fillalpha]
                fillto := att[:bottombox][inds]
                seriestype := :bar
                cs.time[inds], att[:topbox][inds]
            end

            for j in 1:2
                @series begin
                    primary := false
                    linecolor := att[:line]
                    seriestype := :sticks
                    fillto := j == 1 ? cs.low[inds] : att[:topbox][inds]
                    cs.time[inds], j == 1 ? att[:bottombox][inds] : cs.high[inds]
                end
            end
        end
    end
end

In [154]:
@recipe Candlestick(ohlc)


Must wrap a valid function call!

In [ ]:


In [152]:
plot(Candlestick(ohlc))


Out[152]:

In [153]:
@recipe function f{T<:TimeArray}(ta::T)
    st = get(d, :seriestype, :path)
    if in(st, [:candlestick, :heikinashi])
        Candlestick(ta)
    #elseif st == :ohlc #ohlc (meaning sticks with steps on the sides) should be passed on to Plots internal ohlc plot engine
    #    ta, ohlc = extract_ohlc(ta)
    #    collect(zip(ohlc)) # But there are currently issues with that
    else
        labels --> reshape(ta.colnames,1,length(ta.colnames))
        seriestype := st
        ta.timestamp, ta.values
    end
end


WARNING: Method definition apply_recipe(Base.Dict{Symbol, Any}, #T<:TimeSeries.TimeArray) in module Main at C:\Users\miguel\.julia\v0.5\RecipesBase\src\RecipesBase.jl:232 overwritten at C:\Users\miguel\.julia\v0.5\RecipesBase\src\RecipesBase.jl:232.

In [157]:
Pkg.add("Indicators")


INFO: Cloning cache of Indicators from https://github.com/dysonance/Indicators.jl.git
INFO: Cloning cache of Temporal from https://github.com/dysonance/Temporal.jl.git
INFO: Installing Indicators v0.1.4
INFO: Installing Temporal v0.2.4
INFO: Building HttpParser
INFO: Building MbedTLS
Using system libraries...
INFO: Package database updated

In [158]:
using Indicators


INFO: Precompiling module Indicators.
WARNING: using Indicators.sma in module Main conflicts with an existing identifier.
WARNING: using Indicators.mode in module Main conflicts with an existing identifier.

In [161]:
ohlc["Open"]


Out[161]:
500x1 TimeSeries.TimeArray{Float64,1,Date,Array{Float64,1}} 2000-01-03 to 2001-12-31

             Open      
2000-01-03 | 104.88    
2000-01-04 | 108.25    
2000-01-05 | 103.75    
2000-01-06 | 106.12    
⋮
2001-12-26 | 21.35     
2001-12-27 | 21.58     
2001-12-28 | 21.97     
2001-12-31 | 22.51     

In [163]:
Indicators.


Out[163]:
Indicators

In [164]:
function module_functions(modname)
    list = Symbol[]
    for nm in names(modname)
        typeof(eval(nm)) == Function && push!(list,nm)
    end
    return list
end
module_functions(Indicators)


Out[164]:
module_functions (generic function with 1 method)

In [165]:
module_functions(Indicators)


Out[165]:
0-element Array{Symbol,1}

In [170]:
Indicators.adx
Indicators.alma
Indicators.aroon
Indicators.atr
Indicators.bbands
Indicators.cci
Indicators.close_fun
Indicators.crossover
Indicators.crossunder
Indicators.dema
Indicators.diffn
Indicators.donch
Indicators.ema
Indicators.eval
Indicators.hl_fun
Indicators.hlc_fun
Indicators.hma
Indicators.interpolate
Indicators.kama
Indicators.keltner
Indicators.kst
Indicators.macd
Indicators.mama
Indicators.maxima
Indicators.minima
Indicators.mlr
Indicators.mlr_bands
Indicators.mlr_intercept
Indicators.mlr_lb
Indicators.mlr_rsq
Indicators.mlr_se
Indicators.mlr_slope
Indicators.mlr_ub
Indicators.psar
Indicators.resistance
Indicators.roc
Indicators.rsi
Indicators.runcor
Indicators.runcov
Indicators.runmad
Indicators.runmax
Indicators.runmean
Indicators.runsd
Indicators.runsum
Indicators.runvar
Indicators.sma
Indicators.smi
Indicators.stoch
Indicators.support
Indicators.swma
Indicators.tema
Indicators.tr
Indicators.trima
Indicators.wilder_sum
Indicators.wma
Indicators.wpr


syntax: incomplete: premature end of input

In [171]:
dump(names(Indicators))


Array{Symbol}((55,))
  1: Symbol Indicators
  2: Symbol adx
  3: Symbol alma
  4: Symbol aroon
  5: Symbol atr
  ...
  51: Symbol tr
  52: Symbol trima
  53: Symbol wilder_sum
  54: Symbol wma
  55: Symbol wpr

In [58]:
function rates1(rate,daily)
    println( "Annualized rate of ",rate," yearly is ",(rate/daily + 1)^365)
    end


WARNING: Method definition 
Out[58]:
rates1 (generic function with 1 method)
rates1(Any, Any) in module Main at In[53]:2 overwritten at In[58]:2.

In [59]:
rates1(.0643,365)


Annualized rate of 0.0643 yearly is 1.0664062353633048

In [67]:
rates


Out[67]:
rates (generic function with 1 method)

In [83]:
ratesss = [.0643, .0665, .0681, .0690]
dailies = [365, 6365/4, 365/2, 1]

for i in 1:4
    rates1(ratesss[i],dailies[i])
end


Annualized rate of 0.0643 yearly is 1.0664062353633048
Annualized rate of 0.0665 yearly is 1.0153703396714326
Annualized rate of 0.0681 yearly is 1.145881941111151
Annualized rate of 0.069 yearly is 3.774525825683371e10

In [ ]: