MyGridBasket

Read-only basket analytics library for grid and averaging EAs. Real breakeven, what-if, stress test and stop-out distance. Sends no orders.

What it is
A library that reads your open positions and tells you the real state of a grid or averaging basket.
It does not trade. It sends no orders. It has no entry logic.
You call it from your own EA.

What it tells you
- Breakeven of the basket, with swap and commission counted
- The price where the basket nets a money amount you choose
- Where the average and the breakeven move if you add one more level
- How many lots bring the average to a price you choose
- Equity and margin level if price moves against the basket
- The same, with a grid that keeps adding levels
- How many points are left until stop-out

How to use
1. Put MyGridBasket.ex5 in MQL5/Libraries.
2. Add the import block below to your EA.
3. Create a basket handle, refresh it, read the numbers.
4. Destroy the handle in OnDeinit.

Example

int hBuy=-1;

int OnInit()
  {
   hBuy=MyGB_Create(_Symbol,MagicNumber,MYGB_BUY);   // magic -1 = every magic
   return (hBuy>=0) ? INIT_SUCCEEDED : INIT_FAILED;
  }

void OnDeinit(const int reason)
  {
   MyGB_Destroy(hBuy);
  }

void OnTick()
  {
   MyGB_Refresh(hBuy);
   double be = MyGB_Breakeven(hBuy);
   double tp = MyGB_TargetPrice(hBuy,50.0);     // net +50 in account currency
   double so = MyGB_StopOutDistance(hBuy);      // points to stop-out
  }

Conventions
Invalid handle or failed calculation: double returns EMPTY_VALUE, int returns -2, bool returns false.
Margin level is in percent. -1 means no margin is used.
Stop-out distance is in points. -1 means not reached in range, -2 means unknown.

Import block

#define MYGB_BUY  0
#define MYGB_SELL 1

#import "MyGridBasket.ex5"
int MyGB_Create(string symbol,long magic,int side);
void MyGB_Destroy(int h);
bool MyGB_Refresh(int h);
string MyGB_Version();
bool MyGB_IsHedging(int h);
string MyGB_Warning(int h);
string MyGB_Summary(int h);
int MyGB_Positions(int h);
double MyGB_Lots(int h);
double MyGB_AvgPrice(int h);
double MyGB_Breakeven(int h);
double MyGB_ClosePrice(int h);
double MyGB_DistToBreakevenPoints(int h);
double MyGB_Floating(int h);
double MyGB_Swap(int h);
double MyGB_EntryCommission(int h);
double MyGB_ExitCommission(int h);
bool MyGB_ExitCommissionKnown(int h);
double MyGB_NetResult(int h);
double MyGB_WorstPositionProfit(int h);
double MyGB_BestPositionProfit(int h);
double MyGB_LayerSpanPoints(int h);
void MyGB_SetExitCommissionPerLot(int h,double rate_per_lot);
void MyGB_ClearExitCommissionOverride(int h);
double MyGB_TargetPrice(int h,double target_money);
double MyGB_MoneyAtPrice(int h,double price);
double MyGB_LotsForTargetAverage(int h,double price,double target_avg);
double MyGB_WhatIfNewAverage(int h,double lot,double price);
double MyGB_WhatIfNewBreakeven(int h,double lot,double price);
double MyGB_WhatIfMarginLevel(int h,double lot,double price);
double MyGB_StressEquity(int h,double adverse_points);
double MyGB_StressMarginLevel(int h,double adverse_points);
int MyGB_StressStopOut(int h,double adverse_points);
double MyGB_GridStressEquity(int h,double adverse_points,double step_points,double first_lot,double lot_mult,double step_mult,int max_levels);
double MyGB_GridStressMarginLevel(int h,double adverse_points,double step_points,double first_lot,double lot_mult,double step_mult,int max_levels);
double MyGB_GridStressLots(int h,double adverse_points,double step_points,double first_lot,double lot_mult,double step_mult,int max_levels);
int MyGB_GridStressLevels(int h,double adverse_points,double step_points,double first_lot,double lot_mult,double step_mult,int max_levels);
int MyGB_GridStressStopOut(int h,double adverse_points,double step_points,double first_lot,double lot_mult,double step_mult,int max_levels);
double MyGB_StopOutDistance(int h);
double MyGB_StopOutDistanceGrid(int h,double step_points,double first_lot,double lot_mult,double step_mult,int max_levels);
double MyGB_NetLots(string symbol,long magic);
#import

