Hi
I wanted to add the function into my EA.The code does a partial close on an order that has x amount of pips in the negative
void CheckNewOrderClosed()
{
for(int i=OrdersHistoryTotal()-1;i>=0;i--) // check for closed orders
{
bool select=OrderSelect(i,SELECT_BY_POS,MODE_HISTORY);
if(OrderSymbol()==Symbol()) // if order with the same symbol
{
if(OrderProfit()<0||OrderCloseTime()<LastCheckedTime)return; // if order profit is in loss or order checked before then stop
else if(GetBiggestLossOrderTicket()>0) // else proceed to close partial lot if there is order with -500 loss
{
select=OrderSelect(GetBiggestLossOrderTicket(),SELECT_BY_TICKET,MODE_TRADES); // select biggest loss order with ticket number
double partialLotToClose=0.01;
bool closePartial=OrderClose(OrderTicket(),partialLotToClose,OrderClosePrice(),3);
LastCheckedTime=TimeCurrent();
}
}
}
}
int GetBiggestLossOrderTicket() // function to get ticket number for biggest loss order
{
int ticket=0;
double pips,MaxStoredLoss;
for(int i=OrdersTotal()-1;i>=0;i--) // check for opened orders
{
bool select=OrderSelect(i,SELECT_BY_POS,MODE_TRADES);
if(OrderSymbol()==Symbol())
{
if(OrderType()==OP_BUY)
{
pips=(Bid-OrderOpenPrice())/point; // calculate order pips profit
}
else if(OrderType()==OP_SELL)
{
pips=(OrderOpenPrice()-Ask)/point; // calculate order pips profit
}
if(pips<=-20) //if pips less than -500 pips then store the order info
{
if(pips<MaxStoredLoss) // store there is multiple orders with loss then store max loss order
{
MaxStoredLoss=pips; // set max loss stored as the new order loss
ticket=OrderTicket(); // store order ticket
}
}
}
}
return(ticket);
The EA is attached with default setting.Place it in the strategy tester to see what it does.It basically places 8 pending order on a price level at set intervals.4 long and 4 short.
The orders have no SL only TP and then it closes all open orders when a certain profit level is reached.Please ask if unsure.
I want to have external setting for it please
Lots to be closed = ;
Distance to start partial closes = ;
Please let me know if you want to the job
Thank you for your time
Similar orders
I need a robot that trade on command and stop-loss and take profit when need to , able to trade on all plate form follow profitable strategies or signal , want a winning streak with fast profits making
Hi I'm looking for this EA or Similar EA with optimizated set file. This bot is an automated trading robot, operating 24/7, and capable of trading all currency pairs. Compatible with all brokers. Features: Analysis of price action charts, trends, and support and resistance levels on any timeframe. The bot integrates stop-loss (SL), stop-loss (TP), and trailing stop-loss (SL) orders. Works on MT5 getshared . c o m
I wish to create 2 different Tradingview strategies to MT5 ea-s! Anyone? One is based on Heiken Ashi...the other based on different combination of my strategy. It is for 1 minute charts
Specify your Requirements Specification here point by point. Try to describe your requirements briefly and clearly, so that your potential developer is able to correctly assess its complexity and cost, as well as the required execution time. A bad or too generic description will result in your order being ignored, or you will spend a lot of time negotiating the details with each applicant. Remember: It is better to
**IMPORTANT: PLEASE DISREGARD THE PREVIOUS SPECIFICATION TITLED "FULL TRADING PLATFORM – APPLICATION FLOW REQUIREMENTS."** I no longer need the complete trading platform outlined in my previous **"FULL TRADING PLATFORM – APPLICATION FLOW REQUIREMENTS"** specification. Originally, I considered building a complete trading platform with educational materials, training systems, user accounts, subscription features
I have indicators on my Trading view which will create zones automatically on H4 Candle confirmation. I am getting an alert also that specific zone is created. I want them to shift in automated trading like once zone is created, limits should be place automatically on basis of that zone with given lot size, number of layers and with TP and SL. I have checked on AI to convert this in auto but they need zone in numbers
I am looking for an experienced MQL5 developer to recreate my existing MT5 Expert Advisor (DSTR Novaa). I have the original compiled EX5 file, Vantage MT5 live trading history and original Strategy Tester report. Required Trading Logic: EMA Period: 3. BUY when price crosses below EMA 3. SELL when price crosses above EMA 3. Starting Lot: 0.01 (configurable). Martingale Multiplier: 2.0. Maximum Martingale Cycle: 9
I need an ready-made MT5 profitable EA for Gold. 5/7% daily I need. Before applying please make sure you have one with proven ROI, Drawdown and Live performace result. I will Pay $500 for it but I need as I want. Must needs to supply Source code if I like it. Before I purchase I will test 7 days on my live account. If It's okay then apply othersie please pass this project. Hope you will respect the time for both of
I need a EA to test many EAS all in one to see the results For back testing I've got the EA I want to see the combined EAS what is the results
Hello, I need a high-quality, reliable, and well-coded Expert Advisor (EA) for MetaTrader 5. The code must be clean, without errors, and optimized for safe trading. The robot needs to trade based on basic technical indicators. Every trade must have a strict Stop Loss and Take Profit for risk management. Please apply only if you are an experienced MT5 developer with a high rating and clean coding history. Best