alsu: It's not "should be of type double" but "will be stored in a global variable as double". Feel
Good afternoon. I tried to "feel the difference" and this is what came out of it... I.e. you can (with some stretch) REALLY define a GV-variable as follows. A GV-variable is a so to say "box" into which you can store a variable of any type (except string, because a GV-variable is of double type only, while the typecasting rule does not permit type reduction, i.e. you cannot make a string a double). And this variable, which we'll insert into a GV-variable, "will take the form of this box" (i.e. it will be casted from source type to double type)... Anyway, it's like this, isn't it?
Good Afternoon. The question is as follows. InS.K .'sMQL4book , inthe "Trading Operations" section, there is an example of a simple script that modifies a pending order whose declared price is higher than that of other pending orders(modifyorderprice.mq4) asfollows:
//--------------------------------------------------------------------// modifyorderprice.mq4 // Предназначен для использования в качестве примера в учебнике MQL4.//--------------------------------------------------------------- 1 --int start() // Спец.функция start
{
int Tral=10; // Дист. приближенияstring Symb=Symbol(); // Финанс. инструментdouble Dist=1000000.0; // Предустановкаdouble Win_Price=WindowPriceOnDropped(); // Здесь брошен скрипт//--------------------------------------------------------------- 2 --for(int i=1; i<=OrdersTotal(); i++) // Цикл перебора ордер
{
if (OrderSelect(i-1,SELECT_BY_POS)==true) // Если есть следующий
{ // Анализ ордеров://------------------------------------------------------ 3 --if (OrderSymbol()!= Symb) continue; // Не наш фин.инструм.if (OrderType()<2) continue; // Рыночный ордер //------------------------------------------------------ 4 --if(NormalizeDouble(MathAbs(OrderOpenPrice()-Win_Price),Digits)
< NormalizeDouble(Dist,Digits)) // Выбираем ближайший
{
Dist=MathAbs(OrderOpenPrice()-Win_Price);// Новое значениеint Tip =OrderType(); // Тип выбранного орд.int Ticket=OrderTicket(); // Номер выбранн. орд.double Price =OrderOpenPrice(); // Цена выбранн. орд.double SL =OrderStopLoss(); // SL выбранного орд.double TP =OrderTakeProfit(); // TP выбранного орд.
} // Конец if
} // Конец анализа ордера
} // Конец перебора орд.//--------------------------------------------------------------- 5 --if (Tip==0) // Если отложенных нет
{
Alert("По ",Symb," отложенных ордеров нет");
return; // Выход из программы
}
//--------------------------------------------------------------- 6 --while(true) // Цикл закрытия орд.
{
Or there is an error in this script in block 5-6, because (as I see it) the line
if (Tip==0) // Если отложенных нет
Should be of the form
if (Tip<2) // Если отложенных нет
since all types of non-pending (market) orders have type 0 or 1, i.e. less than 2.
Or have I misunderstood something.
Question: Could you please clarify: if I have misunderstood something, what is it?
Good afternoon. I have the following question. InS.K.' sMQL4book, inthe "Trading Operations" section, there is an example of a simple script that modifies a pending order whose declared price is closer to the point where the script is attached than the prices of other pending orders(
dear... don't write in such big letters here... you might break your eyes :-)
and that... before you ask questions... have you tried reading the BACKGROUND in MetaEditor? All of it?...for starters...so you don't ask stupid questions about types and stuff like that....
===
Type of operation for OrderSend() function. Can be any of the following values:
Question: how do we memorise the Criterion so that it holds a value of 1 or 2 (depending on the pass) until a new pass occurs and not reset on subsequent ticks .
It's not "should be of type double" but "will be stored in a global variable as double". Feel
Good afternoon. I tried to "feel the difference" and this is what came out of it... I.e. you can (with some stretch) REALLY define a GV-variable as follows. A GV-variable is a so to say "box" into which you can store a variable of any type (except string, because a GV-variable is of double type only, while the typecasting rule does not permit type reduction, i.e. you cannot make a string a double). And this variable, which we'll insert into a GV-variable, "will take the form of this box" (i.e. it will be casted from source type to double type)... Anyway, it's like this, isn't it?
Thank you in advance for your reply.Good Afternoon. The question is as follows. InS.K .'sMQL4book , inthe "Trading Operations" section, there is an example of a simple script that modifies a pending order whose declared price is higher than that of other pending orders (modifyorderprice.mq4) as follows:
Or there is an error in this script in block 5-6, because (as I see it) the line Should be of the form since all types of non-pending (market) orders have type 0 or 1, i.e. less than 2.Or have I misunderstood something.
Question: Could you please clarify: if I have misunderstood something, what is it?
Thank you in advance for your answer.
Good afternoon. I have the following question. InS.K.' sMQL4book, inthe "Trading Operations" section, there is an example of a simple script that modifies a pending order whose declared price is closer to the point where the script is attached than the prices of other pending orders(
Or there is an error in this script in block 5-6, because (as I see it) the lineshould look like
this because all types of non-pending (market) orders have type 0 or 1, i.e. less than 2.
Or I misunderstood something.
Question: could you please make me clear: if I misunderstood something, what
exactly?Thanks in advance for the answer
dear... don't write in such big letters here... you might break your eyes :-)
and that... before you ask questions... have you tried reading the BACKGROUND in MetaEditor? All of it?...for starters...so you don't ask stupid questions about types and stuff like that....
===
Type of operation for OrderSend() function. Can be any of the following values:
but as for the type - there's nothing wrong... exactly ==0 should be...
because in the 3rd block
market orders are skipped...
===
and if the pending orders are found in the order list, the TYPE variable will not equal 0
---
Good afternoon. Can you give me a hint?
For example, we have criterion for MA pass through Level_R and Level_S:
int Criterion; double MA_1=iMA(......,0); double MA_2=iMA(......,1); double MA_3=iMA(......,2);Question: how do we memorise the Criterion so that it holds a value of 1 or 2 (depending on the pass) until a new pass occurs and not reset on subsequent ticks .
Put the variable definition outside the Start or other function... Into global variables...