• Australian (ASX) Stock Market Forum

Hello and welcome to Aussie Stock Forums!

To gain full access you must register. Registration is free and takes only a few seconds to complete.

Already a member? Log in here.

Most liked posts in thread: EOD trades with weekly ASX MA filter

  1. Trav.

    Trav.

    Posts:
    643
    Likes Received:
    735
    Joined:
    Nov 27, 2017
    @wasp is this what you are looking for?

    or maybe a starting point....let us know how you are going.

    Code:
    DailyIndex = Foreign("$XAO", "C");
    
    TimeFrameSet( inWeekly );
    IndexClose = Foreign("$XAO", "C");
    IndexMA = MA(IndexClose, 75);
    TimeFrameRestore();
    
    WeeklyIndex = TimeFrameExpand(C, inWeekly,expandLast );
    
    GoLong = WeeklyIndex > IndexMA;
    
    
    SetChartOptions(0,chartShowDates);
    _N(Title = StrFormat("{{NAME}} - {{INTERVAL}} {{DATE}} Open %g, Hi %g, Lo %g, Close %g (%.1f%%) {{VALUES}}", O, H, L, C, SelectedValue( ROC( C, 1 ) ) ));
    Plot( C, "Close", ParamColor("Color", colorDefault ), styleNoTitle | styleBar | GetPriceStyle() );
    
    Plot( WeeklyIndex,"Weekly Index", colorYellow, styleLine  | styleOwnScale, Null, Null, 0, -1, 1);
    Plot( DailyIndex,"Index", colorRed, styleLine | styleOwnScale, Null, Null, 0, -1, 1);
     
    aus_trader, wasp, qldfrog and 5 others like this.
  2. MovingAverage

    MovingAverage Smoke me a kipper

    Posts:
    296
    Likes Received:
    403
    Joined:
    Jan 23, 2010
    Pretty certain it can, but you'll first need to use the TimeFrameSet prior to your IndexClose = line and then after your GoLong line use TimeFrameRestore so it reverts back to daily, which is what I think you want to do--use a weekly filter on daily charts.
     
    wasp, barney and qldfrog like this.
  3. frugal.rock

    frugal.rock "Time weight's on man"

    Posts:
    582
    Likes Received:
    637
    Joined:
    May 3, 2019
    It seems that the filter is probably using the current days data in the equation, thus showing up as too active.
    By using a weekly figure, you are smoothing the data out over however many bars.
    Maybe an average of the 2, with weightings considered, might smooth your data out to a more desirable level?
    Cheers.
    F.Rock
     
    wasp, fergee and qldfrog like this.
  4. MovingAverage

    MovingAverage Smoke me a kipper

    Posts:
    296
    Likes Received:
    403
    Joined:
    Jan 23, 2010
    Good work Trav...I was too lazy to write the code for him :p
     
    wasp, frugal.rock and Trav. like this.
  5. frugal.rock

    frugal.rock "Time weight's on man"

    Posts:
    582
    Likes Received:
    637
    Joined:
    May 3, 2019
    I was too lazy to learn the code, let alone write it ...
    Onya Trav.
    F.Rock
     
    wasp, Trav. and MovingAverage like this.