Questions from Beginners MQL4 MT4 MetaTrader 4 - page 111

 
Artyom Trishkin:

Thank you, that helps.

If it's not too much trouble, can you explain why my option doesn't work, the help says 0 and 0 - current symbol and current time frame???

 
Cyn123:

Thank you, that helps.

If it's not too much trouble, can you explain why my option doesn't work, the help says 0 and 0 - current symbol and current time frame???

NULL and 0

 
Artyom Trishkin:

Thank you!

 

Help! I'm making a trailing stop and I can't figure out where to put STEP for it. Please see....


if(OrdersTotal() > 0)

{

for(int pos = 0; pos < OrdersTotal(); pos ++)

{

OrderSelect(pos, SELECT_BY_POS, MODE_TRADES);

if(OrderMagicNumber() == Magic && OrderSymbol() == Symbol() && OrderType() == OP_BUY &&

NormalizeDouble(Ask - sl, Digits) > NormalizeDouble(OrderStopLoss(), Digits) && NormalizeDouble(Ask - sl, Digits) < NormalizeDouble(Bid, Digits))

OrderModify(OrderTicket(), 0, Ask - sl, 0, 0, Green);

else if(OrderMagicNumber() == Magic && OrderSymbol() == Symbol() && OrderType() == OP_SELL &&

NormalizeDouble(Bid + sl, Digits) < NormalizeDouble(OrderStopLoss(), Digits) && NormalizeDouble(Bid + sl, Digits) > NormalizeDouble(Ask, Digits))

OrderModify(OrderTicket(), 0, Bid + sl, 0, 0, Red);

}

 

there are the following dates:

trading sessions time zone DST on/of session opening migration to summer season migration to winter season
month week day month week day
Tokyo 9 false (1) 9 -1 -1 -1 -1 -1 -1
London 0 true (0) 8 3 0 (env.) 0 (Sunday) 10 0 (env.) 0 (sunday)
New York -5 true (0) 8 3 2 0 (Sunday) 11 1 0 (Sunday)


How can I populate array [tor.session][timezone][DST on/of][open][month][week][day][month][week][day] with these input parameters?

 

We need to remove b value (-1) from newarray[a] , then set the new size of array newarray[a-b].

Please tell me how to do it

 
Kamol Kurbonov:

We need to remove b value (-1) from newarray[a] , then set the new size of array newarray[a-b].

Please tell me how to do it

You go through the array and see the value of ArrayMove and ArrayResize. See example on this page.
 
Kamol Kurbonov:

there are the following dates:

trading sessions time zone DST on/of session opening migration to summer season migration to winter season
month week day month week day
Tokyo 9 false (1) 9 -1 -1 -1 -1 -1 -1
London 0 true (0) 8 3 0 (env.) 0 (Sunday) 10 0 (env.) 0 (sunday)
New York -5 true (0) 8 3 2 0 (Sunday) 11 1 0 (Sunday)

How can I populate array [tor.session][timezone][DST on/of][open][month][week][day][month][week][day] with these input parameters?

An array is a union of elements with the same attributes (remember: forest array, dwelling array). you have different attributes: string + bool + integer. The solution is to describe a structure and an array of structures. Or 10 arrays.
 
Дед пенсионер:
An array is a union of elements with the same attributes (remember: forest array, dwelling array). you have different attributes: string + bool + integer. The solution is to describe a structure and an array of structures. Or 10 arrays.
trade sessions can be marked with an integer (e.g. i=1 (Tokyo, i=2 London). bool value will also return an integer (0 if tru. 1 if fals) Most importantly, all data types can be converted to a single type (double).
 

Hello. I wrote in my EA the calculation of the lot like this:

lot=NormalizeDouble(AccountBalance()*risk/(SL*MarketInfo(Symbol(),MODE_TICKVALUE)),2);

The purpose is to get the correct lot size regardless of the account currency and pair for the specified risk and stop loss. Risk is set as a percentage of losses when Stop Loss is triggered. Stop Loss SL in pips (where pips is the smallest possible change in the price of the pair). I am going to start this EA on a real account. But I have my doubts. If somebody from more experienced programmers tell me what kind of errors may occur, I will be very grateful.