ฉันได้รับกำไรเชิงลบเมื่อทำงานต่อเนื่องหยุดขาดทุนเพราะรหัสไม่บัญชีสำหรับค่านายหน้าและ swap,
ฉันพยายามต่อไปนี้ที่ไม่ได้ผล
ต้องการความช่วยเหลือขอบคุณ!
LongTrailingStop โมฆะ ()
{
int lcnt;
int ltotal = OrdersTotal ();
ซื้อคู่;
สำหรับ (lcnt = ltotal-1; lcnt gt; = 0; lcnt--)
{
OrderSelect (lcnt, SELECT_BY_POS, MODE_TRADES);
if (OrderType () lt; = OP_SELL OrderSymbol () == สัญลักษณ์ ())
{
ถ้า (OrderType () == OP_BUY)/เปิดตำแหน่งที่ยาวขึ้น
{
ถ้า (TrailingStopgt; 0)
{
ถ้า (Bid-OrderOpenPrice () gt; (จุด * TrailingStop))
{
ถ้า (OrderStopLoss () lt; Bid- (จุด * TrailingStop))
{
BuyProfit = (OrderProfit () OrderCommission () OrderSwap ());
OrderModify (OrderTicket () OrderOpenPrice () Bid- (จุด * TrailingStop BuyProfit) OrderTakeProfit (), 0, กรีน);
ผลตอบแทน (0);
}
}
}
}
}
}
}