Anda Mencari Source Code Coding Expert Advisor Trailing Stop? Kabar Gembira, Sekarang Anda Sudah Menemukannya.
CODING TRAILING STOP:
void TrailingStopSimple()
{
int ts = TrailingStop;
//int newtp = NewTakeProfit;
for (int i=OrdersTotal()-1; i >= 0; i--)
if (OrderSelect(i, SELECT_BY_POS, MODE_TRADES))
{
if (OrderSymbol() == Symbol())// && OrderMagicNumber() == 1)
{
if (OrderType() == OP_BUY && Ask - OrderOpenPrice() > ts*PipValue*Point)
{
if (OrderStopLoss() < Ask-(ts+3)*PipValue*Point || OrderStopLoss() == 0)
//if (!OrderModify(OrderTicket(),OrderOpenPrice(),Ask-ts*PipValue*Point,Ask+(newtp+ts)*PipValue*Point,OrderExpiration(),White))
if (!OrderModify(OrderTicket(), OrderOpenPrice(), Ask-ts*PipValue*Point, OrderExpiration(), White))
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
if (OrderType() == OP_SELL && OrderOpenPrice() - Bid > ts*PipValue*Point)
{
if (OrderStopLoss() > Bid+(ts+3)*PipValue*Point || OrderStopLoss() == 0)
//if (!OrderModify(OrderTicket(),OrderOpenPrice(),Bid+ts*PipValue*Point,Bid-(newtp+ts)*PipValue*Point,OrderExpiration(),White))
if (!OrderModify(OrderTicket(), OrderOpenPrice(), Bid+ts*PipValue*Point, OrderExpiration(), White))
Print("OrderModify() error - ", ErrorDescription(GetLastError()));
}
}
}
else
Print("OrderSelect() error - ", ErrorDescription(GetLastError()));
}
Demikian Source Code MQL4 MT4 Coding Expert Advisor Trailing Stop Yang Dapat Kami Informasikan Kepada Anda, Semoga Bermanfaat Untuk Menambah Pengetahuan Anda Mengenai Bahasa Pemrograman MQL4 Untuk Membuat Robot Gold dan Forex. Kalau Ada Pertanyaan? Hub ke Kontak Kami!
0 comments:
Posting Komentar