Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to code enter and exit position message during manual trading

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

    How to code enter and exit position message during manual trading

    Dear AlgoTraders,

    I'm developing the script which draws objects when I trade manualy. The story started here



    and now I have another issue. I'd like that the script shows me whether I enter position or exit it.

    I code the case when I enter Long or Short, but I do not have any ideas how to code exit Long or Short.

    Please, help! I'm not good in programming and realy appreciate any help. The method which do all drawingns is below

    private void OnExecution(object sender, ExecutionUpdateEventArgs e)
    {

    if (e.Execution.Order != null)
    {
    if (e.Execution.Order.OrderState == OrderState.Filled)
    {

    double price = e.Price;
    double ts = TickSize;

    if(e.Execution.Order.OrderAction == OrderAction.Buy)
    {

    DrawArrowLine("k"+n,false,10,price+50*ts,0,price,C olor.Crimson,DashStyle.Solid, 3);
    foreach (IDrawObject draw in DrawObjects)
    {
    if (draw.DrawType == DrawType.ArrowLine)
    draw.Locked = false;
    }
    DrawText("n"+k,false, "Enter Long"+ "\n" +price, 10,price+50*ts,10,Color.Black,new Font("Calibri",14,FontStyle.Bold),StringAlignment. Center,Color.Transparent ,Color.Transparent,1);
    foreach (IDrawObject draw in DrawObjects)
    {
    if (draw.DrawType == DrawType.Text)
    draw.Locked = false;
    }
    n=n+1;
    k=k+1;
    return;
    }
    }

    }

    if (e.Execution.Order != null)
    {
    if (e.Execution.Order.OrderState == OrderState.Filled)
    {

    double price = e.Price;
    double ts = TickSize;

    if(e.Execution.Order.OrderAction == OrderAction.Buy)
    {

    DrawArrowLine("k"+n,false,10,price+50*ts,0,price,C olor.Crimson,DashStyle.Solid, 3);
    foreach (IDrawObject draw in DrawObjects)
    {
    if (draw.DrawType == DrawType.ArrowLine)
    draw.Locked = false;
    }
    DrawText("n"+k,false, "Exit Short"+ "\n" +price, 10,price+50*ts,10,Color.Black,new Font("Calibri",14,FontStyle.Bold),StringAlignment. Center,Color.Transparent ,Color.Transparent,1);
    foreach (IDrawObject draw in DrawObjects)
    {
    if (draw.DrawType == DrawType.Text)
    draw.Locked = false;
    }
    n=n+1;
    k=k+1;
    return;

    }
    }
    }

    if (e.Execution.Order != null)
    {
    if (e.Execution.Order.OrderState == OrderState.Filled)
    {

    double price = e.Price;
    double ts = TickSize;

    if(e.Execution.Order.OrderAction == OrderAction.Sell)
    {

    DrawArrowLine("k"+n,false,10,price+50*ts,0,price,C olor.Crimson,DashStyle.Solid, 3);
    foreach (IDrawObject draw in DrawObjects)
    {
    if (draw.DrawType == DrawType.ArrowLine)
    draw.Locked = false;
    }
    DrawText("n"+k,false, "Enter Short"+ "\n" +price, 10,price+50*ts,10,Color.Black,new Font("Calibri",14,FontStyle.Bold),StringAlignment. Center,Color.Transparent ,Color.Transparent,1);
    foreach (IDrawObject draw in DrawObjects)
    {
    if (draw.DrawType == DrawType.Text)
    draw.Locked = false;
    }
    n=n+1;
    k=k+1;
    return;

    }
    }
    }

    if (e.Execution.Order != null)
    {
    if (e.Execution.Order.OrderState == OrderState.Filled)
    {

    double price = e.Price;
    double ts = TickSize;

    if(e.Execution.Order.OrderAction == OrderAction.Sell)
    {

    DrawArrowLine("k"+n,false,10,price+50*ts,0,price,C olor.Crimson,DashStyle.Solid, 3);
    foreach (IDrawObject draw in DrawObjects)
    {
    if (draw.DrawType == DrawType.ArrowLine)
    draw.Locked = false;
    }
    DrawText("n"+k,false, "Exit Long"+ "\n" +price, 10,price+50*ts,10,Color.Black,new Font("Calibri",14,FontStyle.Bold),StringAlignment. Center,Color.Transparent ,Color.Transparent,1);
    foreach (IDrawObject draw in DrawObjects)
    {
    if (draw.DrawType == DrawType.Text)
    draw.Locked = false;
    }
    n=n+1;
    k=k+1;
    return;

    }
    }
    }



    }

    #2
    Hello alex_bbfg,

    Thank you for your post.

    Are you speaking of manual exits that you have placed? Or drawing objects you wish to place to indicate it is time to exit?

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    647 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    369 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    108 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    572 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    573 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X