for(int i=OrdersTotal()-1;i>=0;i--){ OrderSelect(i,SELECT_BY_POS); if(OrderProfit()<=(-40)) OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),0,CLR_NONE); }//z
//z
Thank you!
I used the language editor and made this:
//+------------------------------------------------------------------+
//| zzuegg.mq4 |
//| Copyright © 2011, MetaQuotes Software Corp. |
//| http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link "http://www.metaquotes.net"
//+------------------------------------------------------------------+
//| expert initialization function |
//+------------------------------------------------------------------+
int init()
{
//----
for(int i=OrdersTotal()-1;i>=0;i--){
OrderSelect(i,SELECT_BY_POS);
if(OrderProfit()<=(-40)) OrderClose(OrderTicket(),OrderLots(),OrderClosePrice(),0,CLR_NONE);
}
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialization function |
//+------------------------------------------------------------------+
int deinit()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
//----
return(0);
}
//+------------------------------------------------------------------+
Thank you for your help.
pgodbold
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
You agree to website policy and terms of use
I want to set MLQ4 to automatically close any trade that reaches (-$40.00) in the Profit column on the Trade tab.
More info:
I use two EAs that trade multiple pairs and are attached one each to EURUSD and GBPUSD.
These EAs work well except one of them tends to let the Profit column fall below (-$90.00) before closing (using the Stop Loss setting)
I want to put in a setting that will close any trade that falls below (-$40.00) thereby overriding the Stop Loss of the EAs.
Is it possible for a newbie or anyone for that matter to do that in MLQ4?
Thank you