Know the limits
- Made for hedging accounts. On netting accounts there is one position per symbol, so the basket is that position. A warning is set.
- Stop-out is evaluated only when your broker uses stop-out in percent. In money mode the result is unknown.
- Margin of simulated levels does not credit hedge offset between opposite positions. This errs on the safe side.
- Simulated levels fill exactly at their price. Spread, slippage and execution delay are not modelled.
- Exit commission is estimated from your own past closing deals on the symbol. If there are none it is counted as 0 and the library tells you.
- Other positions on the account are assumed unchanged during a stress test.
- A stress test is arithmetic. It is not a forecast. Real fills in a fast market are worse.
- Test it on a demo account with your broker's symbols before you rely on it.

Free. No account or symbol restrictions. No warranty.
Version 1.00 is the first release.
Altri dall’autore
My Grid Scalper
Ahmad Aan Isnain Shofwan
3 (2)
Scalper di MyGrid O lo guidi tu, o è lui a guidare te. Sto rilasciando una versione per MT5 basata sulla versione per MT4, che è stata scaricata oltre 30.000 volte dal 2022, senza clamore, pubblicità o sconti. Questo Expert Advisor è gratuito e rimarrà tale per sempre. Dedico le ricompense spirituali derivanti dal bene e dai benefici che esso apporta alla mia defunta madre nell'aldilà . Semplicemente un'esecuzione coerente nelle mani di chi capisce Informazioni di base Simbolo: Qualsiasi (prede
FREE
MyVolume Profile Scalper FV
Ahmad Aan Isnain Shofwan
4 (7)
Versione GRATUITA di MyVolume Profile Scalper EA https://www.mql5.com/en/market/product/113661 Coppie di valute consigliate: ETHUSD ORO/XAUUSD AUDCAD AUDCHF AUDJPY AUDNZD USDUSD CADCHF CADJPY CHFJPY EURAUD EURCAD EURCHF EURGBP EURJPY EURNZD EURUSD GBPAUD GBPCAD GBPCHF GBPJPY GBPNZD GBP/USD NZDCAD NZDCHF NZDJPY NZDUSD USDCAD USDCHF USDJPY ETHUSD BitcoinUSD 30 dollari in contanti Timeframe: funzionante per tutti i timeframe --------------------------------
FREE
La mia zona di supporto e resistenza — Zone di domanda e offerta per MT5 La maggior parte degli indicatori di domanda e offerta ingombrano il grafico e poi spacciano questo per "analisi". Questo, invece, no. La mia mappa delle zone di supporto e resistenza individua automaticamente le aree di domanda e offerta, classificandole poi in base all'effettivo andamento del mercato, non in base all'aspetto estetico del rettangolo. Ciò che ottieni Zona debole Nuova zona (non testata) Zona confermata Zo
FREE
My Btcusd Grid
Ahmad Aan Isnain Shofwan
4.25 (16)
MyBTCUSD GRID EA è la versione GRATUITA di BTCUSD GRID EA https://www.mql5.com/en/market/product/99513 MyBTCUSD GRID EA è un programma automatizzato progettato per utilizzare la strategia di trading a griglia MyBTCUSD GRID EA è molto utile sia per i principianti che per i trader esperti. Sebbene esistano altri tipi di bot di trading che puoi utilizzare, la natura logica della strategia di trading di rete rende facile per i bot di trading di criptovalute eseguire il trading automatico senza pr
FREE
MyGrid Scalper
Ahmad Aan Isnain Shofwan
3.94 (52)
Scalper MyGrid O lo guidi tu, o è lui a guidare te. Oltre 30.000 download dal 2022: niente clamore, niente rumore, niente sconti. Solo un'esecuzione coerente nelle mani di chi capisce. Informazioni di base Simbolo:   Qualsiasi (ottimizzato per impostazione predefinita: XAUUSD) Intervallo di tempo:   qualsiasi (ottimizzato per impostazione predefinita:   M5   ) Tipo:   EA basato su griglia con soft martingala (predefinito 1.5) Controllo lotto:   imposta il moltiplicatore su 1,0 per lotti fissi
FREE
Velora MT5
Ahmad Aan Isnain Shofwan
The Intelligent Grid EA — A Team of Smart Modules Following the 5-star success of its MT4 predecessor, Velora has been completely rebuilt for MT5 with a fundamental shift in design. Most grid EAs are one engine doing many jobs. Velora is different. Inside Velora, there is a team. Four smart modules, each with one specialty, working together so the system stays adaptive at every stage of a trade — from the moment of entry, to scaling decisions, to the exit. Meet the team: VSE — Velora Smart Entr
AanIsnaini Signal Matrix MT5
Ahmad Aan Isnain Shofwan
5 (1)
AanIsnaini Signal Matrix MT5 Multi-Timeframe Confidence Signal Dashboard The Free Version of AanIsnaini Signal Matrix MT5 Pro AanIsnaini Signal Matrix  MT5 is a powerful all-in-one indicator that analyzes market direction and confidence levels across multiple timeframes — allowing traders to see the overall bias of the market at a single glance. It combines signals from Price Action , Support–Resistance , and several proven technical tools (MACD, ADX, RSI, MA slope, ATR, and Volume Ratio), then
FREE
My Risk Management MT5
Ahmad Aan Isnain Shofwan
5 (1)
My Risk Management The Risk Management Dashboard is a visual tool designed to help traders monitor risk exposure in real time. With a clear and compact layout, it provides an instant overview of trading activity, enabling more disciplined and informed decision-making. Key Features Active Symbol Summary Displays all traded symbols with the number of trades, total buy/sell lots, and current profit/loss. Per-Symbol Risk Analysis Calculates and shows the risk percentage of each symbol relative to
FREE
Velora Equity Monitor
Ahmad Aan Isnain Shofwan
5 (1)
Velora Equity Monitor Free — No strings attached. Except one. I built this for myself. After running multiple EAs simultaneously on the same terminal, I kept asking the same question: which one is actually making money? The default MT5 account history mixes everything together. You get a number. You don't get clarity. So I built Velora Equity Monitor. Attached it. Left it running. Forgot it was there — until I needed it. That's the best compliment I can give my own tool. What it does Velora Equi
FREE
MyCandleTime MT5
Ahmad Aan Isnain Shofwan
My CandleTime This indicator displays the remaining time until the current candle closes directly on the chart. It is designed to help traders keep track of candle formation without constantly checking the platform’s status bar. Main Features Shows countdown timer for the active candle. Works on any symbol and timeframe. Lightweight, does not overload the terminal. Adjustable font size and name. How to Use Simply attach the indicator to a chart. You can customize font size, color, and font to
FREE
My Fibonacci MT5
Ahmad Aan Isnain Shofwan
My Fibonacci MT5 An automated Fibonacci indicator for MetaTrader 5 that combines ZigZag swing detection with comprehensive Expert Advisor integration through a 20-buffer system. More details about data specification and EA integration: https://www.mql5.com/en/blogs/post/764114 Core Features Automated Fibonacci Detection The indicator identifies swing points using configurable ZigZag parameters and draws Fibonacci retracements and extensions automatically. It updates levels as new swing formatio
FREE
My Risk Management
Ahmad Aan Isnain Shofwan
5 (1)
My Risk Management The Risk Management Dashboard is a visual tool designed to help traders monitor risk exposure in real time. With a clear and compact layout, it provides an instant overview of trading activity, enabling more disciplined and informed decision-making. Key Features Active Symbol Summary Displays all traded symbols with the number of trades, total buy/sell lots, and current profit/loss. Per-Symbol Risk Analysis Calculates and shows the risk percentage of each symbol relative to
FREE
AanIsnaini Signal Matrix
Ahmad Aan Isnain Shofwan
AanIsnaini Signal Matrix Multi-Timeframe Confidence Signal Dashboard AanIsnaini Signal Matrix  is a powerful all-in-one indicator that analyzes market direction and confidence levels across multiple timeframes — allowing traders to see the overall bias of the market at a single glance. It combines signals from   Price Action ,   Support–Resistance , and several proven technical tools (MACD, ADX, RSI, MA slope, ATR, and Volume Ratio), then calculates a   confidence score   showing how strongly th
FREE
My Fibonacci
Ahmad Aan Isnain Shofwan
My Fibonacci An automated Fibonacci indicator that combines ZigZag swing detection with comprehensive Expert Advisor integration through a 20-buffer system. More details about data specification and EA integration: https://www.mql5.com/en/blogs/post/764109 Core Features Automated Fibonacci Detection The indicator identifies swing points using configurable ZigZag parameters and draws Fibonacci retracements and extensions automatically. It updates levels as new swing formations develop. Market Ad
FREE
TAwES
Ahmad Aan Isnain Shofwan
Trading Assistant with Equity Security (TAwES) This EA for helping manual trading (the EA will be activated when manual trade opened - Semi Auto) - This EA will be triggered by manual trading/first OPEN TRADE - If some manual trades have been opened and EA activated then all manual trades will be take over by EA separately. - This EA feature can be a martingale with multiplier, max order, and the distance can be adjusted - This EA will secure your Equity by max/loss Equity Setup.
FREE
Buas
Ahmad Aan Isnain Shofwan
BUAS EA is a hybrid grid breakout system engineered for traders who prefer execution logic over prediction. It deploys pending Buy Stop and Sell Stop orders as a symmetrical trap and follows whichever side is triggered first. The latest version introduces Adaptive Asymmetric Grid (AAG) logic and Dual Adaptive Trailing (equity-based + ATR-based), delivering both dynamic protection and refined risk adaptation. Designed for professional and advanced traders who demand full automation with on-chart
MyGrid Scalper Ultimate
Ahmad Aan Isnain Shofwan
MyGrid Scalper Ultimate è un potente ed entusiasmante robot di trading per Forex, materie prime, criptovalute e indici. Caratteristiche: Varie modalità di lotto: lotto fisso, lotto Fibonacci, lotto Dalembert, lotto Labouchere, lotto Martingala, lotto sequenza, lotto sistema Bet 1326 Dimensione lotto automatico. Rischio di equilibrio, correlato alla dimensione del lotto automatico TP manuale o utilizzo di ATR per Take Profit e dimensione della griglia (dinamico/automatico) Configurazione EMA Im
Black Bird
Ahmad Aan Isnain Shofwan
Solo per chi conosce il personaggio di Martingale (Martingale Lover). Questo EA è molto buono per coloro che sono preoccupati per i generatori di REBATE. Black Bird EA si basa sulla strategia di copertura che procede con un algoritmo avanzato. Black Bird EA è un avanzato sistema di trading Scalp che utilizza algoritmi intelligenti per entrare nel mercato il più rapidamente possibile. Utilizza un take-profit fisso/dinamico basato sullo stato del mercato al momento dell'ingresso e ha una varie
Btcusd Grid
Ahmad Aan Isnain Shofwan
1 (1)
BTCUSD GRID EA è un programma automatizzato progettato per utilizzare la strategia di grid trading BTCUSD GRID EA è molto utile sia per i principianti che per i trader esperti.   Sebbene esistano altri tipi di bot di trading che puoi utilizzare, la natura logica della strategia di grid trading rende facile per i bot di trading di criptovalute eseguire scambi automatizzati senza problemi.   BTCUSD GRID EA è la migliore piattaforma in assoluto da utilizzare se stai cercando di provare un bot di t
Three Little Birds
Ahmad Aan Isnain Shofwan
TRE PICCOLI UCCELLI EA Forgiati dalla perdita. Perfezionati con il dolore. Pubblicati con uno scopo. Prima di acquistare o noleggiare, leggi le mie note sul costo di 3LB e su come testarlo tu stesso nel mio post sul blog. Suggerimento: se desideri comprendere nel dettaglio il funzionamento dell'EA durante la fase di test, cerca il parametro "Debug" nelle impostazioni di input. Per impostazione predefinita, è impostato su False. Impostalo su True per visualizzare messaggi dettagliati nella sch
MyVolume Profile Scalper
Ahmad Aan Isnain Shofwan
Prima dell'acquisto, effettua un test tramite test in avanti utilizzando un account demo   MyVolume Profile FV (versione GRATUITA)   per diversi mesi.   imparalo e trova la configurazione migliore per incontrare il tuo. MyVolume Profile Scalper EA è un programma avanzato   e     automatizzato progettato per utilizzare il profilo del volume che   prende   il volume totale scambiato a un livello di prezzo specifico durante il periodo di tempo specificato e divide il volume totale in volume in ria
Miliarto Ultimate
Ahmad Aan Isnain Shofwan
an EA that use 3 Moving Average or Bollinger Bands indicators. You can choose one and setup the indicator selected as you wish.  Moving averages and Bollinger bands is one of powerful indicator. The recommendation to uses the main trend to enter the market, H1 or H4 timeframe for identifying the trend. and you can uses a short timeframe to enter the market and setup how the EA allowed trade direction  (Buy only, Sell only, or both) within short time frame. The EA have : - Take Profit and Stop Lo
Velora
Ahmad Aan Isnain Shofwan
5 (4)
Velora EA – Sistema di breakout a griglia e adattivo Velora è un Expert Advisor di alta qualità progettato a partire dal nucleo di Instant Volatility Breakout (IVB), con un Grid Engine adattivo, logica di trailing dinamica, meccanismi di chiusura parziale e voci automatizzate basate sulla volatilità. Progettata per i trader che cercano un mix di aggressività, sicurezza e adattabilità, Velora non è solo reattiva, è anche reattiva. Punti di forza principali IVB Breakout Engine:   rileva raffiche d
MurreyGannQuantum
Ahmad Aan Isnain Shofwan
MurreyGannQuantum - Professional Trading Indicator Advanced Murrey Math & Gann Angle Technical Analysis with Complete EA Integration Professional technical indicator combining Murrey Math level analysis with Gann angle calculations. Features comprehensive visual analysis, multi-timeframe adaptation, and complete EA integration capabilities for automated trading systems. The blog: https://www.mql5.com/en/blogs/post/763757 CORE FEATURES Technical Implementation: Murrey Math Levels: 9 dynamic su
MurreyGannQuantum MT5
Ahmad Aan Isnain Shofwan
MurreyGannQuantum - Professional Trading Indicator Advanced Murrey Math & Gann Angle Technical Analysis with Complete EA Integration Professional technical indicator combining Murrey Math level analysis with Gann angle calculations. Features comprehensive visual analysis, multi-timeframe adaptation, and complete EA integration capabilities for automated trading systems. The Non-Repainting Guarantee: Why It Matters What Does Non-Repainting Really Mean? A non-repainting indicator maintains its h
AanIsnaini TrueChart
Ahmad Aan Isnain Shofwan
Proprietary Signal Amplification Technology Unlike conventional indicators that merely display data, TrueChart employs advanced signal amplification that emphasizes only high-probability trading opportunities. The system automatically filters out market noise and amplifies genuine signals through multiple confirmation layers, ensuring you only see what truly matters. Revolutionary Multi-Dimensional Confirmation System Most indicators operate in a single dimension. Our technology simultaneously
AanIsnaini Signal Matrix MT5 PRO - Bayesian Multi-Timeframe Dashboard "Advanced multi-timeframe dashboard with Bayesian Learning, real-time Signal Strength, and persistent memory. The older it runs, the smarter it becomes." The free version (v1.3) gave you visibility. The PRO Version gives you the edge . AanIsnaini Signal Matrix MT5 PRO is a sophisticated multi-timeframe analysis system that combines classical technical indicators with adaptive probabilistic reasoning. Designed for serious tra
My Volume Profile Scalper
Ahmad Aan Isnain Shofwan
Il mio strumento di scaling basato sul profilo di volume (MVPS) EA a griglia. Il primo ticket proviene dal profilo di volume (oppure si forza il lato). Il resto è distanza + moltiplicatore: la matematica è la stessa ad ogni ciclo. Non è il Santo Graal. Non è "IA". Apre, crea griglie, gestisce il paniere. Se non capisci la martingala, non allegarla. Oppure usa il moltiplicatore della dimensione del lotto a 1 per una dimensione fissa. Cosa fa realmente Prima voce: Profilo dei volumi su M1–D1, op
Three Little Birds MT5
Ahmad Aan Isnain Shofwan
TRE PICCOLI UCCELLI EA Forgiati dalla perdita. Perfezionati con il dolore. Pubblicati con uno scopo. Prima di acquistare o noleggiare, leggi le mie note sul costo di 3LB e su come testarlo tu stesso nel mio post sul blog. Suggerimento: se desideri comprendere nel dettaglio il funzionamento dell'EA durante la fase di test, cerca il parametro "Debug" nelle impostazioni di input. Per impostazione predefinita, è impostato su False. Impostalo su True per visualizzare messaggi dettagliati nella sch
Filtro:
Nessuna recensione
Rispondi alla recensione