Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

click on the graph and place a buystop on that price​

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    click on the graph and place a buystop on that price​

    I am programming a button in the charttrader, that when it is active, the user can click on the graph and place a buystop on that price​

    Code:
    
    private void OnChartMouseDown(object sender, System.Windows.Input.MouseButtonEventArgs e) { if (!waitingForClick) return; try { ChartControl chartControl = sender as ChartControl; if (chartControl == null) return; // Obtener la posición del clic en la gráfica Point mousePosition = e.GetPosition(chartControl); double chartY = mousePosition.Y; // Convertir la posición del clic en un precio double price = chartControl.ChartPanel.GetValueByY(chartY); // Configurar el precio del stop stopPrice = price; // Crear una orden Buy Stop Limit en el precio seleccionado SubmitBuyStopOrder(1, stopPrice); Print("Orden Buy Stop creada en el precio: " + stopPrice); // Desactivar la espera de clic waitingForClick = false; // Desuscribirse del evento para evitar clics posteriores ChartControl.MouseDown -= OnChartMouseDown; } catch (Exception exc) { Print("Error al procesar el clic en la gráfica: " + exc.Message); } }​
    Last edited by leojimenezp; 09-02-2024, 07:30 AM.

    #2
    Hello leojimenezp,

    Thank you for your post.

    I'm not seeing a question being asked regarding this topic - do you have a question to ask regarding how to do this?

    There is a sample script demonstrating how to place orders by clicking the mouse.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    43 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    20 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    30 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    49 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    38 views
    0 likes
    Last Post CarlTrading  
    Working...
    X