Paintbars in QuoteTracker

whyLately

Active Member
#1
murthymsr had suggested that we initiate a discussion of Paintbars as used in QuoteTracker. So, here goes...

Paintbars are used to embellish graphs based on user specified conditions. Uses include coloring the candles, drawing buy/sell arrows, marking candles with symbols, drawing colored bands / backgrounds or triggering alerts. The user condition could be price and/or indicator values.

A paintbar consists of one or more rules. Each rule is written as an if <condition> <action 1> else <action 2> statement. This is simple enough to pickup from QT's help file and one or two examples. A graph could have one or more paintbars both in the top price pane or bottom panes.

QT has a editor (Charts->Paintbar Editor) to help create and manage them. Paintbars are saved in paintbar.xml in QT's installation directory. So probably the easiest method of exchange is to post the portion of the XML from that file using Export/Import in the editor or cut-paste.

A word of caution: too much should not not be expected from paintbars. They have nothing near the power of, say, Amibroker's afl language . Some basic things missing, such as use of variables, may make writing the rule conditions appear awkward. The absence of a way to write comments prevents them from being self-documented. The idea is to make the best of what is available.
 

whyLately

Active Member
#2
For QT users who have never used Paintbars, here is a walkthru...

Objective:
To mark the first and last half hour as a background to the intraday chart.

Steps:
- Add a Paintbar - Top indicator to an intraday chart. PBs are treated like all other indicators.
- Click Edit next to the newly added PB.
- As we have not yet created the PB, click Edit Paintbars on the Parameters for Paintbar dialogue that comes up.
- In the PB Editor that comes up, click Add New.
- Name the PB.
- Add the following two rules. Bar Time refers to the opening time of a bar.
Code:
if Bar Time<10:30 set color to Gray
if Bar Time>=15:00 set color to Gray


- Save and close to return to the Parameters for Paintbar dialogue.
- Select the newly created PB.
- Set Show On to Full Background. The completed dialog is:



- Close dialogues and return to Technical Indicators dialogue. Nothing else needs to be done here for this PB.



- The resulting intraday graph would show as:



Notes:
- The PB works on line graphs as well.
- If you don't like the inbuilt colours, use $bbggrr (blue-green-red) for custom ones such as $202020 for a deeper grey (if Bar Time<10:30 set color to $202020)

PB XML for import:
MarkInitialLastHalfHour.PBX
 
Last edited:

murthymsr

Well-Known Member
#3
Thanks WL for the start of the discussion.

As already pointed by WL, paintbars are simple to build but have limitations on account of it's simplicity.

But paintbars are highly useful as a visual tool of simple logic and as an audio tool for working in the background. I used it to get some feel of the market trend.

Also paintbars are special to QT, whose source of data is NSE and the data is delayed by about a minute. So this tool is useful when identifying trends in the higher timeframes of 5 minute bars and more.

Wish more people join the discussion to enrich the knowledge.

One last word though, one day QuoteTracker may come out with a stock broking service for the Indian market with live quotes like it is already doing for international markets. QT with live data export to AB with it's own trading platform is the best that could happen to the Indian trading community.

murthymsr
 

whyLately

Active Member
#4
Trading NR7 setup thread.

The objective is to mark NR7 bars in intraday graphs. Also mark NR4/NR5/NR6 as an NR7 bar is these as well.

Four paintbars are used in combination, a separate one for each NR type. The PBs are combined to show as a 'histogram' either as a top or bottom indicator.

Rules for NR4 PB:
Code:
if  (Bar High[1] - Bar Low[1]) <= (Bar High[2] - Bar Low[2]) 
AND (Bar High[1] - Bar Low[1]) <= (Bar High[3] - Bar Low[3]) 
AND (Bar High[1] - Bar Low[1]) <= (Bar High[4] - Bar Low[4])
set color to $A0F0F0
NR5 to NR7 rules are similar and set a different color.

Properties for top indicator:
Show On - Shape Band Bottom, Background, Thick - default, Shape - Filled square, Adjust Width - Yes

Properties for bottome indicator:
Show On - Band Bottom, Background, Thick - default, Align Candle



Notes:
- The rule marks NR7s after the bar has completed, and applies to the previous bar. For intraday graphs, this prevents bar identification changing as quotes come in. For historical charts, you may want to change the rule to use the current bars high/low values in the comparison.
- The grey horizontal line below the NR markers in the top graph is a visual nicety. It is a separate dummy PB with rule as if 1=1 set color to Silver.

Paintbar XML for import: NR-Intraday.PBX
 
Last edited:

whyLately

Active Member
#5
Swing Buy/Sell based on Price Channel

One trading technique is based on the Highest High/Lowest Low of some previous periods. If the price goes above the High of the last n periods, buy. The stoploss is the Low of the same n periods. Subsequently, the stoploss is moved as the Low changes. When the stoploss is hit, go short with the last n period high as the new stoploss. This is a SAR method and you are always in the trade (it has been said that if a trade is successful, do not take the next one).

The main idea is to present this logic with paintbars. Below are two methods -- first as a colored band and second as long-short arrows. In QuoteTracker, the n period high/low is available from the Price Channel top indicator.

Buy-Sell Band

Single PB, multiple rules. (Properties: Show On: Band Top). Lines beginning with // are documentation comments and not part of the rules.

Code:
// Large outside bars cutting across both upper and lower price channel need special handling
if (Bar High >= Price Channel.Upper[1] AND Bar Low <= Price Channel.Lower[1]) 
   AND (Bar Close > Bar Open) 
   set color to Lime and stop
if (Bar High >= Price Channel.Upper[1] AND Bar Low <= Price Channel.Lower[1]) 
   AND (Bar Close <= Bar Open) 
   set color to Red and stop

// Buy hold and Buy rules
if (Paintbar[1] = Lime) AND (Bar Low > Price Channel.Lower[1]) 
   set color to Lime and stop
if (Paintbar[1] = Red) AND (Bar High >= Price Channel.Upper[1]) 
   set color to Lime and stop

// Short hold and Short rules
if (Paintbar[1] = Red) 
   AND (Bar High < Price Channel.Upper[1]) 
   set color to Red and stop
if (Paintbar[1] = Lime) 
   AND (Bar Low <= Price Channel.Lower[1]) 
   set color to Red and stop

// Dummy rule to seed the S&R
if 1 = 1 set color to Lime
Buy-Sell Arrows

Two PBs, one each for buy and short.

Only the Buy Arrow is presented here. (Properties: Show On: Shape Below Candle, Foreground, {shape & thickness to suit}).

Code:
// Large outside bar is buy if close is more than open
if (Bar High >= Price Channel.Upper[1] 
      AND Bar Low <= Price Channel.Lower[1]) 
   AND (Bar Close <= Bar Open) 
   do nothing and stop

// Buy hold is marked with a dark almost invisible color
if (Paintbar[1] = $00F000 OR Paintbar[1] = $100100) 
   AND (Bar Low > Price Channel.Lower[1]) 
   set color to $100100 and stop

// Buy trigger
if Bar High >= Price Channel.Upper[1] 
   set color to $00F000


Notes

- The PB does not use any Price Channel parameters. As a result, user-specified values (on adding the Price Channel as the top indicator) are used by the PB. Various period values can be tested without changing the PB. In the image above, Price Channel is based on High/Low, middle line is in Clr color, and uses a period value of 21.

Paintbar XML for import: Swing-PriceChannel.PBX
 

murthymsr

Well-Known Member
#6
Thanks WL for your highly thought provoking PB codes.

But looks like the QT is no longer free after end of the month. One has to subscribe.

Subscription for more than a minute delayed quotes of NSE only and a trading platform that cannot be used on Indian stock exchanges may not be attractive.

I love QT for it's features, stability and ease of use. I wish QT may tie up with some Indian Brokerage house / Bank to provide a fully integrated 3-in-1 trading account.

murthymsr
 

whyLately

Active Member
#7
But looks like the QT is no longer free after end of the month. One has to subscribe.
That email we received seems to indicate that QT will no longer be free. But read this thread at the AussieStockForums.

To summarize, it will no longer be free if one uses US Brokers that are competition to Ameritrade (guess this applies to data source plus integrated trading competition only). For us, it is likely to remain free (at least for the recent future).
 

murthymsr

Well-Known Member
#8
That email we received seems to indicate that QT will no longer be free. But read this thread at the AussieStockForums.

To summarize, it will no longer be free if one uses US Brokers that are competition to Ameritrade (guess this applies to data source plus integrated trading competition only). For us, it is likely to remain free (at least for the recent future).

Thanks for the link, which cleared my fear/anxiety.

It was a great feeling to see the post by Jerry Medwed, which clarified on this issue.

I WAS visiting the QT message boards for information on QT. I read many answers by Medwed which are very informative and the response was very fast too.

In contrast, QT in the present form does not believe in message boards and support is through mail only, which is mainly in the one-to-one format.

Still have to thank them for reatining it free where they do not provide service like in India.

murthymsr
 

murthymsr

Well-Known Member
#9
That email we received seems to indicate that QT will no longer be free. But read this thread at the AussieStockForums.

To summarize, it will no longer be free if one uses US Brokers that are competition to Ameritrade (guess this applies to data source plus integrated trading competition only). For us, it is likely to remain free (at least for the recent future).
Hi WL & other users of QT,

Further to the email & Inspite of the clarification, link of which was provided by WL, from today morning onwards, my QT is NOT working to update stock data. Some consolation is that NIFTY is getting updated.

Is it so with you also?

May be we have to say 'GOOD Bye' to QT :mad:

Thanks & regards.

murthymsr
 

kenneth

Well-Known Member
#10
Hi WL & other users of QT,

Further to the email & Inspite of the clarification, link of which was provided by WL, from today morning onwards, my QT is NOT working to update stock data. Some consolation is that NIFTY is getting updated.

Is it so with you also?

May be we have to say 'GOOD Bye' to QT :mad:

Thanks & regards.

murthymsr
Yes murthymsr. Only indices are getting updated not stock data.

Regards
ken
 

Similar threads