EA Programing => ปัญหาที่พบในการเขียน EA => Topic started by: Nantipat on พฤษภาคม 18, 2016, 04:52:15 pm
-
รบกวน admin ปรับ EA ชื่อ EA_NAN_MA_V23
ให้เบิ้ล lot และเลื่อย TP นะครับ ผมติดตรงนี้ทำไม่เป็นครับ
ส่วน EA ชื่อ forexthaipop เป็นตัวอย่างครับ อยากให้ EA_NAN_MA_V23 เบิ้ล lot และเลื่อย TP แบบ EA ชื่อ forexthaipop
EA_NAN_MA_V23 เขียนตาม อ้างถึง หัวข้อ: วอนพี่ๆช่วยเขียนอีเอให้ครับ
ขอบคุณครับ
-
ถ้าเลื่อน TP เอา code นี้ไปใส่เพิ่มแล้วเรียกใช้ฟังก์ชั่นแบบในตัวอย่าง
extern int Trailing =10;
int start()
{
if(OrdersTotal()==0)
{
OrderSend(Symbol(),OP_BUY,0.1,Ask,3,0,0,"EX6",0,0,Green);
OrderSend(Symbol(),OP_SELL,0.1,Bid,3,0,0,"EX6",0,0,Red);
}
trailingstop();
return(0);
}
void trailingstop() {
for(int count=0;count<OrdersTotal();count++)
{OrderSelect(count,SELECT_BY_POS,MODE_TRADES);
if(OrderType() == OP_BUY )
{if(Trailing > 0){
if(Bid - OrderOpenPrice() > Trailing*Point)
{if(OrderStopLoss()==0 || (Bid - OrderStopLoss()> Trailing*Point))
{OrderModify(OrderTicket(), OrderOpenPrice(),Bid - Trailing*Point, OrderTakeProfit(), 0, Blue); }
}
}
}
if(OrderType() == OP_SELL )
{ if(Trailing > 0)
{if(OrderOpenPrice() - Ask > Trailing*Point)
{
if(OrderStopLoss() == 0 || ( OrderStopLoss()-Ask > Trailing*Point ) )
{OrderModify(OrderTicket(), OrderOpenPrice(),Ask + Trailing*Point, OrderTakeProfit(), 0, Red); }
}
}
}
}
}
-
ขอบคุณครับ ผมจะลองดูครับ