Development of the second version: Previous Candle Breakdow 2
Added the parameter
Suppose that we have a total position volume of 2.5 lots, Maximum volume position is 3.3 lots, and we have an incoming trading signal. During the preliminary check, the volume of an opened position is 1.5. 2.5 + 1.5 > 3.3, which means no new position is opened.
The EA waits for breaking down any timframe from 1 minute through 1 month. Bar #1 is checked for breakdown at a specified timeframe Breakdown previous candle. It is also possible to enable two filters - Moving Average.
In the EA, trailing is implemented that (at the first modification of the Stop Loss level) moves Stop Loss to breakeven.
Position size can be both permanent (Lots above zero and Risk is equal to zero) and dynamically calculated in the risk percents per trade (Risk above zero and Lots is equal to zero).
NOTE! No situations may be allowed, where:
Upon reaching the target profit Close all positions when profit is achieved, all positions will be closed. The EA ensures that no more than one position in each direction is opened at the specified timeframe Previous Candle Breakdown.
Fig. 1. Current timeframe: M15, breakdown is set to H4
Translated from Russian by MetaQuotes Software Corp.
Original code: https://www.mql5.com/ru/code/22145
The library and iCanvas class simplify writing programs using Canvas.TradeTransactions
Access to OnTradeTransaction data anywhere within an application