accurate trend detection methods

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #162804 quote
    kevin12345kevin12345
    Participant
    Average

    hi,

    is there an accurate trend detention method out there?

    thanks

    #162806 quote
    NicolasNicolas
    Keymaster
    Legend

    If you can definite in logic what is a trend, then it can be possible to code an accurate method 🙂

    #162810 quote
    kevin12345kevin12345
    Participant
    Average

    when i look at i chart, i draw a straight line of best fit across all candles and if the angle with respect to the horizontal is greater than 0 then it is a uptrend. vice versus for downtrend.

    #162811 quote
    kevin12345kevin12345
    Participant
    Average

    i guess moving average is a good starter

    #162819 quote
    NicolasNicolas
    Keymaster
    Legend

    Ok, so you are looking at regression line slope, so you’ll get the same with:

    bullish = linearregressionslope[max(1,barindex)] > 0
    bearish = linearregressionslope[max(1,barindex)] < 0
    
    return bullish coloured(0,255,0) style(histogram), bearish coloured(255,0,0) style(histogram)
    #162825 quote
    kevin12345kevin12345
    Participant
    Average

    how does the return command work?

    DEFPARAM CUMULATEORDERS = false
    
    bullish = linearregressionslope[max(1,barindex)] > 0
    bearish = linearregressionslope[max(1,barindex)] < 0
     
    return bullish coloured(0,255,0) style(histogram), bearish coloured(255,0,0) style(histogram)
    
    if bullish then
    buy 1 contracts at market
    endif
    
    if bearish then 
    sellshort 1 contracts at market
    endif
    
    set stop ploss 30
    set target profit 45

    says there is some error on the return line

    #162842 quote
    VonasiVonasi
    Moderator
    Master

    You have posted strategy code. RETURN is only used in indicators. Nicolas provided indicator code. Delete the RETURN line in your strategy.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.
ProRealAI ProRealAI New

Stuck on this ProBuilder code?

Describe what this topic is trying to build, in plain English, and ProRealAI writes the ProRealTime™ indicator, screener or system for you.

Available in 7 languages
Try ProRealAI

accurate trend detection methods


ProOrder: Automated Strategies & Backtesting

New Reply
Author
author-avatar
kevin12345 @kevin12345 Participant
Summary

This topic contains 6 replies,
has 3 voices, and was last updated by VonasiVonasi
5 years, 6 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 03/01/2021
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...