[ARCHIVE] Any rookie question, so as not to clutter up the forum. Professionals, don't pass by. Nowhere without you - 3. - page 328

 
If there is no set of parameters from ФВ > 30, then the Expert Advisor is wasted.

How many EAs do you have with this PV and at the same time the number of trades is at least 200 (100 on Buy and 100 on Sell)?

If you set not only "net profit" parameter, but also "recovery factor" or the maximal drawdown - and look from these positions.

In MT5 such a thing is already available, very convenient and clear, but one cannot make "cuts" like in this program. Maybe you should ask the developers and they will do it...
 
FelixFX:

Hello!

I can't figure out how to make a custom function return multiple values? Could you give me a hint?



This is not Pascal - there are no procedures...:-) One function - one value...:-)

See the GetMarketInfo function of the script for closing all orders - using arrays is possible.

//+------------------------------------------------------------------+
//|                                               CloseAllOrders.mq4 |
//|                       Copyright © 2008, PRMQuotes Software Corp. |
//|                                           Jedimedic77@gmail.com  |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2008, PRMQuotes Software Corp."
#property link      ""
//+------------------------------------------------------------------+
//| EX4 imports                                                      |
//+------------------------------------------------------------------+
#include <stdlib.mqh>
//+------------------------------------------------------------------+
//| global variables to program:                                     |
//+------------------------------------------------------------------+
double Price[2];
int    giSlippage;
bool   CloseOpenOrders = true;
//+------------------------------------------------------------------+
//| script program start function                                    |
//+------------------------------------------------------------------+
void start() {
  int iOrders=OrdersTotal()-1, i;
  
  if(CloseOpenOrders) {
    for(i=iOrders; i>=0; i--) {
      if(OrderSelect(i,SELECT_BY_POS,MODE_TRADES) && (OrderType()<=OP_SELL) && GetMarketInfo() && !OrderClose(OrderTicket(),OrderLots(),Price[1-OrderType()],giSlippage)) Print(OrderError());
    }
  }
}
//+------------------------------------------------------------------+
//| Function..: OrderError                                           |
//+------------------------------------------------------------------+
string OrderError() {
  int iError=GetLastError();
  return(StringConcatenate("Order:",OrderTicket()," GetLastError()=",iError," ",ErrorDescription(iError)));
}
//+------------------------------------------------------------------+
//| Function..: GetMarketInfo                                        |
//+------------------------------------------------------------------+
bool GetMarketInfo() {
  RefreshRates();
  Price[0]=MarketInfo(OrderSymbol(),MODE_ASK);
  Price[1]=MarketInfo(OrderSymbol(),MODE_BID);
  double dPoint=MarketInfo(OrderSymbol(),MODE_POINT);
  if(dPoint==0) return(false);
  giSlippage=(Price[0]-Price[1])/dPoint;
  return(Price[0]>0.0 && Price[1]>0.0);
}
//+------------------------------------------------------------------+
 
Diubakin:

How many EAs do you have with this PV and at the same time you have at least 200 trades (100 for buying and 100 for selling)?

...

That's enough. FS = 34. And in fact, that's not the question you asked me...:-) Especially, if you read these branches - the author has clearly written there that these figures

30 for TC and 100 for the portfolio - his IMHO.... "Don't mince words, please. I didn't claim that's the way it should be. 30 is my personal whim. No more than that... "

 

Roman

...

Sorry, didn't notice you were quoting someone else, but the report is impressive.

 
Diubakin:

Sorry, didn't notice you were quoting someone else, but the report is impressive.


