Hi, this is possible, just need add new condition to your EA. Regards Greg
//+------------------------------------------------------------------+ //| Get the array of profits/losses from deals | //+------------------------------------------------------------------+ bool GetTradeResultsToArray(double &pl_results[],double &volume) { //--- request the complete trading history if(!HistorySelect(0,TimeCurrent())) return (false); uint total_deals=HistoryDealsTotal(); volume=0; //--- set the initial size of the array with a margin - by the number of deals in history ArrayResize(pl_results,total_deals); //--- counter of deals that fix the trading result - profit or loss int counter=0; ulong ticket_history_deal=0; //--- go through all deals for(uint i=0;i<total_deals;i++) { //--- select a deal if((ticket_history_deal=HistoryDealGetTicket(i))>0) { ENUM_DEAL_ENTRY deal_entry =(ENUM_DEAL_ENTRY)HistoryDealGetInteger(ticket_history_deal,DEAL_ENTRY); long deal_type =HistoryDealGetInteger(ticket_history_deal,DEAL_TYPE); double deal_profit =HistoryDealGetDouble(ticket_history_deal,DEAL_PROFIT); double deal_volume =HistoryDealGetDouble(ticket_history_deal,DEAL_VOLUME); //--- we are only interested in trading operations if((deal_type!=DEAL_TYPE_BUY) && (deal_type!=DEAL_TYPE_SELL)) { continue; } //--- only deals that fix profits/losses if(deal_entry!=DEAL_ENTRY_IN) { //--- write the trading result to the array and increase the counter of deals pl_results[counter]=deal_profit; volume+=deal_volume; counter++; } } } //--- set the final size of the array ArrayResize(pl_results,counter); return (true); }

You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
Hi, for all coders out there.
I have a question. Is it possible to limit profit in an EA. By limiting I mean, lets just say that I want 100 pips per currencies in my EA and I want that EA to stop trading for the rest of the month after it reach that 100 pips. Is it possible to code that or is it impossible to do.
Thank you