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.
Mais do autor
My Grid Scalper
Ahmad Aan Isnain Shofwan
3 (2)
Cambista MyGrid Ou você lidera, ou ela lidera você. Estou lançando uma versão para MT5 baseada na versão para MT4 — que já foi baixada mais de 30.000 vezes desde 2022 — sem alarde, propaganda ou descontos. Este EA é gratuito e permanecerá gratuito para sempre. Dedico as recompensas espirituais do bem e dos benefícios que ele proporciona à minha falecida mãe, na vida após a morte . Simplesmente uma execução consistente nas mãos de quem entende do assunto. Informações básicas Símbolo: Qualquer (
FREE
MyVolume Profile Scalper FV
Ahmad Aan Isnain Shofwan
4 (7)
Versão GRATUITA do MyVolume Profile Scalper EA https://www.mql5.com/en/market/product/113661 Pares de moedas recomendados: EthereumUSD OURO/XAUUSD AUDCAD AUDCHF AUDJPY AUDNZD AUD/USD CAD CHF CADJPY CHF/JPY EURAUD EURCAD EUR/CHF EURGBP EUR/JPY EURNZD EURUSD GBPAUD GBPCAD GBP CHF GBP/JPY GBPNZD GBP/USD NZDCAD CHF NZD NZD/JPY NZDUSD USDCAD USD/CHF USD/JPY EthereumUSD BitcoinUSD US30 EM DINHEIRO Prazo: trabalhando para todos os prazos -----------------------
FREE
Minha Zona de Suporte e Resistência — Zonas de Oferta e Demanda para MT5 A maioria dos indicadores de oferta e demanda polui o gráfico e depois finge que isso é "análise". Este não. Minha ferramenta de Zonas de Suporte e Resistência mapeia automaticamente as zonas de oferta e demanda e, em seguida, as classifica de acordo com o comportamento real do mercado — e não pela aparência estética do retângulo. O que você recebe Zona Fraca Nova Zona (não testada) Zona Confirmada Zona comprovada Zona re
FREE
My Btcusd Grid
Ahmad Aan Isnain Shofwan
4.25 (16)
MyBTCUSD GRID EA é a versão GRATUITA do BTCUSD GRID EA https://www.mql5.com/en/market/product/99513 MyBTCUSD GRID EA é um programa automatizado projetado para usar a estratégia de negociação em grade MyBTCUSD GRID EA é altamente útil para iniciantes e traders experientes. Embora existam outros tipos de bots de negociação que você pode usar, a natureza lógica da estratégia de negociação em grade torna mais fácil para os bots de negociação em grade de criptografia realizar negociações automatiz
FREE
MyGrid Scalper
Ahmad Aan Isnain Shofwan
3.94 (52)
MyGrid Scalper Ou você o lidera — ou ele o lidera. Mais de 30.000 downloads desde 2022 — sem exageros, sem barulho, sem descontos. Apenas execução consistente nas mãos de quem entende Informações básicas Símbolo:   Qualquer (padrão otimizado: XAUUSD) Período:   Qualquer (padrão otimizado:   M5   ) Tipo:   EA baseado em grade com soft martingale (padrão 1,5) Controle de lote:   defina o multiplicador como 1,0 para lotes fixos Tipo de conta:   ECN recomendado, mas não obrigatório Corretora:   Qu
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 é um robô de negociação poderoso e emocionante para Forex, commodities, criptomoedas e índices. Características: Vários modos de lote: lote fixo, lote Fibonacci, lote Dalembert, lote Labouchere, lote Martingale, lote de sequência, lote do sistema Bet 1326 Tamanho do lote automático. Risco de equilíbrio, relacionado ao tamanho do lote automático TP manual ou usando ATR para Take Profit e tamanho da grade (dinâmico/automático) Configuração EMA Configuração de Draw Down. M
Black Bird
Ahmad Aan Isnain Shofwan
Só para quem conhece o personagem Martingale (Martingale Lover). Este EA é muito bom para aqueles que estão preocupados com os geradores REBATE. O Black Bird EA é baseado na Estratégia de Cobertura, proceda com um algoritmo avançado. O Black Bird EA é um sistema avançado de negociação de Scalp que usa algoritmos inteligentes para fazer a entrada mais rápida no mercado. Ele usa take-profit fixo/dinâmico com base no estado do mercado no momento da entrada e possui uma variedade de modos de saí
Btcusd Grid
Ahmad Aan Isnain Shofwan
1 (1)
TCUSD GRID EA é um programa automatizado projetado para usar a estratégia de negociação em grade BTCUSD GRID EA é altamente útil tanto para iniciantes quanto para traders experientes.   Embora existam outros tipos de bots de negociação que você pode usar, a natureza lógica da estratégia de negociação em grade torna mais fácil para os bots de negociação em grade criptográfica realizarem negociações automatizadas sem problemas.   BTCUSD GRID EA é a melhor plataforma geral para usar se você deseja
Three Little Birds
Ahmad Aan Isnain Shofwan
TRÊS PASSARINHOS EA Forjados na perda. Aperfeiçoados na dor. Libertados com propósito. Antes de comprar ou alugar, leia minhas anotações sobre o custo do 3LB e como testá-lo você mesmo no meu post do blog. Dica: Se você quiser entender em detalhes como o EA funciona durante os testes, procure o parâmetro "Debug" nas configurações de entrada. Por padrão, ele está definido como False. Defina-o como True para ver mensagens detalhadas na aba Experts enquanto executa um backtest ou um teste ao viv
MyVolume Profile Scalper
Ahmad Aan Isnain Shofwan
Antes de comprar, faça um teste direto usando uma conta demo  MyVolume Profile FV (versão GRATUITA)  por vários meses. aprenda e encontre a melhor configuração para atender a sua. MyVolume Profile Scalper EA é um programa avançado   e     automatizado projetado para usar o Perfil de Volume, que   pega   o volume total negociado em um nível de preço específico durante o período de tempo especificado e divide o volume total em volume ascendente (negociações que moveram o preço para cima ) ou qued
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 de Trailing Breakout Adaptável e de Grade Velora é um Expert Advisor de alta qualidade, desenvolvido a partir do núcleo do Instant Volatility Breakout (IVB), com um Grid Engine adaptável, lógica de rastreamento dinâmica, mecanismos de fechamento parcial e entradas automatizadas baseadas em volatilidade. Criado para traders que buscam uma mistura de agressividade, segurança e adaptabilidade, o Velora não é apenas reativo — é responsivo. Pontos fortes do núcleo IVB Breakout Eng
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
Meu Scalper de Perfil de Volume (MVPS) Grid EA. O primeiro bilhete vem do Perfil de Volume (ou você força o lado). O resto é distância + multiplicador — o mesmo cálculo a cada ciclo. Não é o Santo Graal. Não é "IA". Abre, organiza em grades, gerencia a cesta. Se você não entende de martingale, não a utilize. Ou use um multiplicador de tamanho de lote de 1 para tamanho fixo. O que isso realmente faz Primeira entrada: Perfil de Volume em M1–D1, ou Somente Compra / Somente Venda / Compra e Venda.
Three Little Birds MT5
Ahmad Aan Isnain Shofwan
TRÊS PASSARINHOS EA Forjados na perda. Aperfeiçoados na dor. Libertados com propósito. Antes de comprar ou alugar, leia minhas anotações sobre o custo do 3LB e como testá-lo você mesmo no meu post do blog. Dica: Se você quiser entender em detalhes como o EA funciona durante os testes, procure o parâmetro "Debug" nas configurações de entrada. Por padrão, ele está definido como False. Defina-o como True para ver mensagens detalhadas na aba Experts enquanto executa um backtest ou um teste ao viv
Filtro:
Sem comentários
Responder ao comentário