very simple MA filter

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #97302 quote
    jebus89jebus89
    Participant
    Master
    p1 = average[t1](close)
    p2 = average[t1*2](close)
    p3 = average[t1*4](close)
    p4 = average[t1*8](close)
    
    a1 = p1 > p2 and p2 > p3 and p3 > p4
    a2 = p1 < p2 and p2 < p3 and p3 < p4
    
    if a1 then
    b=1
    elsif not a1 and not a2 then
    b=0
    elsif a2 then
    b=-1
    endif
    
    return b
    

    Made this today and found some good use for it. Do with it as u may šŸ™‚

     

    t1 = 2 as default

    (giving u averages = 2, 4, 8, 16)

    #97303 quote
    GraHalGraHal
    Participant
    Legend

    Thank you … I added it to here Snippet Link Library

    jebus89 thanked this post
    #97311 quote
    GraHalGraHal
    Participant
    Legend

    Hey thanks again Jebus, I’ve already worked your filter into 2 of my Systems that were marginal and it has improved the stats overall.

    Lowered the final profit on one System, but better Gain to Loss and Av Gain to Av Loss etc.

    I’ll run the originals alongside and see if the good stuff works out in Forward Test

    Cheers

    #97319 quote
    VonasiVonasi
    Moderator
    Master

    Here is a similar version that I wrote a while back for progression of powers averages. In this version you can choose an average type and customclose to base the average on as well as a maximum average period to calculate up to. If converted to a strategy filter this gives us plenty of variables to test.

    type = 1
    maxaverage = 32
    
    j = 1
    while j < maxaverage
    j = j * 2
    ave1 = average[j,type](customclose)
    ave2 = average[j*2,type](customclose)
    if ave1 > ave2 then
    upflag = 1
    else
    upflag = 0
    break
    endif
    wend
    
    j = 1
    while j < maxaverage
    j = j * 2
    ave1 = average[j,type](customclose)
    ave2 = average[j*2,type](customclose)
    if ave1 < ave2 then
    downflag = -1
    else
    downflag = 0
    break
    endif
    wend
    
    return upflag coloured(0,128,0) style(histogram,2), downflag coloured(128,0,0) style(histogram,2)
    GraHal and Fabiano thanked this post
    #97320 quote
    jebus89jebus89
    Participant
    Master

    Glad u found usage of the indicator grahal.

    Will check out ur ma filter Vonasi šŸ™‚

    #97324 quote
    VonasiVonasi
    Moderator
    Master

    Will check out ur ma filter Vonasi

    I just noticed that my return of +1 or -1 is the opposite way round to yours.

    #97328 quote
    GraHalGraHal
    Participant
    Legend

    Vonasi I added yours to here Snippet Link Library

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

very simple MA filter


ProBuilder: Indicators & Custom Tools

New Reply
Author
author-avatar
jebus89 @jebus89 Participant
Summary

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

Topic Details
Forum: ProBuilder: Indicators & Custom Tools
Language: English
Started: 04/28/2019
Status: Active
Attachments: No files
ProRealCode ProRealCode
Loading...