Copy button for Values
Copy button for Values
08 Jan 2025, 11:03
Hello Everyone ,
I'm trying to create a simple indicator to copy open candle price , but I'm struggle to find logic to copy into clipboard and not only into log or file .
Here is example I have used which doesn't function because I'm stuck :
using cAlgo.API;
namespace cAlgo
{
[Indicator("Open Value Indicator", TimeZone = TimeZones.UTC, AccessRights = AccessRights.None, IsOverlay = true)]
public class OpenValueIndicator : Indicator
{
private Button copyOpenValueButton;
private double openValue;
protected override void Initialize()
{
// Create a button to copy the open value
copyOpenValueButton = new Button
{
Text = "Copy",
Margin = 10,
HorizontalAlignment = HorizontalAlignment.Right,
VerticalAlignment = VerticalAlignment.Top
};
// Subscribe to the button click event
copyOpenValueButton.Click += CopyOpenValueButton_Click;
// Add the button to the chart
Chart.AddControl(copyOpenValueButton);
}
// handler
private void CopyOpenValueButton_Click(ButtonClickEventArgs obj)
{
// pen value of the current candle
openValue = Bars.OpenPrices.Last(0); // Get the open price of the current candle
// Log
Print("Copied Open Value: " + openValue.ToString("F5"));
}
// Calculate method {empty}
public override void Calculate(int index)
{
}
}
}
firemyst
08 Jan 2025, 23:56 ( Updated at: 09 Jan 2025, 06:59 )
Have you tried searching Google for answers on how to do it in C#?
https://www.google.com/search?q=c%23+copy+to+clipboard&sca_esv=7b6665388691d88d&ei=-Ax_Z5nSB--X4-EPoL_l2AE&oq=c%23+copy+&gs_lp=Egxnd3Mtd2l6LXNlcnAiCGMjIGNvcHkgKgIIAjILEAAYgAQYkQIYigUyBRAAGIAEMgUQABiABDIFEAAYgAQyBRAAGIAEMgUQABiABDIFEAAYgAQyBRAAGIAEMgUQABiABDIFEAAYgARIuSpQAFjbIHABeACQAQCYAZwCoAGdD6oBBTAuNS40uAEDyAEA-AEBmAIKoALGD8ICChAAGIAEGEMYigXCAg0QABiABBixAxhDGIoFwgIOEC4YgAQYsQMY0QMYxwHCAhEQLhiABBixAxjRAxiDARjHAcICCxAAGIAEGLEDGIMBwgIOEC4YgAQYsQMYgwEYigXCAhAQABiABBixAxhDGIMBGIoFmAMAkgcFMS4xLjigB_k3&sclient=gws-wiz-serp
@firemyst