[ARCHIVE]Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Can't go anywhere without you - 5. - page 361

 
how to optimise a parameter if it is inside a user function?
 

What does it mean to optimise? Together with the robot in the tester, optimise.

Could you tell me what '(' - incompatible types C:\Documents and Settings\User\My Documents\FxClub\TeleTRADE\experts\Constructor.mq4 (68, 39)
relative return(errorcomment);?

 
lottamer:
how to optimise a parameter if it is inside a user function?

Put it in extern
 

I'm trying to compile the code, which was kindly suggested to me by FAQ.

But the compiler resists and asks for a semicolon after the assignment operator (highlighted in yellow).

'bool' - semicolon expected C:\Program Files\Alpari NZ MT4\experts\GRAAL-1.mq4 (5, 3)

But I have them there .... and it still asks, asks, asks...... and asks....

Tell me what he means?

THANK YOU.

  int start()
  
  bool have = true ;
        
  for(int i=0;i<10;i++)
  {

   if(Low[i]<=Low[i+1])
   {have=false; 
   break;} 

} 

if(have == true )
{

OrderSend(Symbol(),OP_SELL,0.1,Bid,1,Ask+1500*Point,Ask-1510*Point,"jfh",123 );// действия если условие соблюдено 

}
else
{

 return(0);
}
 

I came across this in one of the codes:

if (StringSubstr(AccountCurrency(), 0, 3) == "JPY") 
    {
      ld_24 = MarketInfo("USDJPY" + StringSubstr(Symb, 6), MODE_BID);
      if (ld_24 > 0.1) ld_16 = ld_24;
      else ld_16 = 82;
    }

Can you tell me what this is used for? - I assume since it mentions the currency of the account, there should be a conversion factor to the other currency. But... why is it fixed? - What does this coefficient depend on? - In this case the number is 82.

And this line looks interesting - its meaning I don't understand at all:

MarketInfo("USDJPY" + StringSubstr(Symb, 6), MODE_BID)

because if you add "EURUSD" to "USDJPY", for example, but for the 6th letter, you get zero - then why add it at all? Hmmm...

It's some gibberish for me to understand, but for experience I would like to understand the principle of conversion from one currency to another. And I think, if people use it (in my practice I don`t have non-dollar accounts), it`s not because of stupidity. It means that it makes sense.

Thanks for the clarification! I think it will be interesting not only for me. : ))

 

Hello. I have written a simple EA (trying to learn it myself). The robot only opens trades to sell, but does not want to buy. I understand I did not spell the buy conditions correctly or did not divide them properly. I am asking for help. Here it is:

extern int tp=100;

extern int sl=100;

extern int H=14;

extern int M=00;

double ma1, ma2;

int start()

{

ma1=iMA (NULL,0,18,0,MODE_SMA,PRICE_CLOSE,0);

ma2=iMA (NULL,0,36,0,MODE_SMA,PRICE_CLOSE,0);

if (OrdersTotal ()==0 && iStochastic (NULL,0,50,30,3,0,1,MODE_MAIN,4)<iStochastic (NULL,0,50,30,3,0,1,MODE_SIGNAL,4) && ma1<ma2)

OrderSend ("EURUSD", OP_SELL,0.1,Bid,0,Ask+sl*Point,Ask-tp*Point,",123,Red);

if (OrdersTotal ()==0 && iStochastic (NULL,0,50,30,3,0,1,MODE_MAIN,4)>iStochastic (NULL,0,50,30,3,0,1,MODE_SIGNAL,4) && ma1>ma2)

OrderSend ("EURUSD", OP_BUY,0.1,Ask,0,Bid+sl*Point,Bid-tp*Point,",123,Red);

}

return (0);

 
r772ra:

Put it in extern


How to do it?

The function modifies the order by setting stops and takei. here they need to be optimised.

 
solnce600:

I'm trying to compile the code, which was kindly suggested by FAQ.

But the compiler resists and asks for a semicolon after the assignment operator (highlighted in yellow).

'bool' - semicolon expected C:\Program Files\Alpari NZ MT4\experts\GRAAL-1.mq4 (5, 3)

But I have them there .... and it still asks, asks, asks...... and asks....

Tell me what he means?

THANK YOU.

Alternatively, the semicolon just above the code somewhere else has not been put. The compiler just says it's missing somewhere up to this point.

And this code seems to have all the punctuation correct.

 
Chiripaha:

Alternatively, a semicolon is missing somewhere in the code. The compiler just says there is a semicolon missing somewhere up to this point.

But this code seems to have all the punctuation correct.


And above there is only START and nothing else.
  int start()
  
  bool have = true;
  {
  for(int i=0;i<10;i++)
  {

   if(Low[i]<=Low[i+1])
   {
   have=false; 
   break;
   } 

} 

if(have )
{

OrderSend(Symbol(),OP_SELL,0.1,Bid,1,Ask+1500*Point,Ask-1510*Point,"jfh",123 );// действия если условие соблюдено 

}
else
{

 return(0);
}
 
lottamer:


How can this be done?

the function modifies the order by setting stops and takeovers. so they need to be optimised.


Well, exactly in code of Pr0t0tip (well, and nickname - I got tired to retype : )) ) These variables extern int sl=100; (etc.) are mapped. So you need to declare a variable, then it will appear in owl settings, then its value can be changed and optimized.