[WARNING CLOSED!] Any newbie question, so as not to clutter up the forum. Professionals, don't go by. Can't go anywhere without you. - page 45

 
xruss писал(а) >>

To xrust:

))

but if i don't use magic number - what should i write instead?

either == 0, or remove that line

 

1, what is an EA ?

2, how to use it,

3, does it really trade by itself? if so, how to use it,

4, if i run it via strategy tester, how do i decrypt the output there (chart.... etc.) and how do i use it in trading.


Please answer these 4 questions =(

 

Hello!


Please help me with advice or a solution. I'm trying to get the Expert Advisor to give a signal when the previous bar "absorbs" the previous one.

1 - if absorption occurred upwards
2 - if absorption occurred downwards.

I think everything is elementary, compare prices open and close and voila ... but it's not. When I hover my mouse over the previous 2 bars, it's clear that the last one is eating the penultimate one.

Very much hope for help, and thank you in advance


Here is the text:

int start()
{
//----
if (SShort()==1)
Alert("1");
}
if (SLong()==1)
Alert("2");
}
//----
return(0);
}
//+------------------------------------------------------------------+
int SShort()
{int MS=0;
if (Open[1]>Close[2] && Close[1]<Open[2] && Open[1]>Close[1] && Open[2]<Close[2])
MS=1;
return(MS);
}
//+------------------------------------------------------------------+
int SLong()
{
int ML=0;
if(Open[1]<Close[2] && Close[1]>Open[2] && Open[1]<Close[1] && Open[2]>Close[2])
ML=1;
return(ML);
}

//+------------------------------------------------------------------+


The picture shows the principle of absorption. Thanks in advance.

I am not sure what I am looking for. Only the absorption of the candlestick body is meant.

 
if (Open[1]>Close[2] && Close[1]<Open[2] && Open[1]>Close[1] && Open[2]<Close[2])

replace with

if (Open[1]>Close[2] && Close[1]<Open[2] && Open[1]<Close[1] && Open[2]>Close[2])
and in the second case also
 
DrShumiloff >> :

Forgive me, but it is not at all clear what is meant by this page....??????????

 
You have one variable declared and then try to use another.
 
xrust >> :

either == 0, or get rid of that line.

one more question - help please)

How do I define the order type (was the order closed by Buy or Sell)?

 

Hello!

Can you advise a newbie? How to prescribe an indicator line in an EA, not the position relative to another line < & >, but its movement up or down. I understand that one variable should show the rebound, and the other is responsible for the fall.

Thanks in advance.

 
564947 >> :

Hello!

Some advice for a beginner. How to prescribe the line of indicator in the expert advisor, not the position relative to another line < & >, but its movement up or down. I understand that one variable should show the rebound, and the other is responsible for the fall.

Alternatively ;)

Write a function that detects whether the line is going up or down and returns +1 or -1 depending on that.

Call this function in your EA and get the answer you need.

//+----------------------------------------------------------------------------+
//|  Функция определения тренда                                                |
//|  Параметры:                                                                |
//|    line0   - значение линии на нулевом (расчетном) баре                    |
//|    line1   - значение линии на первом  (предыдущем) баре                   |
//|  Возвращаемое значение                                                     |
//|  +1       - линия идет вверх,   тренд положительный                        | 
//|  -1       - линия идет вниз,    тренд отрицательный                        | 
//|   0       - линия горизонтальна,тренд нулевой                              | 
//+----------------------------------------------------------------------------+
int GetTrend(double line0, double line1) {
  int res=0;
  
  if ( line0> line1)
      res=1;
  if ( line0< line1)
      res=-1; 
 
  return(res);   
}

int start() {

//---на примере МА  
//---получение значение линии МА на нулевом и первои баре  
  double ma0=iMA(NULL,0, MAperiod,0,MODE_EMA,PRICE_CLOSE,0);
  double ma1=iMA(NULL,0, MAperiod,0,MODE_EMA,PRICE_CLOSE,1); 
//---расчет тренда
  if( GetTrend( ma0, ma1)>0)
      Comment("  Линия идет вверх, тренд положительный!");
  if( GetTrend( ma0, ma1)<0)
      Comment("  Линия идет вниз, тренд отрицательный!");    
   
  return(0) 
}
 
granit77 писал(а) >>

Alternatively: :))

Write a function that determines whether the line is going up or down, and depending on this, returns +1 or -1.

Call this function in your EA and get the right answer.

Thank you!

Can I also give a name to the line? Indicator "ADX", Line ADX -(ADXZ-positive, ADXz-negative) Line+DI-(pDIR-positive, pDIr-negative), Line -DI (mDIB-positive, mDIb-negative) i.e. two variables per line, already for further location. For example( ADXz && pDIR >mDIb)

Reason: