Hello - in reviewing the event-handler code more closely, I noticed that you use different methods to parse out the source of the event... in some cases it's based on the chart event id parameter from OnChartEvent()while in others you extract it from the lparam parameter via engine.EventSource(lparam) -- is there a particular reason why it is different in each case?
ORDER_FILLING_FOK - This filling policy means that an order can be filled only in the specified amount. If the necessary amount of a financial instrument is currently unavailable in the market, the order will not be executed. The required volume can be filled using several offers available on the market at the moment.
ORDER_FILLING_IOC - This mode means that a trader agrees to execute a deal with the volume maximally available in the market within that indicated in the order. In case the entire volume of an order cannot be filled, the available volume of it will be filled, and the remaining volume will be canceled.
ORDER_FILLING_RETURN - This policy is used only for market orders (ORDER_TYPE_BUY and ORDER_TYPE_SELL), limit and stop limit orders (ORDER_TYPE_BUY_LIMIT, ORDER_TYPE_SELL_LIMIT, ORDER_TYPE_LIMIT_STYPELL) In case of partial filling a market or limit order with remaining volume is not canceled but processed further. For the activation of the ORDER_TYPE_BUY_STOP_LIMIT and ORDER_TYPE_SELL_STOP_LIMIT orders, a corresponding limit order ORDER_TYPE_BUY_LIMIT / ORDER_TYPE_SELL_LIMIT with the ORDER_FILLING_RETURN execution type is created.
You need to set the correct order execution policy yourself (ENUM_ORDER_TYPE_FILLING). Use for this in the OnInit () handler:
There are only three possible values:
ORDER_FILLING_FOK - This filling policy means that an order can be filled only in the specified amount. If the necessary amount of a financial instrument is currently unavailable in the market, the order will not be executed. The required volume can be filled using several offers available on the market at the moment.
ORDER_FILLING_IOC - This mode means that a trader agrees to execute a deal with the volume maximally available in the market within that indicated in the order. In case the entire volume of an order cannot be filled, the available volume of it will be filled, and the remaining volume will be canceled.
ORDER_FILLING_RETURN - This policy is used only for market orders (ORDER_TYPE_BUY and ORDER_TYPE_SELL), limit and stop limit orders (ORDER_TYPE_BUY_LIMIT, ORDER_TYPE_SELL_LIMIT, ORDER_TYPE_LIMIT_STYPELL) In case of partial filling a market or limit order with remaining volume is not canceled but processed further. For the activation of the ORDER_TYPE_BUY_STOP_LIMIT and ORDER_TYPE_SELL_STOP_LIMIT orders, a corresponding limit order ORDER_TYPE_BUY_LIMIT / ORDER_TYPE_SELL_LIMIT with the ORDER_FILLING_RETURN execution type is created.
Allow the use of cookies to log in to the MQL5.com website.
Please enable the necessary setting in your browser, otherwise you will not be able to log in.
You are signed in. Two-factor authentication has been disabled. Set it up again and scan a new QR code, or continue with two-factor authentication disabled.
Hello - in reviewing the event-handler code more closely, I noticed that you use different methods to parse out the source of the event... in some cases it's based on the chart event id parameter from OnChartEvent()while in others you extract it from the lparam parameter via engine.EventSource(lparam) -- is there a particular reason why it is different in each case?
Hi Artyom - can you clarify this for me, please?
Please, a little later - very busy for now
Hi Artyom,
In your example, pending orders worked but market orders did not work in visual backtest mode
Please help, thank you very much
Jewel
Hi Artyom,
In your example, pending orders worked but market orders did not work in visual backtest mode
Please help, thank you very much
Jewel
I checked it - it works. Positions are opened in the tester. And they close too.
Write in more detail what you are doing.
Thank you very much
Большое спасибо
What is written in the "Journal" tab?
Everything is working:
I'm just like you, why doesn't it work? Do you try on mt4 or mt5? I try on mt5, here you:
2021.04.11 14:29:21.646 2017.01.02 09:01:18 failed market sell 0.1 GBPUSD sl: 1.23561 tp: 1.23261 [Unsupported filling mode]
2021.04.11 14:29:21.646 2017.01.02 09:01:18 Trading attempt #2. Error : Invalid order filling type
Thank you very much
Jewel
I'm just like you, why doesn't it work? Do you try on mt4 or mt5? I try on mt5, here you:
2021.04.11 14:29:21.646 2017.01.02 09:01:18 failed market sell 0.1 GBPUSD sl: 1.23561 tp: 1.23261 [Unsupported filling mode]
2021.04.11 14:29:21.646 2017.01.02 09:01:18 Trading attempt #2. Error : Invalid order filling type
Thank you very much
Jewel
You need to set the correct order execution policy yourself (ENUM_ORDER_TYPE_FILLING). Use for this in the OnInit () handler:
There are only three possible values:
For the activation of the ORDER_TYPE_BUY_STOP_LIMIT and ORDER_TYPE_SELL_STOP_LIMIT orders, a corresponding limit order ORDER_TYPE_BUY_LIMIT / ORDER_TYPE_SELL_LIMIT with the ORDER_FILLING_RETURN execution type is created.
You need to set the correct order execution policy yourself (ENUM_ORDER_TYPE_FILLING). Use for this in the OnInit () handler:
There are only three possible values:
For the activation of the ORDER_TYPE_BUY_STOP_LIMIT and ORDER_TYPE_SELL_STOP_LIMIT orders, a corresponding limit order ORDER_TYPE_BUY_LIMIT / ORDER_TYPE_SELL_LIMIT with the ORDER_FILLING_RETURN execution type is created.