Plotting Buy / Sell Signals On Candle Chart

Hi,


I want to plot Buy / Sell / Other Signals On a Candlestick Chart based on certain condition. The signal signs (Say Some Icon Image / UpArrow / DownArrow) should appear above High or below Low of a candle by a certain Offset value so that user can see it clearly. Please let me know how can I achieve this in Synfusion Winform chart using c#.


Thanks,
Amit


5 Replies

YP Yuvaraj Palanisamy Syncfusion Team July 21, 2021 12:59 PM UTC

Hi Amitabha, 
 
Greetings from Syncfusion. 
 
We would like to let you know that the add symbol by using Symbol property of ChartSeries.Style. Please find the code example below.  
   
Code Snippet:  
   
   
for (int i = 0; i < chartSeries1.Points.Count; i++) 
{ 
    var point = chartSeries1.Points[i]; 
    if (point.YValues[3] < point.YValues[2]) 
    { 
        chartSeries1.Styles[i].Symbol.Shape = ChartSymbolShape.Triangle; 
        chartSeries1.Styles[i].Symbol.Color = Color.Green; 
    } 
    else 
    { 
        chartSeries1.Styles[i].Symbol.Shape = ChartSymbolShape.InvertedTriangle; 
        chartSeries1.Styles[i].Symbol.Color = Color.Red; 
    } 
    chartSeries1.Styles[i].Symbol.Offset = new Size(0, -10); 
} 
   
   
Also, we have prepared the sample for your reference. Please find the sample from the below link.  
   
   
Output:  
 
 
For more detail, please refer the below link
https://help.syncfusion.com/windowsforms/chart/chart-series#symbols
 
 
 
Regards, 
Yuvaraj. 



AM Amitabha July 22, 2021 05:20 AM UTC

Hi Yuvaraj,


Thanks for your response. I tried as you suggested and the signals are appearing on chart. However I want the Buy signal (Green Up Triangle  in your example) to be placed below the Low of the Candle And the Sell signal(Red InvertedTriangle in your example) to be placed Above the High of the candle. Right now the offset is being computed with respect to the High of candle I believe And hence all signals are appearing above the high of the candle. Is there any way to achieve what I want ?


Thanks,

Amit



YP Yuvaraj Palanisamy Syncfusion Team July 23, 2021 10:08 AM UTC

Hi Amitabha, 
 
We can achieve your requirement “Add symbol in the above high value and below low value based on PriceDown and PriceUp” with the help of ChartCustomPoint in Windows forms chart. Please refer the below code example. 
 
CodeSnippet: 
 
for (int i = 0; i < chartSeries1.Points.Count; i++) 
{ 
    var point = chartSeries1.Points[i]; 
    if (point.YValues[3] < point.YValues[2]) 
    { 
        ChartCustomPoint ccp = new ChartCustomPoint(); 
        ccp.XValue = point.X; 
        ccp.YValue = point.YValues[1] - 1f; 
        ccp.CustomType = ChartCustomPointType.ChartCoordinates; 
         
        ccp.Symbol.Color = Color.Green; 
        ccp.Symbol.Offset = new Size(0, 30); 
        ccp.Symbol.Shape = ChartSymbolShape.Triangle; 
        this.chartControl1.CustomPoints.Add(ccp); 
    } 
    else 
    { 
        chartSeries1.Styles[i].Symbol.Shape = ChartSymbolShape.InvertedTriangle; 
        chartSeries1.Styles[i].Symbol.Color = Color.Red; 
        chartSeries1.Styles[i].Symbol.Offset = new Size(0, -10); 
    }                 
} 
 
Also, we have attached sample for your reference. Please find the sample from the below link. 
 
 
Output: 
 
 
For more details, please refer the below link. 
 
Regards, 
Yuvaraj. 



AM Amitabha July 23, 2021 10:30 PM UTC

Hi Yuvaraj ,


Thank you so much. It worked fine. Really appreciate the help.


Thanks,

Amit



YP Yuvaraj Palanisamy Syncfusion Team July 25, 2021 05:59 AM UTC

Hi Amitabha,

Thank you for your update.

Please let us know if you have any further assistance on this.
 
  
Regards, 
Yuvaraj 


Loader.
Up arrow icon