通过TRADE_ACTION_DEAL或TRADE_ACTION_SLTP添加止损?

时间:2018-02-14 14:24:25

标签: mql5

根据 MetaTrader 5的EA交易编程 ...

request.action = TRADE_ACTION_DEAL;

[...]

request.sl = 0;

request.tp = 0;

request.deviation = 50;

OrderSend(request,result);
如果我的经纪人使用市场交换执行类型,

...将无效。我不得不通过后见之明通过request.action = TRADE_ACTION_SLTP;修改订单来增加止损和获利,而不是如果可能的话我想做的黑客攻击。但是,如果不通过反复试验(或丢失,那么)我如何找出我的经纪人(它的ActiveTrades)使用哪种执行类型?

PS:执行类型是即时请求市场 Exchange 执行。

1 个答案:

答案 0 :(得分:1)

public MainWindow() { InitializeComponent(); myTable = new DataTable(); } InitChart(DataTable dt) //Is called from another class when the DataTable changes { Maingrid.Children.Clear(); //Dispose old BarChart myTable = dt; Grid grid1 = new Grid(); grid1.Width = MainGrid.Width; grid1.Height = MainGrid.Height; // Create Rows int Pa = -1; foreach (DataRow rw in myTable.Rows) { if (Pa != (int)rw["Parent"]) { RowDefinition rdef = new RowDefinition(); rdef.Height = new GridLength(20); grid.RowDefinitions.Add(rdef); } Pa = (int)rw["Parent"]; } foreach (DataRow row in myTable.Rows) { int P = (int)row["Parent"]; foreach (DataRow rw in myTable.Rows) { if ((int)rw["Parent"] == P) //Each row splits the right bar of the previous row, all bars in one row have the previous split bar as their Parent. I draw all Bars with the same Parent in one Row. { if ((int)rw["Val"] != 0) //Some Bars are disabled or 0. I don't draw them { Rectangle rect = new Rectangle(); double L = rw["Val"]; //The Value of one Bar rect.Width = L / nMaxValue * grid.Width; //Calculate width of my Rectange based on the maximal value one bar can have rect.Height = 20; //Just a height rect.Margin = new Thickness( grid.Width - nRowValue/nMaxValue * grid.Width, 0, 0, 0); //Margin to display the bars next to each other rect.Fill = Col; rect.HorizontalAlignment = HorizontalAlignment.Left; //Although i want to have my BarChart go from right to left, I align all bars from on the left and then move them with my margin Grid.SetRow(rect, y); nRowValue = nRowValue - (int)rw["Val"]; grid1.Children.Add(rect); } } } } MainGrid.Children.Add(grid1); } 用于修改。发送一个简单的市场订单,然后,成功后,修改它,为ecn和非ecn经纪人