This Expert Advisor is very useful during news events when the markets are highly volatile, and the direction of the breakout cannot be determined initially. For example, consider a trader who wants to trade in the direction of a breakout after a news event at 10 am.
Once a breakout occurs, the trader wants to place a trade in the direction of that breakout with a specific take-profit target. If the breakout does not occur within a specific time, or after the breakout has occurred but the take-profit is not achieved within a specific time, the trader wishes to delete the pending order, or close the trade.
The 21 Hour Expert Advisor helps the trader accomplish this task by automatically managing this trade.
In the first step, the Expert Advisor places a Buy Stop order at the ChasStart hour for example 10 am Limit points above the current Ask price, and a Sell stop order Limit points below the current Bid price.
The Expert Advisor employs One-Cancels-Other mechanism for these two orders. If the Buy Stop order is executed first, then the pending Sell Stop order is immediately deleted. Likewise, if the Sell Stop order is executed first, then the pending Buy Stop order is immediately deleted. Hence, there can be only one open position initiated by the Expert Advisor.
If a position is opened and exited at take-profit before ChasStop hours (For example 8 pm), then the Expert Advisor becomes idle. However, if there are pending orders when the end-time specified by ChasStop hours is reached then these pending orders are deleted and the Expert Advisor becomes idle.
Similarly, if the position is still open at ChasStop hours, it is closed by the Expert Advisor. In other words, the Expert Advisor deletes pending orders (if any), or closes open position (if any) at ChasStop hours and transitions to idle mode.
This Expert Advisor does not have a stop-loss since it exits positions at ChasStop hours. It is recommended that the trader set a stop-loss manually if desired.