Download software Tutorial videos
Subscription & data-feed pricing Class schedule


New account application Trading resources
Margin rates Stock & option commissions

Attention: Discussion forums are read-only for extended maintenance until further notice.
Welcome Guest, please sign in to participate in a discussion. Search | Active Topics |

How to draw a parallel line Rate this Topic:
Previous Topic · Next Topic Watch this topic · Print this topic ·
kzliao
Posted : Thursday, March 8, 2012 8:27:08 PM
Registered User
Joined: 3/14/2007
Posts: 24
I am using manual looping to perform a complex calculation.Once I find a pattern, I need to draw horizontal lines on the price chart or draw a region. Think of it like the pivot points that I need draw lines for the support/resistance levels. How can I use RealCode to do it? There is no drawing API to use from the documentation. Please help!Thanks,Ken
Bruce_L
Posted : Friday, March 9, 2012 8:57:40 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
You would generally need to not plot anything during the base calculations and then do another loop through the data to plot the desired values once the calculations are complete.

As you stated, Pivot Points are a good example. Take a look at the RealCode in the Class tab for any of the lines being drawn in the Pivot Points Indicator attached to my Tuesday, December 15, 2009 2:57:57 PM ET post in the Pivot point as plotted in Freestockcharts.com topic.

In the PP Indicator, all of the drawing is actually done in just four lines:

                For i = 0 To Price.Bar.Count - 2
                    AddToOutput(Price.Bar.DateValue(i), PP)
                Next
                AddToOutput(Price.Bar.DateValue(Price.Bar.Count - 1), PP, "PP " & PP.ToString("0.000"))

And if it didn't put a label on the chart, the fourth line wouldn't be necessary at all. you would just have the loop going to Price.Bar.Count - 1 instead of Price.Bar.Count - 2.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
kzliao
Posted : Saturday, March 10, 2012 2:21:41 AM
Registered User
Joined: 3/14/2007
Posts: 24
Hi Bruce:The code is nice but does not work for my situation. The reason being unlike PP which has only 7 lines to draw, in my situation, I have a list of support/resistance lines (unknown ahead of time) based on a complex model calculation. I like to draw them as lines on the price chart so I can visually detect if price hitting those lines. So all I need is an API method to draw a horizontal line (or a rectangle is better)on the price chart when needed. How can I accomplish this? Thanks again!Ken
Bruce_L
Posted : Monday, March 12, 2012 8:59:29 AM


Worden Trainer

Joined: 10/7/2004
Posts: 65,138
A RealCode Indicator can only draw either one line or one bar. So you have either one value or four values at each data point. You have to have a different indicator for each line.

-Bruce
Personal Criteria Formulas
TC2000 Support Articles
Users browsing this topic
Guest-1

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.