Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added moving average envelope issue #87 #115

Merged
merged 3 commits into from
Jul 13, 2018
Merged

Added moving average envelope issue #87 #115

merged 3 commits into from
Jul 13, 2018

Conversation

alexandrebrilhante
Copy link
Contributor

I've added moving average envelopes (env). Related tests seem to return an UndefVarError even though env is exported in src/MarketTechnicals.jl. Any ideas?

@iblislin
Copy link
Member

Seems there are no UndefVarError but isapprox issue.
Is there any reference implement about the value you put in the test cases?

I think the name env is easy to confused user. Any better naming?

@alexandrebrilhante
Copy link
Contributor Author

It was isapprox indeed, i's fixed now. Would mav (moving average envelope) be a better name?

@iblislin
Copy link
Member

Would mav (moving average envelope) be a better name?

Oh, I just browsed the reference site again. They named it env.
I'm ok with env, or just using the full name envelope.

@test isapprox(upper.values[491] , 23.5587, atol=.01)
@test isapprox(lower.values[1] , 88.9038, atol=.01)
@test isapprox(lower.values[2] , 88.1838, atol=.01)
@test isapprox(lower.values.values[490] , 19.1394, atol=.01)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo indeed.

push!(cname, string(cols[c], "_env_", n))
end

TimeArray(tstamps, upper, cname, ta.meta), TimeArray(tstamps, lower, cname, ta.meta)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason not to merge these two TimeArray?

@codecov-io
Copy link

codecov-io commented Jun 21, 2018

Codecov Report

Merging #115 into master will increase coverage by 0.34%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #115      +/-   ##
==========================================
+ Coverage   93.75%   94.09%   +0.34%     
==========================================
  Files           7        7              
  Lines         208      220      +12     
==========================================
+ Hits          195      207      +12     
  Misses         13       13
Impacted Files Coverage Δ
src/movingaverages.jl 100% <100%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 924680b...c8bc2f2. Read the comment docs.

upper = s + s * e
lower = s - s * e

upper, lower
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about merging this also via [upper lower] ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think [lower upper] makes more sense.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh, okay.

s = sma(ta, n)

upper = s.values .+ (s.values .* e)
lower = s.values .- (s.values .* e)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the broadcast of TimeArray works here.

upper = @. s + (s * e)
lower = @. s - (s * e)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It works with s.values.

cols = colnames(ta)
for c in 1:length(cols)
push!(cname, string(cols[c], "_env_", n))
end
Copy link
Member

@iblislin iblislin Jun 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code block can be turned into a broadcast, like:

julia> string.(colnames(ohlc), "_env_", 1)
4-element Array{String,1}:
 "Open_env_1"
 "High_env_1"
 "Low_env_1"
 "Close_env_1"

Copy link
Member

@iblislin iblislin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contributions!

@iblislin iblislin merged commit 018e368 into JuliaQuant:master Jul 13, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants