Smart YTG has been developed for trading GBPUSD on the H1 chart. This is a trend following system and works well during trending price behavior using STOP orders. It detects trend by analyzing the Price Channel indicator which is built straight into the Expert Advisor, therefore you do not need to additionally install any indicator. On the flat areas where the market is undecided, and further movement of the market is being determined, a breakeven function is activated, and if there are open positions which are opposite to the price direction, they are covered by orders in the price direction. As soon as the total profit is reached, the whole series of positions is closed. In this case Equity does not fall, but keeps moving near the balance line, as can be seen from the test results.
The code contains a lot of calculations, and most of them handle the moments when the market is flat, and you need to get out of it into the trend without drawdown and loss. This is done in the block of dynamic and static position closing. Dynamic closing—positions are closed when the total preset profit is reached by orders to close positions. Static—the EA calculates the price level at which the profit for all open positions will be reached. TakeProfit and StopLoss of open positions will be modified to this level. The two blocks have their own settings and can be operated independently of each other. You can use both blocks simultaneously, as they cover the disadvantages and complement each other.
Here is an example. Suppose there is a moment when the EA needs to lock the profit, and the dynamic block starts close positions. Due to many reasons such as slippage, connection loss, requotes, etc. loss will be reached instead of profit. The static block targets at a few profit points higher, it activates SL and TP and the profit will be taken. The disadvantage of the static block is that during rapid price movements you can miss the SL and TP and they simply will not be executed by the broker. The dynamic block will help in these cases.
- StopLoss_Percent - loss level, %
- LINE—the graphic display of the zero profit level as a line;
- Dinamick—the dynamic closure block;
- Dinamick_profit—the profit level for the dynamic block;
- Statick—the static profit closure block;
- Statick_profit—the profit level for the static block;
- SPREAD—correction for the floating spread;
- bars—Price Channel period;
- level_1—the distance from the current price to the pending order open price;
- level_2—an additional distance from the order open price to the new order open price;
- Lot—initial order lot, if = 0 MM is used;
- Choice_method—the MM method; percent of Free Margin or of balance;
- Risk—risk percent for MM;
- koef_lot—lot multiplier, if = 0 lots are added (lot of the open order + Lot/Risk);
- StopLoss—the Stop Loss level;
- TakeProfit—the Take Profit level;
- MagicNumber—the order identifier;
- Slippage—allowable slippage size;
- NumberOfTry—the number of trade attempts;
- CommentsCount—the number of comments;
- Show_Information - enable/disable the info panel;
- color_background - background color;
- color_text - text color;
- color_negative - negative value color;
- color_positive - positive value color.
Loss level in %.
New EA settings:
StopLoss_Percent - loss level, %
Show_Information - enable/disable the info panel
color_background - background color
color_text - text color
color_negative - negative value color
color_positive - positive value color