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

 
Techno:
you can. the usual expert/script

Maybe there is already something similar, can you tell me where to find it? Or know someone who can write one?

 

help please pro

The piece of code below doesn't work.

MA values are calculated and assigned to the MA variable

correctly, but they are not assigned to an array. The array is defined as double

dynamic. The print procedure prints null values for the array.

i=i_max; // ...calculate given number.

if (flag_NewBar==true) // recalculate only during the first tick arrival

{

while(i>=0) // loop on unread bars

MA=iMA(g_ext_smb,g_ext_TameFrame,g_ext_Period_MA,0,g_ext_Method,g_ext_PRICE,i);

MA=NormalizeDouble(MA,Digits);

mas_MA[i]=MA;

i--; }

 

I don't understand why there is an error 130? Please help.

Here's the code:

   double myPrice      = NormalizeDouble(Bid - 10*Pnt*10,Digits);
   double myTakeProfit = NormalizeDouble(myPrice + TakeProfit * Pnt*10,Digits);                                                     //
   if (RAVI0_2_24_D1 > 1 && RAVI0_2_24_D1 < 5 && RAVI0_2_24_D1_1 < RAVI0_2_24_D1 && RAVI0_2_24_D1_2 < RAVI0_2_24_D1_1 && RAVI0_2_24_D1_3 < RAVI0_2_24_D1_2) myTakeProfit = myTakeProfit + 25 * Pnt*10;
   double myStopLoss   = NormalizeDouble(myPrice - StopLoss * Pnt*10,Digits);
   datetime myTimeEnd  = TimeCurrent() + wait*60;
   Alert("OP_BUYLIMIT: Spread=",MarketInfo(Symbol(),MODE_SPREAD)," Stop=",DoubleToStr(MarketInfo(Symbol(), MODE_STOPLEVEL), 2)," lot=",DoubleToStr(lotMM,3)," Pr=",DoubleToStr(myPrice,6)," SL=",DoubleToStr(myStopLoss,6)," TP=",DoubleToStr(myTakeProfit,6));
   ticket=OrderSend(Symbol(),OP_BUYLIMIT,lotMM,myPrice,Slippage,myStopLoss,myTakeProfit,ExpertName, MagicNumber,myTimeEnd,myColor);

Purposely inserted Alert to see the problem, but I can't find it.

Here is Alert's message:

2010.12.13 12:39:36 2010.09.01 11:35 DVD 100-50 cent iK EURUSD,M1: OrderSend error 130

2010.12.13 12:39:36 2010.09.01 11:35 DVD 100-50 cent iK EURUSD,M1: Alert: OP_SELLLIMIT: Spread=1 Stop=10.00 lot=0.010 Pr=1.280300 SL=1.320300 TP=1.240300

 
VNG:

help please pro

The piece of code below doesn't work.

MA values are calculated and assigned to the MA variable

correctly, but they are not assigned to an array. The array is defined as double

dynamic. The print procedure prints null values for the array.

i=i_max; // ...calculate given number.

if (flag_NewBar==true) // recalculate only during the first tick arrival

{

while(i>=0) // loop on unread bars

MA=iMA(g_ext_smb,g_ext_TameFrame,g_ext_Period_MA,0,g_ext_Method,g_ext_PRICE,i);

MA=NormalizeDouble(MA,Digits);

mas_MA[i]=MA;

i--; }

IMHO arrays should have a certain size, except for arrays in indicators designed for "drawing". I think it should be inserted:
ArrayResize(mas_MA,i_max);
 
globad:

Folks, please advise! Is it possible to make a programme that gives a beep when the price passes 10-11p in 0.1-0.4s?

I suggest another way, 0.1-0.4s is about a tick, change asc the whole market overview per tick.
Files:
temp_4.mq4  4 kb
 
ikatsko:

I don't understand why there is an error 130? Please help.

Here's the code:

Purposely inserted Alert to see the problem, but I can't find it.

Here is Alert's message:

2010.12.13 12:39:36 2010.09.01 11:35 DVD 100-50 cent iK EURUSD,M1: OrderSend error 130

2010.12.13 12:39:36 2010.09.01 11:35 DVD 100-50 cent iK EURUSD,M1: Alert: OP_SELLLIMIT: Spread=1 Stop=10.00 lot=0.010 Pr=1.280300 SL=1.320300 TP=1.240300


Step by step, change stops take overshooting opening price (because the pendulum is lower from the price) to constants, find out almost where the error is.

From help "If the opening price of the pending order is incorrect, error 130 (ERR_INVALID_STOPS) will be generated".

ticket=OrderSend(Symbol(),OP_BUYLIMIT,1,Close[0]+DoubleToStr(MarketInfo(Symbol(), MODE_STOPLEVEL), 2)*2,15,0,0,ExpertName, MagicNumber,myTimeEnd,myColor);
 
VNG:

help please pro

The piece of code below doesn't work.

MA values are calculated and assigned to the MA variable

correctly, but they are not assigned to an array. The array is defined as double

dynamic. The print procedure prints null values for the array.

i=i_max; // ...calculate a given number.

if (flag_NewBar==true) // recalculate only during the first tick arrival

{

while(i>=0) // loop on unread bars

MA=iMA(g_ext_smb,g_ext_TameFrame,g_ext_Period_MA,0,g_ext_Method,g_ext_PRICE,i);

MA=NormalizeDouble(MA,Digits);

mas_MA[i]=MA;

i--; }

Read it

https://book.mql4.com/ru/operators/while

https://docs.mql4.com/ru/series/iBarShift

I would do this

if (flag_NewBar) // пересчитываем только во время прихода первого тика
 for(i=i_max;i>=0;i--) // Цикл по непосчитанным барам
    mas_MA[i]=NormalizeDouble(iMA(g_ext_smb,g_ext_TameFrame,g_ext_Period_MA,0,g_ext_Method,g_ext_PRICE,
                                                             iBarShift(g_ext_smb,g_ext_TameFrame,Time[i],false)),Digits);
if (flag_NewBar==true) // пересчитываем только во время прихода первого тика
while(i>=0){ // Цикл по непосчитанным барам
mas_MA[i]=NormalizeDouble(iMA(g_ext_smb,g_ext_TameFrame,g_ext_Period_MA,0,g_ext_Method,g_ext_PRICE,i),Digits);
i--; 
} 
 
tell me, how many eibars less than zero can be used to draw objects? what is the minimum?
 
costy_:

Step by step, change stops take overshooting opening price (as the pendulum is higher below the price) to constants, identify practically where the error is.

From help " Error 130 (ERR_INVALID_STOPS) will be generated if pending order open price is wrong".

Yes, UZH :) Indeed, the error is that the opening price of the pendent is close to the current price. Fixed it, got it working. THANK YOU

 
eddy:
tell me, how many eibarshifts less than zero can be used to draw objects? what is the minimum?

ebarshift is Searching for a bar by time (nothing will work).

in the terminal the last bar is 0, the time is linked to the bars, i.e. only this way to the future via strings

ObjectCreate("ff",OBJ_VLINE,0,StrToTime("2010.12.13 20:00"),0); //
Reason: