工作已完成
指定
I would like to create an EA which trades volatility breakouts, using Bollinger Bands and the Bollinger Bandwidth in order to generate signals.
Based on when a “squeeze” is detected, pending orders will be placed some distance away from price in both the BUY and SELL directions. The EA will ensure that the squeeze condition has been valid for some minimum amount of time as defined by the user. Once pending orders are opened, they are updated each bar, so long as the squeeze is still valid. When one side’s position is opened, the other side’s pending position is cancelled.
In the standard operating mode, the EA uses a hard SL, a breakeven, and two other close methods. One based on price crossing (and closing past) the middle moving average of the BB. The second a stepped TS.
BB Moving Average:
· If the opened position was a BUY, the position closes when price closes below the moving average
· If the opened position was a SELL, the position closes when price closes above the moving average
Stepped Trailing Stop:
The EA sets the distance between the position open and the Breakeven using one of two variables: “BE Level Points” or “BBWp Multiple”. Essentially each time a multiple of this distance is reached, the SL is moved forward one level. For example when the BE on a BUY is hit, the SL is moved to the open price. If price rises and hits this multiple again, the SL is moved ahead one more level.
Head-fake Management:
For testing purposes there will be a “head fake management” mode, in which the EA will attempt to recover a losing position. The head-fake occurs when price breaks out of a squeeze in one direction, resulting in the opening of a position, only to quickly turn back and move in the opposite direction. This function does not use any dangerous grid or recovery system.