[Archive!] Any rookie question, so as not to clutter up the forum. Professionals, don't pass it by. Couldn't go anywhere without you - 2. - page 400

 
Bihkul:

Can someone please tell me where to put the account number for the EA to work only on this account respectively.

int start()

{

if(AccountNumber()!=123) return(0);

Thank you in advance for your help.

 

Who can explain why in the code

int start() // Special function start
{
double proc=0;
int i; // Bar number
double Minimum=Bid, // Minimum price
Maximum=Bid; // Maximum price

for(i=0;i<=50-1;i++) // From zero (!) to.
{ // ...Quant_Bars-1 (!)
if (Low[i]< Minimum) // if < known
Minimum=Low[i]; // it will be min
if (High[i]> Maximum) // if > known
Maximum=High[i]; // it will be max
}

double seredina = (Minimum+Maximum)/2;
proc=(Maximum-Minimum);
Comment("Maximum price==",Maximum,
"\n", "Minimum price==",Minimum,
"\n", "middle==",seredina,
"\n", "Percent=30",proc);
return; // Exit start()

}

proc is equal to 300.0012 though proc is maximum minus minimum

with maximum correct, minimum correct, middle correct.

???????

However, if I make proc=2+2;

terminal replies with 304 !!!!! What's the problem ?????

 
VOLDEMAR:

"\n","Процент=30",proc);
return; // exit start()

At the same time, if I do proc=2+2;

the terminal replies with a 304 !!!!! What's the problem ?????

hilarious :)
 

Please tell me why tester doesn't optimize Expert Advisor

I select multiple input parameters, check a checkbox to optimize ... I press start Optimization ends quickly and gives me 1/1, the journal says There were 1 passes done during optimization, 1 results have neing discarded as insignificant

I tried it in 5 different broker terminals, please advise what i am doing wrong.

 
Hi all, Can you advise me, the task is to make PlaySound when an order with profit > 0 appears in histories. Apparently something like if ((OrderCloseTime == current time) &&(OrderProfit > 0)), but I cannot figure out how to write it (comparing close time to current time). Please help.
 
Pyro:
Hi all, Can you advise me, the task is to make PlaySound when an order with profit > 0 appears in histories. Apparently something like if ((OrderCloseTime == current time) &&(OrderProfit > 0)), but I cannot figure out how to write it (comparing close time to current time). Please help.
//ф-ция выдает время последнего закрытого ордера. при желании все действия можно провести здесь
datetime OrderCloseTime_() //void
  {
   datetime Time_=0;
   for(int i=0;i<OrdersHistoryTotal();i++)
     {
      if(OrderSelect(i,SELECT_BY_POS,MODE_HISTORY)==false)break;
      if(OrderSymbol()==Symbol())  //if(OrderProfit()>0)
        {
         if(OrderCloseTime()>Time_)Time_=OrderCloseTime();

        }
     }
     
   //if(Time_==Time[0]) PlaySound(....);  
   return(Time_);//
 }
 

You know, I've updated the initial sketches of the first chapter of the EA, and now the compiler swears, they are not balanced brackets, I do not know English, but it swears so

'\end_of_program' - ending bracket '}' expected C:³³ MF Trader 4\documents³experts³ for lavin.mq4 (59, 1)

'\end_of_program' - unbalanced left parenthesis C:\TradeForm MF Trader 4/CDocuments/experts/ for Levine.mq4 (59, 1)

It would be OK, the brackets are balanced, I am recalculating them one by one! Many times. 10 times on Friday, and three times today.

Folks, help!!! Either I'm stupid, or there's a deeper problem, please!

Code

//+------------------------------------------------------------------+
//|                                                    для лавин.mq4 |
//|                      Copyright © 2011, MetaQuotes Software Corp. |
//|                                        http://www.metaquotes.net |
//+------------------------------------------------------------------+
#property copyright "Copyright © 2011, MetaQuotes Software Corp."
#property link      "http://www.metaquotes.net"
extern double stoploss=0; extern double takeprofit=20;extern int otstup=20; extern datetime expiration=0;

//+------------------------------------------------------------------+
//| expert initialization function                                   |
//+------------------------------------------------------------------+
int init()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert deinitialization function                                 |
//+------------------------------------------------------------------+
int deinit()
  {
//----
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
//| expert start function                                            |
//+------------------------------------------------------------------+
 int tiket,tikett;double volume=0.1;int i=0,R1=0,R2=0,A=1 ;double price=PRICE_OPEN;
   //  R1=((PRICE_OPEN- stoploss*Point)*stoploss)/stoploss;R2=((PRICE_OPEN+ stoploss*Point)*stoploss)/stoploss;
     
     
int start()
  {       int X,Y; double price=(Ask+Bid)/2;            
//----
       Alert ("OrdersTotal()",OrdersTotal());

if(OrderSymbol()==Symbol()&&OrderMagicNumber( )==1000{
 for(int i=OrdersTotal();i==0;i--){
OrderSelect(i,SELECT_BY_POS );if(OrderType( )!=OP_BUYSTOP){X++}}};if (X==0){


   tiket= OrderSend( Symbol(), OP_BUYSTOP,  volume*A, price +otstup*Point, Point* 3, R1, price+takeprofit*Point+otstup*Point, "OP_BUYSTOP", 1000,  expiration, Red); 
   Alert ("OP_BUYSTOP", GetLastError( )); }
   
if( OrderMagicNumber( )==2000 &&OrderSymbol()==Symbol()&& OrderType( ) !=OP_SELLSTOP) { 
   tikett= OrderSend( Symbol(), OP_SELLSTOP,  volume*A, price -otstup*Point, Point* 3,R2, price-takeprofit*Point-otstup*Point, "OP_SELLSTOP" , 2000,  expiration,C'0,128,255' );
    Alert ("OP_SELLSTOP", GetLastError( )); 
    }       
   
//----
   return(0);
  }
//+------------------------------------------------------------------+
 
if(OrderSymbol()==Symbol()&&OrderMagicNumber( )==1000ТУТ надо закрыть скобку условия{


{X++;точка с запятой}
 
Jesus, must be a semicolon, brackets are balanced, there are exactly eight of them. I'll fix it.
 

Nah, moved the semicolon inside the brackets of course, it swears like this

'\end_of_program' - unbalanced left parenthesis C:\TradeFormat MF Trader 4\documents\experts\for the lavin.mq4 (59, 1)