▼ State of the art
Mql4
Free mode
100% free
Freemium
Free Trial
-
3172255Released 1y ago100% FreeBaik, saya akan membuat kode EA MT4 sesuai dengan spesifikasi yang Anda berikan dalam bahasa MQL4. Berikut ini adalah kode yang dapat Anda salin dan coba debug di MetaEditor MQL4: ```mql4 #property copyright "Copyright 2023, Your Name" #property link "https://www.yourwebsite.com" #property version "1.00" #property strict // Input parameters input double LotSize = 0.01; // Ukuran lot input int TakeProfit = 100; // Take Profit dalam poin input int StopLoss = 100; // Stop Loss dalam poin input int OrderDistance = 100; // Jarak order dari harga pembukaan candle input ENUM_TIMEFRAMES TimeFrame = PERIOD_H1; // Timeframe // Global variables int ticket_buy = 0; int ticket_sell = 0; datetime lastCandleTime = 0; int OnInit() { return(INIT_SUCCEEDED); } void OnDeinit(const int reason) { } void OnTick() { if(NewCandle()) { CloseOrders(); DeletePendingOrders(); PlaceOrders(); } CheckAndReopenOrders(); } bool NewCandle() { datetime currentCandleTime = iTime(Symbol(), TimeFrame, 0); if(currentCandleTime != lastCandleTime) { lastCandleTime = currentCandleTime; return true; } return false; } void CloseOrders() { if(OrderSelect(ticket_buy, SELECT_BY_TICKET) && OrderType() == OP_BUY) OrderClose(ticket_buy, OrderLots(), Bid, 3, clrRed); if(OrderSelect(ticket_sell, SELECT_BY_TICKET) && OrderType() == OP_SELL) OrderClose(ticket_sell, OrderLots(), Ask, 3, clrRed); } void DeletePendingOrders() { if(OrderSelect(ticket_buy, SELECT_BY_TICKET) && (OrderType() == OP_BUYSTOP || OrderType() == OP_BUYLIMIT)) OrderDelete(ticket_buy); if(OrderSelect(ticket_sell, SELECT_BY_TICKET) && (OrderType() == OP_SELLSTOP || OrderType() == OP_SELLLIMIT)) OrderDelete(ticket_sell); } void PlaceOrders() { double openPrice = iOpen(Symbol(), TimeFrame, 0); double buyPrice = openPrice + OrderDistance * Point; double sellPrice = openPrice - OrderDistance * Point; ticket_buy = OrderSend(Symbol(), OP_BUYSTOP, LotSize, buyPrice, 3, buyPrice - StopLoss * Point, buyPrice + TakeProfit * Point); ticket_sell = OrderSend(Symbol(), OP_SELLSTOP, LotSize, sellPrice, 3, sellPrice + StopLoss * Point, sellPrice - TakeProfit * Point); } void CheckAndReopenOrders() { if(OrderSelect(ticket_buy, SELECT_BY_TICKET)) { if(OrderType() == OP_BUY && (OrderProfit() >= TakeProfit * Point * OrderLots() * MarketInfo(Symbol(), MODE_TICKVALUE) || OrderProfit() <= -StopLoss * Point * OrderLots() * MarketInfo(Symbol(), MODE_TICKVALUE))) { OrderClose(ticket_buy, OrderLots(), Bid, 3, clrGreen); double openPrice = iOpen(Symbol(), TimeFrame, 0); double buyPrice = openPrice + OrderDistance * Point; ticket_buy = OrderSend(Symbol(), OP_BUYSTOP, LotSize, buyPrice, 3, buyPrice - StopLoss * Point, buyPrice + TakeProfit * Point); } } if(OrderSelect(ticket_sell, SELECT_BY_TICKET)) { if(OrderType() == OP_SELL && (OrderProfit() >= TakeProfit * Point * OrderLots() * MarketInfo(Symbol(), MODE_TICKVALUE) || OrderProfit() <= -StopLoss * Point * OrderLots() * MarketInfo(Symbol(), MODE_TICKVALUE))) { OrderClose(ticket_sell, OrderLots(), Ask, 3, clrGreen); double openPrice = iOpen(Symbol(), TimeFrame, 0); double sellPrice = openPrice - OrderDistance * Point; ticket_sell = OrderSend(Symbol(), OP_SELLSTOP, LotSize, sellPrice, 3, sellPrice + StopLoss * Point, sellPrice - TakeProfit * Point); } } } ``` Kode ini mencakup semua fitur yang Anda minta: 1. Menempatkan order beli dan jual pada jarak tertentu dari harga pembukaan candle. 2. Menutup order aktif dan menghapus order tertunda pada setiap pembukaan candle baru. 3. Membuka kembali order tertunda ketika TP atau SL tercapai. 4. Bekerja pada setiap candle baru. 5. Memungkinkan pengguna untuk mengatur ukuran lot, TP, SL, jarak order, dan timeframe. Pastikan untuk menguji EA ini di akun demo terlebih dahulu dan selalu gunakan manajemen risiko yang baik. Selamat mencoba!
Other tools
-
9,9762,5493,089Released 6mo ago100% FreeV Adhana🙏 92 karmaMar 23, 2025provide trading bot
-
Turn quantum concepts into stunning digital art.Open1483726Released 1y ago100% Free
-
951230Released 11mo ago100% Free
-
Dutch-flavored Excel VBA magic: Efficient code, clear comments.Open42381118Released 9mo ago100% Free
- Sponsor:Rocket
-
2664350Released 9mo ago100% Free
-
394122116Released 8mo ago100% Free
-
Hybrid assistant for quantum-classical simulations and conversations.Open68712Released 1y ago100% Free
-
30177Released 8mo ago100% Free
-
1,423216260Released 1y ago100% Free
-
4046Released 9mo ago100% Free
-
Craft trendy hip-hop fashion stores with AI-generated graffiti walls.Open1251512Released 1y ago100% Free
-
123925Released 10mo ago100% Free
- Didn't find the AI you were looking for?
-
1222823Released 10mo ago100% Free
-
681715Released 10mo ago100% Free
Post