Trend detection codes

Viewing 15 posts - 16 through 30 (of 45 total)
  • Author
    Posts
  • #188349 quote
    deletedaccount051022
    Participant
    New

    Interesting approach pableitor

    Reminds me of an approach developed by Art Collins which identifies a “bias”.  Create a variable called bias, if the first trend criteria is met then bias = bias + 1.  For each trend criteria that is met then you add +1 to the bias variable.

    Once bias exceeds a threshold, eg 5, the algo trades long or short

    //Variables Parameters
    Once Bias = 0
    
    //Creating Bias Scenarios
    If Close>average[p,t] Then
    Bias = Bias +1
    EndIf
    
    If Close>highest[50] Then
    Bias = Bias +1
    EndIf
    
    If RSI[14] > 30 Then
    Bias = Bias +1
    EndIf
    
    If Close>Open Then
    Bias = Bias +1
    EndIf
    
    If Close>Close[1] and Close[1]>Close[2] and Close[2]>Close[3] Then
    Bias = Bias +1
    EndIf
    
    // Conditions to enter long positions
    If Bias>5 Then
    Buy PositionSize CONTRACTS AT MARKET
    ENDIF
    nonetheless thanked this post
    #188352 quote
    nonetheless
    Participant
    Master

    thanks for that, definitely worth playing around with.

    To my mind it only makes sense with bias less than the total number of scenarios though, otherwise you might as well just add all the Bias Scenarios as conditions.

    But if it could work with any 3 out of 5, for example, that could be a useful way of ‘accruing probability’.

    They could conceivably be weighted, so that some counted more than others ???

    #188357 quote
    deletedaccount051022
    Participant
    New

    I like your idea of weighting the different scenarios, will give that a try.

    #188358 quote
    phoentzs
    Participant
    Master

    As already mentioned here, the perfect trend indicator does not exist. That’s why I try to determine the trend of the current market phase with relatively simple means and to use it. Sometimes the current market phase is only 10000bars long (TF M5), sometimes 50000bars. I can perhaps say I am optimizing today, others say you are lagging behind the market. If you re-optimize every few weeks. But for me this method seems to work quite well. If the result curve flattens out, it’s time to re-optimize. Maybe someday there will be a perfect trend over the last 10 years… but I don’t believe in it.

    #188439 quote
    Nicolas
    Keymaster
    Master

    I think that the approach could be different: by identifying market phases (such as pullback, lateral movement, accumulation, distribution, ..) we don’t have to determine if the market is trending or not, because if we are not in one of that identified phase, then the price movement is sufficient to ride it to extract some money. It’s a bit like turning the problem upside down.

    thanked this post
    #188450 quote
    phoentzs
    Participant
    Master

    Sounds logical. But how would you implement that in the code to exclude the non-lucrative market phases?

    #188458 quote
    pableitor
    Participant
    Master

    Sounds logical. But how would you implement that in the code to exclude the non-lucrative market phases?

    That would be the 1 billion indicator !

    #188461 quote
    phoentzs
    Participant
    Master

    And how would you try? 😉

    #188470 quote
    PeterSt
    Participant
    Master

    Throw 1 billion at it ?

    #188471 quote
    nonetheless
    Participant
    Master

    here’s a short trend indicator that never fails:

    if opendayofweek = 5 and (Russia is about to invade Ukraine) then
    sell 1000 contracts at market
    endif
    Midlanddave and paisantrader thanked this post
    #188473 quote
    PeterSt
    Participant
    Master

    It gives an unknown command ?

    jacques34 thanked this post
    image_2022-02-18_143134.png image_2022-02-18_143134.png
    #188475 quote
    nonetheless
    Participant
    Master

    yeah, the coding for that bit in brackets needs some work … but you get the idea.

    #188476 quote
    pableitor
    Participant
    Master

    And how would you try? 😉

    ok , I will  give you the one and only trend indicator that will make you rich, it works  99.99% of the time 🤣 :

    if pableitor is longonmarket then 
    sell 1000 contracts  
    elsif pableitor is shortonmarket then 
    buy 1000 contracts 
    endif
    PeterSt, nonetheless and Midlanddave thanked this post
    #188477 quote
    PeterSt
    Participant
    Master

    We can’t use the data of another instrument. But V12 will allow to look at the data from other traders ?
    Cool !

    #188479 quote
    nonetheless
    Participant
    Master

    @pableitor, I know it feels that way sometimes – we’ve all been there!

Viewing 15 posts - 16 through 30 (of 45 total)
  • You must be logged in to reply to this topic.

Trend detection codes


ProOrder: Automated Strategies & Backtesting

New Reply
Author
Summary

This topic contains 44 replies,
has 12 voices, and was last updated by monkeys nuts
3 years, 11 months ago.

Topic Details
Forum: ProOrder: Automated Strategies & Backtesting
Language: English
Started: 09/30/2021
Status: Active
Attachments: 7 files
Logo Logo
Loading...