Click here to Login








Trendline

by QuantShare, 4509 days ago
Share |






Here is the second custom drawing tool. The first one can be downloaded here Close Price Above Cursor, it displays the selected security's price above the mouse cursor.

The current object draws a trendline. A trendline is composed of two or more points; it is often used in trading as a support or resistance line. Trendlines are an important tool used by traders in technical analysis to identify trends.
This trendline object is almost similar to the default QuantShare trendline, except that it displays the bars and Y distance during drawing.

The object requires two clicks. The script first detects the number of clicks. If this number is equal to one, then we draw a trend line that starts from the first click location and ends at the cursor location.
PointPosition p1 = Functions.ClickPositions[0];
PointPosition p2 = Functions.CursorPosition;
LineObj line = Functions.PaneObject.DrawLine("", p1.X, p1.Y, p2.X, p2.Y);

At the same time, we also draw the number of bars and the Y distance between these two points:
double distance = Math.Abs(p1.X - p2.X);
double distanceY = Math.Round(Math.Abs(p1.Y - p2.Y), 2);
TextObj text = Functions.PaneObject.DrawText("text", distance + ":" + distanceY, p1.X, p1.Y);

If the number of clicks is equal to two, then we draw a trend line that starts from the first click location and ends at the second click location.
PointPosition p1 = Functions.ClickPositions[0];
PointPosition p2 = Functions.ClickPositions[1];
LineObj line = Functions.PaneObject.DrawLine("", p1.X, p1.Y, p2.X, p2.Y);
line.Line.Color = (Color)Functions.GetSettings("Line Color");
Functions.FinishDrawing();

The "GetSettings" function retrieves a custom color for the trendline. You will need to add a setting first. The color can be defined by right clicking on the drawing tool.
To specify that the drawing process of the trendline is complete, we simply call the "FinishDrawing" method.


Share This ->
Share |


You have to log in to bookmark this object
What is this?




Type: Custom Drawing Tool

Object ID: 451


Country:
All

Market: All

Style:
Technical Analysis

Reviews
You must log in first

Join now
and get instant access for free to the trading software, the Sharing server and the Social network website.
Click here


Related objects

Empty

Number of reviews
Click to add a review
Average rate
Click to rate this item
Number of times this object was downloaded
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object

Technical Analysis


Fundamental Analysis



Random Blog Posts

Trading software new features

Money Management: Optimize a trading system

Optimization of a trading system

How to create custom databases in your trading software

Technical Analysis Using Multiple Timeframes - Second Part

New features in QuantShare - Trading Software

Technical Analysis Using Multiple Timeframes

Short Index - Part 2

Show All

Number of reviews
Click to add a review
Average rate
Click to rate this item
Number of times this object was downloaded
Number of rates the current object received
Report an object
if you can't run it for example or if it contains errors
Click to report this object






QuantShare
Product
QuantShare
Features
Create an account
Affiliate Program
Support
Contact Us
Trading Forum
How-to Lessons
Manual
Company
About Us
Privacy
Terms of Use

Copyright © 2024 QuantShare.com
Social Media
Follow us on Facebook
Twitter Follow us on Twitter
Google+
Follow us on Google+
RSS Trading Items



Trading financial instruments, including foreign exchange on margin, carries a high level of risk and is not suitable for all investors. The high degree of leverage can work against you as well as for you. Before deciding to invest in financial instruments or foreign exchange you should carefully consider your investment objectives, level of experience, and risk appetite. The possibility exists that you could sustain a loss of some or all of your initial investment and therefore you should not invest money that you cannot afford to lose. You should be aware of all the risks associated with trading and seek advice from an independent financial advisor if you have any doubts.