Market Phases Code Snippet

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #237035 quote
    Snålänningen
    Participant
    Junior

    Hi!

    I recently listened to a “Better System Trader” podcast about Market Phases, where the person interviewed talked about 6 different market phases. I coded these quickly and thought I would share it with you. Feel free to add in any other ideas or code snippets you use to define market phases to improve your algos.

    To use this snippet, I add the “and $mp[x]” to my buy conditions and then optimize x between 1-6, to see if any market phases are bad for the particular system.

    //Market Phases
    
    // based off https://www.youtube.com/live/pXxmhZsqbzA?si=UbPSOTYNvrVpvc-v
    
    Timeframe (1 day)
    
    MA200 = average[200] (close)
    MA50 = average[50] (close)
    
    $mp[1] = close > MA50 and MA50 > MA200 and MA50[0] > MA50[1] and MA200[0] > MA200[1] //Bullish Phase
    
    $mp[2] = close < MA50 and MA50 > MA200 // Warning Phase
    
    $mp[3] = MA50[0] < MA50[1] and MA50 > MA200 and MA200[0] > MA200[1] //Distribution Phase
    
    $mp[4] = MA50[0] < MA50[1] and MA200[0] < MA200[1] and MA50 < MA200 //Bearish Phase
    
    $mp[5] = MA200[0] < MA200[1] and MA50[0] > MA50[1] and close > MA50 and close < MA200 //Recovery Phase
    
    $mp[6] = close > MA50 and MA50[0] > MA50[1] and MA200[0] > MA200[1] //Accumulation Phase
    
    
    Timeframe (default)
    
    
    and $mp[x]
    
    GraHal and Iván González thanked this post
    #237036 quote
    GraHal
    Participant
    Master

    Link to above code added as Log392 here …

    Snippet Link Library

    Snålänningen thanked this post
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.

Market Phases Code Snippet


General Trading: Market Analysis & Manual Trading

New Reply
Author
Summary

This topic contains 1 reply,
has 2 voices, and was last updated by GraHal
1 year, 5 months ago.

Topic Details
Forum: General Trading: Market Analysis & Manual Trading
Language: English
Started: 09/02/2024
Status: Active
Attachments: No files
Logo Logo
Loading...