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

 
Vit1986:

Made a demo account, downloaded quotes (SP500, RTSI, SBER etc). Created a trivial Expert Advisor. I have decided to test it. But it works perfectly on SP500 but it won't work with SBER or RTSI (it opens one order and then finishes its work) and does not show any error messages.


1) It looks more like a script than an EA.

2. Check the amount of money on the demo after you have moved twenty lots.

3. Try OrderSend(Symbol(),OP_BUY,0.1,Ask,3,Bid-MarketInfo(Symbol(),MODE_STOPLEVEL)*Point,Bid+MarketInfo(Symbol(),MODE_STOPLEVEL)*Point);

4. Add an error handler, at least a basic Alert (GetLastError());

5. Refer tomanual.

 

You can also play it safe and specify the data types explicitly:

int cmd = OP_SELL;//торговая операция
double volume = 0.1;//лот
int slippage = 2;//отклонение ордера в пипсах
double stoploss = 0;//лось
double takeprofit = 0;//профит

int start(){
   OrderSend(Symbol(),cmd,volume,Bid,slippage,stoploss,takeprofit); 
  return(0);
}
 
GaNDarM:

Why are the variables assigned zero in INIT()? What is the error or how to assign the buy and sell prices to variables outside of the start() function? I tried putting RefreshRates(); in front of them, but no change :(

Here is the code in indicator init():

init()
{
    Print ("Ask = ", Ask, " | Bid = ", Bid);
}

and here's the log:

2013.03.19 17:49:27     i-PSI@Dash Board EURUSD,M15: Ask = 1.2932 | Bid = 1.293

What are you "crying" about?

 
gyfto:

GaNDarM

The branch

thanks
 
TarasBY:

Here is the code in the indicator's init():

and here's the log:

What are you "crying" about???


I'm "crying" about it:

//---Ф-ЦИЯ init()----------------------------------------------------
int init()
  {
   RefreshRates();// обновляем данные по ценам
   UpL  =  Ask;     // Пик вверх изначально равен цене покупки
   DownL  =  Bid;     // Пик вниз изначально равен цене продажи
   Print ("СРАБОТАЛА Ф_ЦИЯ ИНИТ: DownL = ", DownL, " UpL = ", UpL);
   
   SetIndexStyle(0,DRAW_SECTION);     // стиль линии: отрезки между непустыми значениями
   SetIndexBuffer(0,ExtMapBuffer1);     // привязываем массив к номеру буфера
   SetIndexEmptyValue(0,0.0);     // указываем при каком значении не надо ничего рисовать
   //---
   
   return(0);
  }

and here's the log:

18:25:09 IndikatorZZ GBPJPY,Daily: INIT F_CY: DownL = 0 UpL = 0

 
Can you tell me.
If there is an intraday trade, does that mean that the trade is not carried over to the next day and is forced to close at the end of the day?
 

How many times have I used the autopoint, but the first time doesn't work.

Here is Init()

int init()
{
   if (Digits == 2 || Digits == 4)
     pt = Point;
   if (Digits == 1 || Digits == 3 || Digits == 5)
     pt = Point * 10;
 
  return (0);
}

I put it in any place of my program (in this case, even in the start for the experiment):

Print("ptStart = ", pt);
Print("PointStart = ", Point);

The function returns to the log:

2013.03.19 19:55:35     2013.01.11 00:00  TradingByLine EURUSD.GI,M5: Point = 0
2013.03.19 19:55:35     2013.01.11 00:00  TradingByLine EURUSD.GI,M5: pt = 0

Where is the logic?

 

Hello. Can you please tell me if the value " >= " in place of " = ". I remove the " <" or " >" and leaving only " =" it gives errors when compiling.

For example: my EA has (price >= MA) and I want (price = MA).ONLY EQUALLY

 
artemka_1981:

Hello. Can you please tell me if the value " >= " in place of " = ". I remove the " <" or " >" and leaving only " =" it gives errors when compiling.

For example: my EA has (price >= MA) and I want (price = MA).ONLY EQUALLY

==
 
TarasBY:
==

THANK YOU SO MUCH