:-) Moving on...
 
                           ticket=OrderSend(Symbol(),OP_BUYSTOP ,0.01,Ask+q*Point,5,0,Ask+50*Point,"Aw",MN,0,CLR_NONE);
                           ticket=OrderSend(Symbol(),OP_SELLSTOP,0.01,Bid-q*Point,5,0,Bid-50*Point,"Aw",MN,0,CLR_NONE);
                           if (!ticket) Print(GetLastError());

                        ticket=OrderTicket();                           
                        for (i=OrdersTotal(); i>0;  i--)
                        {
                           if (OrderSelect(i,SELECT_BY_POS,MODE_TRADES)==true)
                           {
                              if (OrderComment()=="Aw")
                              {
                                 if (OrderType()==OP_BUYSTOP)
                                 {
                                    t=OrderModify(OrderTicket(),pb,0,TPb,0,CLR_NONE);
                                    if (!t) Print("BUY О Ш И Б К А = ",GetLastError());
                                 }
                                    
                                 if (OrderType()==OP_SELLSTOP)
                                 {
                                    t=OrderModify(OrderTicket(),ps,0,TPs,0,CLR_NONE);
                                    if (!t) Print("SELL О Ш Ы Б К А = ",GetLastError());
                                 }
                              }
                           }
                        }

please help!

The code opens two pending orders and should modify both...

But it only modifies the salt pending.

q=20;

pb=Ask+20*Point;

ps=Bid+20*Point;

Tb=Ask+50*Point;

Ts=Bid+50*Pointl;

 
smartemiy:

please help!

The code opens two pending orders and should modify both...

But it only modifies the salt pending.

q=20;

pb=Ask+20*Point;

ps=Bid+20*Point;

Tb=Ask+50*Point;

Ts=Bid+50*Point;

look at the numbers to see what you get

if (OrderType()==OP_BUYSTOP)
{
 t=OrderModify(OrderTicket(),pb,0,TPb,0,CLR_NONE);
 if (!t) Print("BUY О Ш И Б К А = ",GetLastError());
}
                                    
if (OrderType()==OP_SELLSTOP)
{
  t=OrderModify(OrderTicket(),ps,0,TPs,0,CLR_NONE);
 if (!t) Print("SELL О Ш Ы Б К А = ",GetLastError());
 }

you want to place both a buystop and a sellstop 20 points above the current price

 
ilunga:

see what you got with the numbers.

you want both buystop and sellstop to be 20 points above the current price

I typed it in by hand...

In the code it goes like this:

pb=Ask+20*Point;

ps=Bid-20*Point;

Tb=Ask+50*Point;

Ts=Bid+50*Point;

 
extern int variable = 0;
extern int shift = 0.0000;
extern int shift2 = 0.0000;
int init()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert deinitialisation function |
//+------------------------------------------------------------------+
int deinit()
{
//----

//----
return(0);
}
//+------------------------------------------------------------------+
//| expert start function |
//+------------------------------------------------------------------+
int start()
{
//----
SetLabel("MA_LABEL",DoubleToStr(iMA(Symbol(),15,variable,0,MODE_SMA,PRICE_CLOSE,0),shift,2),Bisque,735,277,0,14);
SetLabel("MA_LABEL2",DoubleToStr(iMA(Symbol(),15,variable,0,MODE_SMA,PRICE_CLOSE,0),shift2,2),Bisque,680,27 7,0,14)
//----
return(0);
}
//+------------------------------------------------------------------+


void SetLabel(string nm, string tx, color cl, int xd, int yd, int cr=0, int fs=9) {
if (ObjectFind(nm)<0) ObjectCreate(nm, OBJ_LABEL, 0, 0,0);
ObjectSetText(nm, tx, fs);
ObjectSet(nm, OBJPROP_COLOR, cl);
ObjectSet(nm, OBJPROP_XDISTANCE, xd);
ObjectSet(nm, OBJPROP_YDISTANCE, yd);
ObjectSet(nm, OBJPROP_CORNER, cr);
ObjectSet(nm, OBJPROP_FONTSIZE, fs);
}



more tips, please.
I can't get the vertical shift up and shift2 down indentation from the wrist.
this parameter should be set differently for each chart.
I get a compile-time error
 
smartemiy:

I typed it in by hand...

In the code it goes like this:

pb=Ask+20*Point;

ps=Bid-20*Point;

Tb=Ask+50*Point;

Ts=Bid+50*Pointl;

Tb and Ts in the sense of TPb and TPs? then again, went the same way, but the orders are different

take out all the values and see what you get

Reason: