Job finished
Specification
The idea of the trading system is as follows: market entries are performed when 9 Period EMA line intersects with 25 Period EMA or a 200 Period EMA. I already have an EA I wrote that executes a Buy Entry when the 9 EMA entersects the 25 EMA to trade above it. Then, when another intersection happens, so the 9 EMA will intersect to be below the 25 EMA, when this happens a Close Order is executed on the existing Buy order and a new Sell Order is simultaneously executed. I could send this EA through.
2. Trend is determined based on the Exponential Moving Average with the specified period (InpMATrendPeriod). If the current EMA value is greater than the previous one, the trend is seen as growing (ema_current > ema_previous). Alternatively, if current EMA is below the previous one, the trend is considered to be falling (ema_current< ema_previous). So, I want the EA to be aware what Trend Mode it's in.
Trend Mode Definition: Buy Mode - When 9 EMA is greater that 200 EMA. Sell Mode - When 9 EMA is lesser than 200 EMA. So, the EA must only execute Entries that correspond with the Trend Mode. So when the Trend Mode is Sell it should execute all Sell Entries (9 EMA>25 EMA) and ignore Buy (9 EMA < 25 EMA) intersections
Position management
TrailngStop is used to protect profit. Stop Loss is set if profit in points exceeds the value specified in the InpTrailingStop parameter. If the price continues to move in the profit direction, Stop Loss should be trailed at the given distance. Stop Loss cannot be moved towards the loss direction, i.e. the Stop Loss value cannot be increased. If none of protective orders (Take Profit or Stop Loss) triggers, the position should be closed by an opposite signal. No other position exit methods are available.