Click here to Login





                                                   TrendLengthIndicator

  0

0
Marcus Schöppl
2014-10-28 14:15:46


hello i�m new at quantshare
and would be glad to help me.

i have a TrendLength Indicator in Easy Language Code.

This Indicator counts the Weeks, how many Weeks the Stocks is in an UpTrend... The Trend depends on the SuperTrend Indicator.

Please help me.

Here is the code:


a = Supertrend[3.5,10]

If Close Crosses Under a Then
dwTr = -1
Else
dwTr = 0
Endif
x = dwTr
f = x > -1
i = 0
WHILE f[i] DO
i = i + 1
WEND


If Barindex > i+10 Then
xx = Lowest[Max(1,i)](Low)
If Low = xx Then
trend = 1
Else
trend = 0
Endif
Endif


If Barindex > 100 Then
x1 = Trend
f1 = x1 = 0
i1 = 0
WHILE f1[i1] DO
i1 = i1 + 1
WEND
Endif

trendlength = Max(1,i1)

Return trendlength



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
    Days To Next Date
    Selectable center of gravity index
    Information Ratio - Appraisal ratio
    Average Year over Year Indicator
    Reward/Risk Drawing Tool

    How-to Lessons
    How to quickly select stocks based on the last value of a databas...
    How to create a composite index/indicator
    How to optimize a neural network using a genetic algorithm
    How to add a metric in the trading system simulation report
    How to import your own list of stocks/symbols

    Related Forum Threads
    Welcome to the QuantShare Forum
    Unable to Install Quantshare
    Quotes Database Management
    Inaccurate historical data?
    How to download a item that need a user and password

    Blog Posts
    Beta release
    Optimization of a trading system
    Put-Call Ratio for Individual Stocks
    How scripts communicate with each other
    Introduction to the trading rules analyzer









    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.