Click here to Login





                                                   Cant seem to multiple VectorD in Functions

  0

0
Kiran
2016-03-12 09:41:45


I'm modifying the attached AvgCorrelation function to calculate Average Covariance between assets in a group, by simply multiplying the correlation by the standard deviation of the 2 series.

VectorD corel=TA.Correl(ret1,ret2,_period); // Original statement

VectorD corel=TA.Correl(ret1,ret2,_period)*TA.Stddev(ret1,_period)*TA.Stddev(ret2,_period); // My modification

This gives me a NaN when i run it through a screen using 'SPY,TLT', 90days - no error when i run AvgCorrelation.

Please advise what i'm doing wrong.. TA.Stddev is a valid function.

thanks
Kiran





Avgerage Correlation (by Vangelis M., uploaded several months ago)
No notes

Rate an item Rate an item Rate an item Rate an item Rate an item Number of downloads Notes Report an item

QuantShare
2016-03-14 04:06:36

  0

Kiran,

Try using the corresponding QS language formula and debug it from a chart. The formula looks correct. Could be that you provided a wrong "_period".



No more messages
0




Reply:

No html code. URLs turn into links automatically.

Type in the trading objects you want to include: - Add Objects
    To add a trading object in your message, type in the object name, select it and then click on "Add Objects"










    QuantShare

    Trading Items
    GMMA - Guppy Multiple Moving Average
    Guppy Multiple Moving Average Oscillator
    Multiple Time Frames Trading System - Price / Moving Average Cros...
    GetVariable Multiple Usage
    DV Intermediate Oscillator (DVI)

    How-to Lessons
    How to plot a stock using different periods in the same chart
    How to debug a trading system using the money management tool
    How to import trading data from CSV files
    How to create a custom trading indicator
    How to plot the ratio of two stocks

    Related Forum Threads
    Peak / trough indicators and issue with Functions
    Ability to open multiple watchlist windows
    Multiple quote databases with same symbols?
    Functions in Global Tab
    Multiple Static Watchlists and Screener

    Blog Posts
    Technical Analysis Using Multiple Timeframes - Second Part
    Compare Multiple Securities in a Single Chart
    Technical Analysis Using Multiple Timeframes
    Trading Indicators using the Rank and Percentile functions
    New Ranking and Percentile Composite Functions









    QuantShare
    Product
    QuantShare
    Features
    Create an account
    Affiliate Program
    Support
    Contact Us
    Trading Forum
    How-to Lessons
    Manual
    Company
    About Us
    Privacy
    Terms of Use

    Copyright © 2025 QuantShare.com
    Social Media
    Follow us on Facebook
    Twitter Follow us on Twitter
    Google+
    Follow us on Google+
    RSS Trading Items



    Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.