Loading ...
Sorry, an error occurred while loading the content.

Help on hi lo indicator please

Expand Messages
  • mroman59
    The code below is my attempt to create a simple indicator that will show the previous days HI and LOW (horizonal line) plus the previous day to that one also
    Message 1 of 2 , Jul 5, 2004
    View Source
    • 0 Attachment
      The code below is my attempt to create a simple indicator that will
      show the previous days HI and LOW (horizonal line) plus the previous
      day to that one also as I am viewing either a daily or realtime
      intrday chart using AB. However, there seems to be a few problems
      that I could not correct.

      Problems:

      1. In order for the lines to appear for the desired indicator lines,
      my cursor has to be on the current chart for which I am viewing. It
      would be nice if it automatically just assumed that you wanted the
      current day.

      2. The code works for all days on a give stock (daily view) except
      for the current day. I cant figure out why it does not draw the
      lines. The lines would be very short however it should post the
      results at the right in number, but does not do that. When in
      intraday mode it shows the line however, for the most current day's
      previous days hi's and low's

      Your help for improving this indicator is appreciated.
      MR


      Plot(C, "Close", 1, styleCandle);

      day_high1 = TimeFrameExpand(Ref(TimeFrameCompress
      (H,inDaily,compressHigh),-1),inDaily,expandFirst);
      day_low1 = TimeFrameExpand(Ref(TimeFrameCompress
      (L,inDaily,compressHigh),-1),inDaily,expandFirst);
      day_high2 =TimeFrameExpand(Ref(TimeFrameCompress
      (H,inDaily,compressHigh),-2),inDaily,expandFirst);
      day_low2 = TimeFrameExpand(Ref(TimeFrameCompress
      (L,inDaily,compressHigh),-2),inDaily,expandFirst);

      Line1 = IIf(SelectedValue(DateTime())< DateTime(),SelectedValue
      (day_high1),Null);
      Line2= IIf(SelectedValue(DateTime())< DateTime(),SelectedValue
      (day_low1),Null);
      Line3 = IIf(SelectedValue(DateTime())< DateTime(),SelectedValue
      (day_high2),Null);
      Line4 = IIf(SelectedValue(DateTime())< DateTime(), SelectedValue
      (day_low2),Null);

      Plot(Line1,"line1",colorRed,styleThick);
      Plot(Line2,"line2",colorBrightGreen,styleThick);
      Plot(Line3,"line3",colorYellow,styleThick);
      Plot(Line4,"line4",colorBlue,styleThick);


      Title = Name() + " - (" + Interval(2) + " chart) " + Date() + "
      (" + WriteVal(ROC(C,1),1.2)+"%)" + " " + "Volume" + WriteVal(V);
    • Graham
      Instead of selectedvalue, try using lastvalue Cheers, Graham http://e-wire.net.au/~eb_kavan/ ... From: mroman59 [mailto:mroman59@yahoo.com] Sent: Tuesday, July
      Message 2 of 2 , Jul 5, 2004
      View Source
      • 0 Attachment
        Instead of selectedvalue, try using lastvalue

        Cheers,
        Graham
        http://e-wire.net.au/~eb_kavan/

        -----Original Message-----
        From: mroman59 [mailto:mroman59@...]
        Sent: Tuesday, July 06, 2004 1:32 AM
        To: amibroker-ts@yahoogroups.com
        Subject: [amibroker-ts] Help on hi lo indicator please

        The code below is my attempt to create a simple indicator that will
        show the previous days HI and LOW (horizonal line) plus the previous
        day to that one also as I am viewing either a daily or realtime
        intrday chart using AB. However, there seems to be a few problems
        that I could not correct.

        Problems:

        1. In order for the lines to appear for the desired indicator lines,
        my cursor has to be on the current chart for which I am viewing. It
        would be nice if it automatically just assumed that you wanted the
        current day.

        2. The code works for all days on a give stock (daily view) except
        for the current day. I cant figure out why it does not draw the
        lines. The lines would be very short however it should post the
        results at the right in number, but does not do that. When in
        intraday mode it shows the line however, for the most current day's
        previous days hi's and low's

        Your help for improving this indicator is appreciated.
        MR


        Plot(C, "Close", 1, styleCandle);

        day_high1 = TimeFrameExpand(Ref(TimeFrameCompress
        (H,inDaily,compressHigh),-1),inDaily,expandFirst);
        day_low1 = TimeFrameExpand(Ref(TimeFrameCompress
        (L,inDaily,compressHigh),-1),inDaily,expandFirst);
        day_high2 =TimeFrameExpand(Ref(TimeFrameCompress
        (H,inDaily,compressHigh),-2),inDaily,expandFirst);
        day_low2 = TimeFrameExpand(Ref(TimeFrameCompress
        (L,inDaily,compressHigh),-2),inDaily,expandFirst);

        Line1 = IIf(SelectedValue(DateTime())< DateTime(),SelectedValue
        (day_high1),Null);
        Line2= IIf(SelectedValue(DateTime())< DateTime(),SelectedValue
        (day_low1),Null);
        Line3 = IIf(SelectedValue(DateTime())< DateTime(),SelectedValue
        (day_high2),Null);
        Line4 = IIf(SelectedValue(DateTime())< DateTime(), SelectedValue
        (day_low2),Null);

        Plot(Line1,"line1",colorRed,styleThick);
        Plot(Line2,"line2",colorBrightGreen,styleThick);
        Plot(Line3,"line3",colorYellow,styleThick);
        Plot(Line4,"line4",colorBlue,styleThick);


        Title = Name() + " - (" + Interval(2) + " chart) " + Date() + "
        (" + WriteVal(ROC(C,1),1.2)+"%)" + " " + "Volume" + WriteVal(V);





        Yahoo! Groups Links
      Your message has been successfully submitted and would be delivered to recipients shortly.