The pending order is placed but does not live until it is activated (in the tester). I have tried to set a simple number in request.expiration but it does not work. I did not find any information on google. What is wrong with me? Why isn't the order being deleted after a certain period of time?
P.S. When displayed in Comment, DateExp() function shows date, time.
Приказы на проведение торговых операций оформляются ордерами. Каждый ордер имеет множество свойств для чтения, информацию по ним можно получать с помощью функций Идентификатор позиции, который ставится на ордере при его исполнении. Каждый исполненный ордер порождает сделку, которая открывает новую или изменяет уже существующую позицию...
structMqlTradeRequest
{
ENUM_TRADE_REQUEST_ACTIONS action; // Тип выполняемого действияulong magic; // Штамп эксперта (идентификатор magic number)ulong order; // Тикет ордераstring symbol; // Имя торгового инструментаdouble volume; // Запрашиваемый объем сделки в лотахdouble price; // Цена double stoplimit; // Уровень StopLimit ордераdouble sl; // Уровень Stop Loss ордераdouble tp; // Уровень Take Profit ордераulong deviation; // Максимально приемлемое отклонение от запрашиваемой ценыENUM_ORDER_TYPE type; // Тип ордераENUM_ORDER_TYPE_FILLING type_filling; // Тип ордера по исполнениюENUM_ORDER_TYPE_TIME type_time; // Тип ордера по времени действияdatetime expiration; // Срок истечения ордера (для ордеров типа ORDER_TIME_SPECIFIED)string comment; // Комментарий к ордеруulong position; // Тикет позицииulong position_by; // Тикет встречной позиции
};
Thanks, already found it myself, wanted to write that the question is removed. Before these, but I put, it turns out, wrong parameter request.type_time = ORDER_TIME_GTC; Corrected to request.type_time = ORDER_TIME_SPECIFIED; and everything works. But thank you very much for the feedback and the tip.
Alexey told you that you should first make your indicator at least just draw candles. As they are. At least on the current bar. If you manage to do it, consider that the first step to understanding has passed. But it is desirable not to try and find it by trying different parameters, but with your own mind.
What does this have to do with a priori? You really need it, since you cannot draw a candle with only four values.
Here I have written a very simple test indicator, that should draw 5 candles (real ones) from the USDJPY H8 chart
события Calculate для обработки изменений ценовых данных. Существуют два варианта функции, в пределах одного индикатора нельзя использовать оба варианта. [in] Размер массива price[] или входных таймсерий, доступных индикатору для расчета. Во втором варианте функции значение параметра соответствует количеству баров на графике, на котором он...
Vladimir, I've already understood that I was trying to draw from the leftmost edge. The test one is now drawing from the right edge
And the candlestick prices are real... And no ticks...
Take the example from the help! How many times? You don't have to use your own fictitious constructs if you don't understand their meaning. Use standard constructs - figure out how they work. After that, throw your constructs in the trash.
I can't advise you on anything. I don't use optimisation. I consider it quackery.
I disagree. Optimisation, in my opinion, is the selection of the most suitable parameters for a given pair and strategy.
P.S. Now the spreads seem to be normal.
I disagree.
I was not agitating you. Just giving my personal opinion.))
I was not agitating you. I just gave my personal opinion.))
Maybe my opinion is wrong. I am not agitating either.
Hello. Need some help. I need to limit the lifetime of a pending order, preferably in the number of bars. I have used the function in mql4:
where
extern intDate = 6; //number of bars of the order lifetime
Everything works.
I have tried something similar in mql5:
where
input int ExpDate = 6; //number of bars of the order lifetime
Then I tried it (the function shown above) to use it when placing a pending order, for example, to buy
The pending order is placed but does not live until it is activated (in the tester). I have tried to set a simple number in request.expiration but it does not work. I did not find any information on google. What is wrong with me? Why isn't the order being deleted after a certain period of time?
P.S. When displayed in Comment, DateExp() function shows date, time.
You forgot to specify:
You forgot to specify:
Thanks, already found it myself, wanted to write that the question is removed. Before these, but I put, it turns out, wrong parameter request.type_time = ORDER_TIME_GTC; Corrected to request.type_time = ORDER_TIME_SPECIFIED; and everything works. But thank you very much for the feedback and the tip.
Alexey told you that you should first make your indicator at least just draw candles. As they are. At least on the current bar. If you manage to do it, consider that the first step to understanding has passed. But it is desirable not to try and find it by trying different parameters, but with your own mind.
What does this have to do with a priori? You really need it, since you cannot draw a candle with only four values.
Here I have written a very simple test indicator, that should draw 5 candles (real ones) from the USDJPY H8 chart
It only draws those candlesticks, nothing more.
But when I run it, it just draws the damn thing...
So tell me, what am I doing wrong?
By the way, there is a typo in the documentation:
I wrote a very simple test indicator, which should draw 5 candlesticks (real ones) from USDJPY,H8 chart
It only draws these candlesticks, nothing more.
But when I run it, it just draws the damn thing...
How can I explain what I'm doing wrong?
By the way, there is a typo in the documentation:
In the debugger, check time[0] and answer the question: "Why are you trying to draw candlesticks from the LEFT FRONT of the chart?
I told you - use help for DRAW_CANDLES. Copy the example from the DRAW_CANDLES help. Figure it out. It's too early for you to get into ticks.
In the debugger check time[0] and answer the question: "Why are you trying to draw candles from the LEFT LEFT edge of the chart?
I told you - use help for DRAW_CANDLES. Copy the example from the DRAW_CANDLES help. Figure it out. It is too early for you to get into ticks.
Vladimir, I have already understood what I was trying to draw from the leftmost edge. The test one has the right edge.
And the candlesticks' prices are real... And no ticks...
Vladimir, I've already understood that I was trying to draw from the leftmost edge. The test one is now drawing from the right edge
And the candlestick prices are real... And no ticks...
Take the example from the help! How many times? You don't have to use your own fictitious constructs if you don't understand their meaning. Use standard constructs - figure out how they work. After that, throw your constructs in the trash.
And use 'MQL Wizard' to generate a template.
Code
and the result