Trade assistant full
- Utilità
- Versione: 8.1
- Attivazioni: 5
TradeAssistant V8.1 is a comprehensive trade management Expert Advisor (EA) for MetaTrader 5 that automates position management, risk control, and trade execution. It functions as an assistant tool rather than an automated trading system — it does not open trades on its own but manages existing positions and pending orders with advanced features like auto SL/TP, risk-reward automation, trailing stops, partial closes, and on-chart control buttons.
---
Core Functions Explained
1. Auto SL/TP (Stop Loss / Take Profit)
· SetAutoSL() — Automatically assigns a Stop Loss to any position that doesn't have one, based on DefaultSLPoints from the entry price.
· SetAutoTP() — Automatically assigns a Take Profit based on DefaultTPPoints when Auto RR is disabled.
· Respects the broker's minimum stop level (SYMBOL_TRADE_STOPS_LEVEL).
2. Auto Risk:Reward (AutoRR)
· CalculatePositionAutoRRTP() — Calculates TP for open positions using the formula: TP distance = SL distance × RR ratio.
· CalculateOrderAutoRRTP() — Same logic applied to pending orders.
· When a user manually sets or modifies a Stop Loss, the EA automatically recalculates and applies the Take Profit to maintain the desired RR ratio.
3. Auto Close
· ManageAutoCloseForPosition() — Closes positions automatically when profit reaches AutoCloseProfitPoints or loss reaches AutoCloseLossPoints.
4. SL Positive (Break-Even +)
· ManageSLPositiveForPosition() — Once profit reaches SLPositiveTriggerPoints, the SL is moved to lock in a small profit (SLPositiveSetPoints above/below the entry price).
5. Trailing Stop
· ManageTrailingForPosition() — Once profit reaches TrailingTriggerPoints, the SL follows the price at a fixed distance (TrailingDistancePoints).
6. Trailing Steps
· ManageTrailingStepsForPosition() — An advanced step-based trailing system. SL is moved in fixed increments (TrailingStepsDistancePoints) as price advances, starting from TrailingStepsTriggerPoints. Uses tracker state (trailingStepsLevel, trailingStepsActive) to remember progress.
7. Partial Close
· PartialCloseAllPositions() — Closes a portion (PartialLotSize) of every position with volume greater than the partial size.
· ApplyAutoBEAfterPartial() — After a profitable partial close, moves SL to break-even + SLPositivePartialPoints on the remaining position.
8. Button System (On-Chart Controls)
· CreateAllButtons() — Creates 4 interactive chart buttons:
· CL-PROFIT → CloseProfitablePositions(): closes all winning positions.
· CL-LOSS → CloseLossPositions(): closes all losing positions.
· CL-ALL → CloseAllPositions(): closes every open position.
· PARTIAL → PartialCloseAllPositions(): partially closes all eligible positions.
