Download MetaTrader 5

Requests & Ideas - page 717

To add comments, please log in or register
alberto
753
alberto  
laden Rakic:
If you used indicator that you attached, save them without "_" in their names (replace "_" with " " - empty space) and it will work

Dear Mladen,

Some EAs do not react to optimization and produce no results (everything is done correctly)

What is the reason of this?

PS:
Some EAs do not produce optimization results outside of a certain time interval.
For example, some EAs produce results for up to 1 year, while 2-year optimization does not. I wonder why?

whroeder1
17527
whroeder1  
alberto: Some EAs do not react to optimization and produce no results (everything is done correctly)

The all produce results, in your case all losers. Right click -> show useless results and rerun.

alberto
753
alberto  
whroeder1:

The all produce results, in your case all losers. Right click -> show useless results and rerun.

As you mentioned, but the results are not shown!

Sometimes some EAs produce results but do not give results when you repeat the same test a second time, although all the settings are the same! 
Absolutely interesting!

lorenzo9530
20
lorenzo9530  

Add True/false option and Orders Total to EA



Hello everybody, actually I am using this EA to close at a profit level and deleting all Pending Orders placed left on Terminal.

It works perfectly but I would like to add this functions:


1) Delete Pending Orders    True/False options,to activate or de-activate


and a 


2)"Value of Total Orders" filter to  Close at profit:


Condition: if total orders open are >=  “value”   -----------------------> close (and delete)
 
                 if total orders open are   <  “value”   -----------------------> don't do anything
 
 
for Total Orders I mean:  if only  OP_SELL  or  only OP_BUY or (OP_SELL + OP_BUY) are >= of “Value”  still proceed to close ( and delete if activated) otherwise if < of “Value”  don't do anything.
 

ex. : 1 lot OP_BUY + 0.8 lot OP_SELL + 2.5 lot OP_BUY = 3 orders    --------> enable to close (and delete)




This is the code actually I am using.


                                      

extern double My_Money_Profit_Target=100;     //The amount of money profit at which you want to close ALL open trades.
extern string Profit_Target= "Enter above To Close all OPEN trades when amount of profit is Reached in Account and not per OPEN trade! ";
                                         
int Slippage=5;
int i;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
  
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+


int start()
{
if (AccountProfit()>= My_Money_Profit_Target)
   {
    for(i=OrdersTotal()-1;i>=0;i--)
       {
       OrderSelect(i, SELECT_BY_POS);
       int type   = OrderType();
              
       bool result = false;
             
       switch(type)
          {
          //Close opened long positions
          case OP_BUY  : result = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_BID),Slippage,Blue);
                         break;
              
          //Close opened short positions
          case OP_SELL : result = OrderClose(OrderTicket(),OrderLots(),MarketInfo(OrderSymbol(),MODE_ASK),Slippage,Red);
      
        break;
                     
            //Close pending orders
      case OP_BUYLIMIT  :
      case OP_BUYSTOP   :
      case OP_SELLLIMIT :
      case OP_SELLSTOP  : result = OrderDelete( OrderTicket() );

              
          }
         
       if(result == false)
          {
            Sleep(0);
          } 
       }
      Print ("Account Profit Reached. All Open Trades Have Been Closed");
      return(0);
   } 
  
   Comment("Balance: ",AccountBalance(),", Account Equity: ",AccountEquity(),", Account Profit: ",AccountProfit(),
           "\nMy Account Profit Target: ",My_Money_Profit_Target);
  
  return(0);
}


Many many thanks for your precious time.


Greetings, Lorenzo
Eleni Anna Branou
Moderator
5150
Eleni Anna Branou  

Please use the </> button to insert your code.


lorenzo9530
20
lorenzo9530  
Eleni Anna Branou:

Please use the </> button to insert your code.

Hello, post updated thanks :-)


Alain Verleyen
Moderator
36051
Alain Verleyen  
lorenzo9530:
And please don't answer inside the quote.
alberto
753
alberto  

Dear friends,
The attachment indicator does not work correctly or does not work on the latest version mt4.
I am very happy if you are to solve the problem.

Best.

Files:
Mladen Rakic
78898
Mladen Rakic  
alberto:

Dear friends,
The attachment indicator does not work correctly or does not work on the latest version mt4.
I am very happy if you are to solve the problem.

Best.

It works - change the step size from 0 to some other number - the "automatic" mode is messed up though
alberto
753
alberto  
Mladen Rakic:
It works - change the step size from 0 to some other number - the "automatic" mode is messed up though

Dear Mladen,
Sorry but I did not understand it clearly and that's why I have some questions.

1- Is  "0" automatic mode?
(If "0" automatic mode does this mode work correctly or not?)

2- "​​0" is auto mode, but it works wrong! Therefore, we must write values ​​greater than 0 here. (Is this argument correct?)

To add comments, please log in or register