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

 
skyjet:
Good evening! Could you please tell me if I have implemented correctly the start() function of an indicator in an EA? The compilation does not agree!


Well, so many sevens just can't be wrong, it's a JACK-POT!!!

But seriously, the description of the problem is obviously incomplete, you should go to the Telepath Club. Or describe in more detail what is wrong, a list of compiler errors, for example.

 
evillive:


Well, that many sevens just can't be wrong, it's a JACK POINT!!!

But seriously, the description of the problem is obviously incomplete, you should go to the Telepath Club. Or describe in more detail what is wrong, list of compiler errors for example.


At first I got this error:

'\end_of_program' - ending bracket '}' expected C:\Program Files\Alpari \experts\xxx.mq4 (305, 1)

Of course I added a parenthesis, after that :

'Ind_Start' - function is not defined C:\Program Files\ Alpari \experts\xxx.mq4 (86, 1)

'{' - semicolon expected C:\Program Files\ Alpari \experts\xxx.mq4 (87, 3)

 
skyjet:
Good evening, can you tell me if I have correctly prescribed the start() function of an indicator in my EA? The compilation does not agree!
int start()
{

int varGet_Indicator_start = funcGet_Indicator_start();

return();
  
}


int funcGet_Indicator_start()

{
77777777777777777777777777777
77777777777777777777777777
777777777777777777777777777777
и чтоб возвращало int!!!
}


it should be so agree

 

Help, the indicator doesn't work. What did I write wrong?

//-----
  int i,limit;
  int counted_bars=IndicatorCounted();
  if (counted_bars>0) counted_bars--; 
  limit=Bars-counted_bars;
//-----
   for(i=limit; i>=0; i--)
  {SMMA[i]=iMA(NULL,0,TrixPeriod,0,MODE_SMMA,PRICE_CLOSE,i);}
//-----
  for(i=limit; i>=0; i--)
  {EMAOnArray[i]=iMAOnArray(SMMA,0,TrixPeriod,0,MODE_EMA,i);}
//-----
  for(i=limit; i>=0; i--)
  {SMMAOnArray[i]=iMAOnArray(EMAOnArray,0,TrixPeriod,0,MODE_SMMA,i);}
//-----
  for(i=limit; i>=0; i--)
  {Trix[i]=(SMMAOnArray[i]-SMMAOnArray[i+1])/SMMAOnArray[i];}
//-----
  for(i=limit; i>=0; i--)
  {Signal[i]=iMAOnArray(Trix,0,SignalPeriod,0,MODE_EMA,i);}       
//-----
  for(i=limit; i>=0; i--)
  {Histogram[i]=Trix[i]-Signal[i];}
//-----
 

Please advise me!

Suppose I have several open positions in the terminal and I need to know the opening price of one of the orders, say BUY, I also know the magic of each order?

How do I do that?

 
artem86:

Please advise me!

Suppose I have several open positions in the terminal and I need to know the opening price of one of the orders, say BUY, I also know the magic of each order?

How do I do that?

//+------------------------------------------------------------------+
//|--------------------// Last Bull Open Price //--------------------|
//+------------------------------------------------------------------+
double LastBullOpenPrice()
{
  double MyLastBullOpenPrice=0;
  for(int Cnt=0;Cnt<OrdersTotal();Cnt++)
  { 
    OrderSelect(Cnt,SELECT_BY_POS,MODE_TRADES);
    if(OrderMagicNumber()==Magic && OrderType()==OP_BUY)
    {
      MyLastBullOpenPrice=OrderOpenPrice();
    }
  }
  return(MyLastBullOpenPrice);
}

 

Good afternoon!

Could you please tell me how to write:

if ((b1!=0) && (b2==0))

openBuy(Lot,Magic);

if ((b1==0) && (b2!=0))

closeAll();

if ((s1!=0) && (s2==0))

openSell(Lot,Magic);

if ((s1==0) && (s2!=0))

closeAll();

but orders won't open so help me to find the reason

Files:
 
ll77012:

Good afternoon!

Could you please tell me how to write:

if ((b1!=0) && (b2==0))

openBuy(Lot,Magic);

if ((b1==0) && (b2!=0))

closeAll();

if ((s1!=0) && (s2==0))

openSell(Lot,Magic);

if ((s1==0) && (s2!=0))

closeAll();

but orders don't open so please help me to find the reason


https://book.mql4.com/ru/trading/ordersend

Everything is very clear and detailed.

 
something is wrong with the condition and it is not called
 
ll77012:

Good afternoon!

Could you please tell me how to write:

if ((b1!=0) && (b2==0))

openBuy(Lot,Magic);

if ((b1==0) && (b2!=0))

closeAll();

if ((s1!=0) && (s2==0))

openSell(Lot,Magic);

if ((s1==0) && (s2!=0))

closeAll();

but orders won't open so help me to find the reason


indicator buffer=EMPTY_VALUE; not equal to 0, but equal to 2147483647.
Reason: