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;
}
}
}
}
Comment