Rejoignez notre page de fans
- Vues:
- 52
- Note:
- Publié:
- Mise à jour:
-
Besoin d'un robot ou d'un indicateur basé sur ce code ? Commandez-le sur Freelance Aller sur Freelance
CE QU'ELLE IMPRIME
Pour chaque symbole : chiffres, point, pas de cotation et valeur, taille du contrat, lot min. / pas / max., spread et s’il est variable, mode d’exécution, swap long et court, ainsi que la marge requise pour un lot minimum par rapport à votre marge disponible actuelle. Ensuite, la partie qui répond à la question proprement dite :
--- XAUUSD (bid 4402.15 / ask 4402.63) --------------------- stops level 350 pts | freeze level 0 pts | EFFECTIVE band 351 pts VERDICT: a stop/pending placed 100 pts from price would be REJECTED as 'Invalid price' (band is 351 pts) buy at ask 4402.63: you asked SL 4401.63 -> nearest legal SL 4399.12 (moved out)
double MinStopDistance(const string sym) { long stops = SymbolInfoInteger(sym, SYMBOL_TRADE_STOPS_LEVEL); long freeze = SymbolInfoInteger(sym, SYMBOL_TRADE_FREEZE_LEVEL); long band = (stops > freeze ? stops : freeze) + 1; return band * SymbolInfoDouble(sym, SYMBOL_POINT); }
double LegalStopLoss(const string sym, const bool isBuy, const double price, const double wanted) { double dist = MinStopDistance(sym); int digits = (int)SymbolInfoInteger(sym, SYMBOL_DIGITS); double sl = wanted; if(isBuy) { if(price - sl < dist) sl = price - dist; } else { if(sl - price < dist) sl = price + dist; } return NormalizeDouble(sl, digits); }
Un arrêt déjà légal reste inchangé ; vous pouvez donc sans risque faire passer tous les arrêts par celui-ci. L'intégration de votre calcul existant ne nécessite qu’une seule ligne de code :
double sl = LegalStopLoss(_Symbol, true, ask, ask - atr * 1.5);
REMARQUES SUR L'INTERPRÉTATION DES RÉSULTATS
Les symboles doivent figurer dans Market Watch et avoir enregistré au moins un tick. Si un symbole ne présente aucune donnée de tick, ouvrez son graphique une fois, puis relancez l'opération.
Traduit de l’anglais par MetaQuotes Ltd.
Code original : https://www.mql5.com/en/code/76178
Risk Guard — risk-based lot size, daily loss lock, max positions, oversized-trade trim, forced stop-loss
Enforces your own risk rules on every position, whether opened by hand or by another EA: shows the lot size that matches your risk, locks the account for the day after a set loss, caps open positions, trims positions that risk more than allowed, and adds a stop-loss to any position opened without one.
Prop-Firm Equity Guard - daily and max drawdown protection (FTMO-style)
Strict risk management utility for prop-firm challenges. Automatically monitors your entire account to prevent daily and max drawdown failures. It acts as a safety buffer against spread spikes and revenge trading by instantly closing all positions and pending orders before your evaluation is terminated.
Custom Simple Moving Average
Une moyenne mobile adaptative à deux niveaux (moyenne de base + lissage secondaire) qui change de couleur en fonction de sa pente et signale les croisements entre le cours et la moyenne à l'aide de flèches.
Smart Loss Exit — early exit for losing positions (ATR adverse excursion, time in trade, EMA invalidation, RSI, money cap) with a CSV journal
Closes losing positions early, before the full stop-loss, when a rule says the trade is not coming back: adverse move beyond N x ATR, too long in loss, EMA trend flipped, RSI against the position, or a money cap. Never touches a position in profit. Observe-only mode journals what would be closed without closing anything. Every exit is written to CSV with the rule, the age and the maximum adverse excursion, so the rules can be tuned from data.
