Page 1 of 2
Trendline with Snap to Point & Semi log Aware Trendline
Posted: Wed Feb 11, 2015 11:33 am
by 16071129
Here we have 2 requirements:
1] Draw Line with Snap to Point
This requires drawing a Line with "Snap to Point" option similar as Cursor Tool's Snap Feature.
2] Semi Log Aware Line [Dependent on requirement 1]
Say e.g. we have a normal Candle Series and we draw the line which is based on this candle series. Now assume that we changed this Candle to Logarithmic with log base equal to 10. Since the previously drawn line is based on Candle Series this line should now updated as per the Logarithmic Candle Series. In this transformation the line may change its appearance from straight line to curved line. Same can happen vice versa.
Please help us in solving above two requirements.
Re: Trendline with Snap to Point & Semi log Aware Trendline
Posted: Wed Feb 11, 2015 1:29 pm
by Christopher
Hello Quant,
Would you be so kind as to send us some example code you have already written to implement these requirements of yours?
It would save us a lot of time to work on what you have already done rather than writing an application for you from scratch. If you could also send us some screenshots of what functionality you would like to see in your code but haven't been able to implement, that would also be greatly appreciated.
Re: Trendline with Snap to Point & Semi log Aware Trendline
Posted: Thu Feb 12, 2015 6:41 am
by 16071129
We yet to start work on this, but we can explain you both the requirement in more detail.
1] Draw Line with Snap to Point (Check below Image 1):
As shown in the screenshot we draw two trend lines. The Pink Line is normal line without Snap to Point Option. Whereas the Green Line as you see are attached to series points. Green line is drawn using Snap to Point Option. Both Start and End points of Green Line are attached to CandleStick Series.
- Image (1): Snap to Point Trend Line
- TrendLine.png (31.9 KiB) Viewed 30319 times
2] Semi Log Aware Line
Image 2 shows Line Drawn on series whose Logarithmic Property is Set to True.
Whereas Image 3 shows the same Line on same series whose Logarithmic Property is Set to False.
By clearly looking at both the image, you can clearly make out the difference in Image 3 that the blue line is now has the appearance of Curved Line.
The line shown in Image 3 is actual Semi Log Aware Trend Line.
- Image (2): Line Drawn on Logarithmic Series
- Semilog_Scale.png (26.35 KiB) Viewed 30301 times
- Image (3): Line Drawn on Same Series (with Logarithmic = Off
- Without_Semilog_Scale.png (27.33 KiB) Viewed 30303 times
Re: Trendline with Snap to Point & Semi log Aware Trendline
Posted: Thu Feb 12, 2015 9:31 am
by Christopher
Quant,
A couple of questions:
1) which algorithm are you using to calculate the points that are drawn in the trendline?
2) the snap to point functionality ... how do you want this to work? Which if the OHLC (open, high, low, close) points do you want the line to snap to when the mouse is moved?
Re: Trendline with Snap to Point & Semi log Aware Trendline
Posted: Thu Feb 12, 2015 11:39 am
by 16071129
Hi,
Currently we are not using any algorithm for calculating points that are drawn in the trendline. We are using Line Tool for drawing trendline.
I can suggest you algorithm that is TeeChart currently using for Tool "Nearest Point".
For the Snap Point functionality yes we want the line to snap when the mouse is moved.
Re: Trendline with Snap to Point & Semi log Aware Trendline
Posted: Thu Feb 12, 2015 11:58 am
by Christopher
Quant wrote:
Currently we are not using any algorithm for calculating points that are drawn in the trendline. We are using Line Tool for drawing trendline.
Okay ... so how do you expect the line to "bend" as you require? For this to happen more than two points (start, end) are necessary.
Quant wrote:
I can suggest you algorithm that is TeeChart currently using for Tool "Nearest Point".
Please do not forget that even without the TeeChart source code you have access to this algorithm - the TeeChart.dll is not obfuscated, which means you can easily use tools such as
reflector or
ILSpy to copy code.
Re: Trendline with Snap to Point & Semi log Aware Trendline
Posted: Thu Mar 26, 2015 8:35 am
by 16071129
Hi,
We did R&D on the mentioned requirement in this post, but we yet to get solution on this.
Please provide us with some sample code.
Re: Trendline with Snap to Point & Semi log Aware Trendline
Posted: Thu Mar 26, 2015 9:06 am
by narcis
Hello Quant,
To be able to understand which is your exact requirement you should answer the questions Christopher Ireland made you before:
Christopher wrote:
2) the snap to point functionality ... how do you want this to work? Which if the OHLC (open, high, low, close) points do you want the line to snap to when the mouse is moved?
Christopher wrote:
Okay ... so how do you expect the line to "bend" as you require? For this to happen more than two points (start, end) are necessary.
Christopher wrote:
Please do not forget that even without the TeeChart source code you have access to this algorithm - the TeeChart.dll is not obfuscated, which means you can easily use tools such as
reflector or
ILSpy to copy code.
Did you look at that, which problems did you come across?
Thanks in advance.
Re: Trendline with Snap to Point & Semi log Aware Trendline
Posted: Thu Mar 26, 2015 12:27 pm
by 16071129
Hi,
1] Snap to Point Functionality should work on selected series data. It can be OHLC, Line or Volume etc.
2] I explained the same point in more details (with images), in this post. Yes sometimes we need more than two points to achieve this.
3] Currently we have not looked in your source code, but as we have to deliver these requirements asap, we do not have much time to follow this step. It would be very great if you help us in fulfilling these requirements.
Re: Trendline with Snap to Point & Semi log Aware Trendline
Posted: Fri Mar 27, 2015 12:34 pm
by narcis
Hi Quant,
You could try using
NearestPoint tool
GetNearestPoint method as Yeray explained
here to snap points to your series.
Re: Trendline with Snap to Point & Semi log Aware Trendline
Posted: Tue May 26, 2015 12:28 pm
by 16071129
Hi,
We need an example for Semi Log Aware Trendline, which we have explained with image in this post.
We did our research on this but still we haven't found any solution.
Re: Trendline with Snap to Point & Semi log Aware Trendline
Posted: Wed May 27, 2015 1:29 pm
by Christopher
Hello,
Quant wrote:We did our research on this but still we haven't found any solution.
Can you please explain the specific problems you encountered in your research of this functionality?
My colleague NarcĂs has been kind enough to produce a simple mock-up of what we understand as your requirement, which is here:
Code: Select all
private Steema.TeeChart.Styles.Candle candle1;
private Steema.TeeChart.Tools.NearestPoint nearestPoint1;
private void InitializeChart()
{
tChart1.Aspect.View3D = false;
tChart1.Zoom.Direction = Steema.TeeChart.ZoomDirections.None;
tChart1.Panning.Allow = Steema.TeeChart.ScrollModes.None;
candle1 = new Steema.TeeChart.Styles.Candle(tChart1.Chart);
candle1.FillSampleValues();
nearestPoint1 = new Steema.TeeChart.Tools.NearestPoint(candle1);
nearestPoint1.Active = false;
tChart1.MouseDown += tChart1_MouseDown;
tChart1.MouseMove += tChart1_MouseMove;
tChart1.MouseUp += tChart1_MouseUp;
}
void tChart1_MouseUp(object sender, MouseEventArgs e)
{
if (!multiPointLine && (index != -1))
{
AddNewPoint(new Point(e.X, e.Y));
}
index = -1;
}
private void AddNewPoint(Point point)
{
int newIndex = nearestPoint1.GetNearestPoint(point);
tChart1[tChart1.Series.Count - 1].Add(candle1.XValues[newIndex], candle1.YValues[newIndex]);
}
void tChart1_MouseMove(object sender, MouseEventArgs e)
{
if (multiPointLine && (index != -1))
{
AddNewPoint(new Point(e.X, e.Y));
}
}
private int index = -1;
void tChart1_MouseDown(object sender, MouseEventArgs e)
{
index = nearestPoint1.GetNearestPoint(new Point(e.X, e.Y));
if (index != -1)
{
tChart1.Series.Add(new Steema.TeeChart.Styles.Line());
tChart1[tChart1.Series.Count - 1].Add(candle1.XValues[index], candle1.YValues[index]);
}
}
private bool multiPointLine = false;
private void checkBox1_CheckedChanged(object sender, EventArgs e)
{
multiPointLine = checkBox1.Checked;
}
private void checkBox2_CheckedChanged(object sender, EventArgs e)
{
tChart1.Axes.Left.Logarithmic = checkBox2.Checked;
}
I hope you can use this very simple example to further explain to us exactly what your requirements are.
Re: Trendline with Snap to Point & Semi log Aware Trendline
Posted: Tue Jun 16, 2015 12:02 pm
by 16071129
Dear Steema,
We checked your code, but it is not what we expected. Last time we explained the same with some screenshots. Please take look of this post once again. If you still have difficulty to understand the same, please let us know.
Re: Trendline with Snap to Point & Semi log Aware Trendline
Posted: Wed Jun 17, 2015 11:00 am
by Christopher
Quant wrote:We checked your code, but it is not what we expected. Last time we explained the same with some screenshots. Please take look of this post once again. If you still have difficulty to understand the same, please let us know.
Without a mathematical or algorithmic explanation of your requirement, I'm afraid we cannot help. Images are simply not enough as a basis for us to implement it, I'm afraid.
Re: Trendline with Snap to Point & Semi log Aware Trendline
Posted: Thu Sep 03, 2015 5:36 am
by 16071129
watch this video which explain semi log in Excel
*Line is converted to log curve *
http://www.youtube.com/watch?v=y55VmSIMBjE
for mathematical formula use below link
https://en.wikipedia.org/wiki/Semi-log_plot