You are missing trading opportunities:
- Free trading apps
- Over 8,000 signals for copying
- Economic news for exploring financial markets
Registration
Log in
You agree to website policy and terms of use
If you do not have an account, please register
You're not the one who needs a pause.
Globally, there are 2 ways:
1) analysis of the environment (sucking in the history of transactions, checking the open position or the volume of the position);
2) analysis of transactions.
The first works slower. But it is more reliable. We need a compromise. Perhaps, we need to look at the strategy and depend on it.
Yes, FORTS has a full-fledged ticker, so one should not work with ticks but with the BookEvent event.
It's strange that Vasily Sokolov has not commented on this subject. His point of view is interesting...
Anyway, the bottom line, imho, is this.
Globally, there are 2 ways:
1) analysis of the environment (sucking in the history of transactions, checking the open position or the volume of the position);
2) analysis of transactions.
The first works slower. But it is more reliable. We need a compromise. Perhaps, we need to look at the strategy and depend on it.
Yes, FORTS has a full-fledged ticker, so one should not work with ticks but with the BookEvent event.
It's strange that Vasily Sokolov has not commented on this subject. His point of view is interesting...
Anyway, the bottom line, imho, is this.
Globally, there are two ways:
1) analysis of the environment (sucking in the history of transactions, checking the open position or the volume of the position);
2) analysis of transactions.
The first works slower. But it is more reliable. We need a compromise. Perhaps, we need to look at the strategy and depend on it.
Yes, FORTS has a full-fledged ticker, so one should not work with ticks but with the BookEvent event.
It's strange that Vasily Sokolov has not commented on this subject. His point of view is interesting...
i.e. can I transfer my strategy there completely?
I once worked on this order and wrote the CiOnTrade class:
So, the optimal solution I found was in processing the states. And there were so many of them:
{
TRADE_STATE_NONE=0, // "ничего"
TRADE_STATE_ORDERS=1, // "только ордера"
TRADE_STATE_POSITION=2, // "только позиция"
TRADE_STATE_ALL=3, // "все"
};
2) "Orders only" - this is the state when the orders are placed.
3) "Position only" is the state when orders are fully executed.
4) "All" is the state when the orders have not been executed completely and there is already a position in the market.
So each state had to be processed. Yes, by the way, I admit that there are intermediate states as well. So my class could be improved.
By the way, a question has arisen: can theBookEvent event be used in the same way as the Tick or the Timer?
i.e. can your strategy be fully transferred there?
Yes! But consider that the glass is more likely to generate events. Therefore, you need some filter to sift out unnecessary events. For example, prices have not changed, but only volumes of some bids...
The bottom line, imho, is this.
Globally, there are two ways:
1) environment analysis (sucking up the history of trades, checking open position or position volume);
2) transaction analysis.
The first works slower. But it is more reliable. There must be a compromise. Perhaps we must look at the strategy and depend on it.
I assume that the info about the deal has not come yet. Here (marked in red), you rely on luck. And she is a capricious lady :-))
{
MqlTradeRequest Request;
MqlTradeResult Results;
ZeroMemory(Request);
ZeroMemory(Results);
Request.price=SymbolInfoDouble(_Symbol,SYMBOL_BID);
Request.action=TRADE_ACTION_DEAL;
Request.type=ORDER_TYPE_SELL;
Request.symbol=symbol;
Request.volume=volume;
Request.deviation=deviation;
Request.comment=comment;
Request.type_filling=filling;
bool res=false;
res=OrderSend(Request,Results);
if(res)
{
if(Results.deal>0) return(true);
else return(false);
}
return(false);
}
Even withORDER_STATE_FILLED, Results.order can have a problem - Results.deal is zero. 100% reproduction of this situation is achieved on FXOpen-MT5 server.
I recommend to open many demos on different servers and achieve full functionality of the code. I did so for MT4 biblical. That's why there is no problem with the subgame.
OrderSend+Sleep(0) is not slower than OrderSend+OnTradeTransaction. I measured it. Therefore, I don't use the second variant not for asynchronous transactions.
The OrderSend+Sleep(0) variant is temporary, because it's a shortcoming of developers (don't use it as an example :) ).
When it is corrected, only OrderSend will remain