Click here to Login





How to create a custom trendline

Updated on 2011-04-30 04:40:10

Share |

I know there is already a build-in trendline in QuantShare. But, I wanted to show you how to create your own using the Custom drawing tools plug-in. I will also show you how to add and create more features for this trend line.

Steps

- Select "Tools" then "Custom Drawing Tools".
- Click on "Add", type "MyTrendLine" then click on "Save".
- Type the following formula:

if(Functions.ClickPositions.Length == 0) // No click on the chart -> Exit
{
return;
}

PointPosition point1 = Functions.ClickPositions[0]; // First click location
PointPosition point2 = Functions.CursorPosition; // Second click set Mouse cursor
if(Functions.ClickPositions.Length > 1) // There is a second click
{
point2 = Functions.ClickPositions[1]; // Second click associated with point2
Functions.FinishDrawing(); // Finish drawing after the second click
}

// Draw line using point1 and point2 locations
LineObj line = Functions.PaneObject.DrawLine("Line1", point1.X, point1.Y, point2.X, point2.Y);

// If point1 Y value is higher than point2 Y value then set the line color to Red
if(point1.Y > point2.Y)
{
line.Line.Color = Color.Red;
}
else // Otherwise we set the line color to Green
{
line.Line.Color = Color.Green;
}

Adding our trendline to the bookmark panel

- Right click on the Bookmark panel (bar under the menu) then click on "Add Shortcut".
- Select "Drawing Tools", keep "Create a shortcut for an existing..." checked then click on "OK".
- Select "MyTrendLine" item then click on "Load selected item".
- To use the drawing item, simply double click on it then click on a chart.









no reviews (Log in)







Other how-to articles




How to create a custom trading indicator





How to create and trade a Neural Network model





How to create trading rules based on Put and Call volume data





How to use a custom drawing tool





How to create a mobile database/account





How to create histogram charts





How to create a real-time watchlist





How to create a correlation matrix of several securities





How to create a trading system







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.