[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 363

 
What is this button?
 
Pr0t0tip:

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);

Well, look - at a glance - right there on this line:

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

You, as in Short, add to Bid+sl for Stop-Loss and subtract from Bid-tp for Take-Profit. And on the contrary, you need to subtract SL from Bid - for a stop loss, and add TP to Bid - for a profit.

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

I think it should work. Try it.

And you can see how nice and easy it is to read the code, when it is inserted using SRC.

 
Pr0t0tip:
What is this button?
It's where you write the text in the box, at the top there are buttons that you use to make the text. One of them is the SRC button. It's next to the camera.
 
Thank you, it all worked out. Only the advisor is pouring, but that's not the main thing at this stage.
 
Dimka-novitsek:

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) means
relative return(errorcomment);?

I don't quite understand - was it a question or was it an answer?

I'm going to skip the first line since it's not quite clear at all.

And about the 2nd point (if it was a question) - it's swearing that the bracket type is incompatible. Probably, somewhere the bracket is round instead of square (or curly).

 

Good day! Please help!

I want to write a function that would return the type of position opened based on Bid prices.

If some amount of Bid prices constantly goes up - type Bcu and vice versa.

I tried it myself, but it always returns 0.

//+----------------------------------------------------------------------------+ 
//|  Описание : Возвращает тип открываемой позиции.                            |
//+----------------------------------------------------------------------------+
//|  Параметры:                                                                |
//|    sy - наименование инструмента   (""   - любой символ,                   |
//|                                     NULL - текущий символ)                 |
//|                                                                            |
//|                                                                            |
//|  Глобальные переменные:     NAME_OP - тип открываемой позиции              |
//|                             BID[]   - массив цены BID                      |
//+----------------------------------------------------------------------------+
int NamePositions(string sy="") 
{
int Kol_Tikov=6;
ArrayResize(BID,Kol_Tikov);
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
   if (sy=="0") sy=Symbol();
   {
   for(int i=Kol_Tikov-1;i>0;i--)
         BID[i]=BID[i-1];
         BID[0]=NormalizeDouble(MarketInfo(sy,MODE_BID),5);
         
         if (BID[3]>BID[2] && BID[2]>BID[1]) NAME_OP=OP_SELL;
         if (BID[3]<BID[2] && BID[2]<BID[1]) NAME_OP=OP_BUY;
   }
   return(NAME_OP);
}
 
NICK_R:

Good day! Please help!

I want to write a function that would return the type of position opened based on Bid prices.

If some amount of Bid prices constantly goes up - type Bcu and vice versa.

I tried it myself, but it always returns 0.


 

It used to be like this: in the tester, you tick OPTIMIZE and a window appears with all your EXTERNAL variables. you specify the min, max and step. that's it.

Now I tick the box...and nothing happens.

can you tell me where the parameter and pitch window is?

 
lottamer:

It used to be like this: in the tester, you tick OPTIMIZE and a window appears with all your EXTERNAL variables. you specify the min, max and step. that's it.

but now I tick it...and nothing happens.

can you tell me where the parameter and pitch window is?

When in the tester, go into the EA settings - there are 4 columns. The 1st column is what will just work without optimisation. The 2nd column is the initial parameters for optimisation, the 3rd column is the step and the 4th column is the end of optimisation.
 
Chiripaha:
When in the tester, go to EA settings - there are 4 columns. 1st column is what will just work without optimisation. 2nd column is initial parameters for optimisation, 3rd column is step and 4th column is end of optimisation.


I only see the EXPERT PROPERTIES in the tester. I do not see Expert Advisor settings. Where are they ?

there is nothing like that in the properties. build 500

Reason: