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

RE: [TOS_thinkscript] Custum Quote Help.

Expand Messages
  • Richard Houser
    I m not sure what you mean by AsPercentPrice - LongMA in the context of your example, price as a percent of what? So I gave it my best shot, though if this
    Message 1 of 3 , Jan 1, 2013

      I'm not sure what you mean by AsPercentPrice - LongMA in the context of your example, price as a percent of what? So I gave it my best shot, though if this were mine I'd be doing ( price - mva ) / mva or ( mva - price ) / price, but that's just me.

      I did this in two parts, 1) the basic study so if you want visual verification you activate it on a chart, and 2) the custom column. This means that you MUST install the first script as a chart study. And THEN install the second script in a custom column. I you don't know how to do either of these things look on the group's web site, it's been covered many times.

      The STUDY script, I named mine A1 just cause it's easy, it is a development script so I know I can write over it once I've sent it in an email, and it sorts to the top of the list so it makes it easy to find. You can name it anything you wish but if you do you MUST change the names on two lines in the custom column.

      #=====[ beginning of STUDY script ]=====
      declare lower;

      input length    = 50;
      input price     = close;
      input averageType = AverageType.Simple;

      def mva           = MovingAverage( averageType, price, length );
      plot Diff         = 100 * ( price - mva ) / price;
      Diff
      .DefineColor( "gt", Color.UPTICK );
      Diff
      .DefineColor( "lt", Color.DOWNTICK );
      Diff
      .DefineColor( "default", Color.GRAY );
      Diff
      .HideBubble();
      Diff
      .AssignValueColor( if price > mva then Diff.Color( "gt" ) else if price < mva then Diff.Color( "lt" ) else Diff.Color( "default" ) );

      plot ZeroLine     = 0;
      ZeroLine
      .SetDefaultColor( Color.BLUE );
      ZeroLine
      .HideBubble();
      #=====[ end of STUDY script ]=====



      The CUSTOM COLUMN script.

      #=====[ beginning of CUSTOM COLUMN script ]=====
      input price = close;
      def mva = A1().mva;
      plot Diff = A1().Diff;
      Diff
      .SetDefaultColor( Color.WHITE );
      AssignBackgroundColor( if price > mva then Color.UPTICK else if price < mva then Color.DOWNTICK else Color.GRAY );
      #=====[ end of CUSTOM COLUMN script ]=====



       

      From: TOS_thinkscript@yahoogroups.com [mailto:TOS_thinkscript@yahoogroups.com] On Behalf Of Rodger D
      Sent: Monday, December 31, 2012 5:07 PM
      To: TOS_thinkscript@yahoogroups.com
      Subject: [TOS_thinkscript] Custum Quote Help.

       

       

      Happy New Year!!!!

      I was curious if I could show the difference between a stock price and a specific moving average in custom quotes.

      Here is what I have.

      Plo AsPercentPrice - LongMA) / Price, " from ", LongMALength, "MA", if Price > LongMA then color.GREEN else color.RED;

      Thanks and trade well!!!

    • Rodger Dodger
      Richard,      Thank you.  I works just fine.        I used the lower study in the custom quote (marketwatch) and it works perfectly.  The
      Message 2 of 3 , Jan 2, 2013
        Richard,
             Thank you.  I works just fine. 
              I used the lower study in the custom quote (marketwatch) and it works perfectly.  The PocketPivot Study Comp. had bubbles showing the % difference between the MAs and the stock price.  I was trying to get these percentages into the custom quote section.  Thus I can see in real time the nearest stocks trading close to the 200MA. IMHO scanning for MA crosses misses the stocks that touch and retrace.
              Anyway happy trading and thank you for your help.......
        From: Richard Houser <rhouser@...>
        To: TOS_thinkscript@yahoogroups.com
        Sent: Tuesday, January 1, 2013 5:01 AM
        Subject: RE: [TOS_thinkscript] Custum Quote Help.
         
        I'm not sure what you mean by AsPercentPrice - LongMA in the context of your example, price as a percent of what? So I gave it my best shot, though if this were mine I'd be doing ( price - mva ) / mva or ( mva - price ) / price, but that's just me.

        I did this in two parts, 1) the basic study so if you want visual verification you activate it on a chart, and 2) the custom column. This means that you MUST install the first script as a chart study. And THEN install the second script in a custom column. I you don't know how to do either of these things look on the group's web site, it's been covered many times.

        The STUDY script, I named mine A1 just cause it's easy, it is a development script so I know I can write over it once I've sent it in an email, and it sorts to the top of the list so it makes it easy to find. You can name it anything you wish but if you do you MUST change the names on two lines in the custom column.

        #=====[ beginning of STUDY script ]=====
        declare lower;

        input length    = 50;
        input price     = close;
        input averageType = AverageType.Simple;

        def mva           = MovingAverage( averageType, price, length );
        plot Diff         = 100 * ( price - mva ) / price;
        Diff
        .DefineColor( "gt", Color.UPTICK );
        Diff
        .DefineColor( "lt", Color.DOWNTICK );
        Diff
        .DefineColor( "default", Color.GRAY );
        Diff
        .HideBubble();
        Diff
        .AssignValueColor( if price > mva then Diff.Color( "gt" ) else if price < mva then Diff.Color( "lt" ) else Diff.Color( "default" ) );

        plot ZeroLine     = 0;
        ZeroLine
        .SetDefaultColor( Color.BLUE );
        ZeroLine
        .HideBubble();
        #=====[ end of STUDY script ]=====



        The CUSTOM COLUMN script.

        #=====[ beginning of CUSTOM COLUMN script ]=====
        input price = close;
        def mva = A1().mva;
        plot Diff = A1().Diff;
        Diff
        .SetDefaultColor( Color.WHITE );
        AssignBackgroundColor( if price > mva then Color.UPTICK else if price < mva then Color.DOWNTICK else Color.GRAY );
        #=====[ end of CUSTOM COLUMN script ]=====



         
        From: TOS_thinkscript@yahoogroups.com [mailto:TOS_thinkscript@yahoogroups.com] On Behalf Of Rodger D
        Sent: Monday, December 31, 2012 5:07 PM
        To: TOS_thinkscript@yahoogroups.com
        Subject: [TOS_thinkscript] Custum Quote Help.
         
         
        Happy New Year!!!!

        I was curious if I could show the difference between a stock price and a specific moving average in custom quotes.

        Here is what I have.

        Plo AsPercentPrice - LongMA) / Price, " from ", LongMALength, "MA", if Price > LongMA then color.GREEN else color.RED;

        Thanks and trade well!!!
      Your message has been successfully submitted and would be delivered to recipients shortly.