TebotechSignals EA MQL5 Source Code (VIP)
TL;DR:
- Full MQL5 source code for the TebotechSignals Auto-Execution EA
- Available for VIP subscribers ($10/mo)
- Includes: API polling, risk-based lot sizing, order execution, breakeven, partial close, session filters, spread protection
Input Parameters
mql5input string ApiUrl = "https://tebotechsignals.com/api/signals/active";
input string ApiKey = "";
input double RiskPercent = 1.0;
input int MaxPositions = 5;
input int MaxSpreadPoints = 30;
input bool TradeLondon = true;
input bool TradeNewYork = true;
input bool TradeAsian = false;
input bool PartialCloseTP1 = true;
input bool MoveToBE = true;
input int PollIntervalSec = 10;
input int MagicNumber = 770077;
Core Functions
Lot Size Calculator (Risk-Based)
mql5double CalculateLotSize(string symbol, double entryPrice,
double stopLoss, double riskPercent)
{
double balance = AccountInfoDouble(ACCOUNT_BALANCE);
double riskAmount = balance * (riskPercent / 100.0);
double tickValue = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_VALUE);
double tickSize = SymbolInfoDouble(symbol, SYMBOL_TRADE_TICK_SIZE);
if(tickSize == 0 || tickValue == 0) return 0.0;
double slDistance = MathAbs(entryPrice - stopLoss);
double slInTicks = slDistance / tickSize;
if(slInTicks == 0) return 0.0;
double lot = riskAmount / (slInTicks * tickValue);
double step = SymbolInfoDouble(symbol, SYMBOL_VOLUME_STEP);
double minLot = SymbolInfoDouble(symbol, SYMBOL_VOLUME_MIN);
double maxLot = SymbolInfoDouble(symbol, SYMBOL_VOLUME_MAX);
lot = MathFloor(lot / step) * step;
return MathMax(MathMin(lot, maxLot), minLot);
}
Order Execution
mql5void PlaceOrder(string symbol, int direction, double lotSize,
double sl, double tp)
{
MqlTradeRequest req; MqlTradeResult res;
ZeroMemory(req); ZeroMemory(res);
req.action = TRADE_ACTION_DEAL;
req.symbol = symbol;
req.volume = lotSize;
req.type = (direction == ORDER_TYPE_BUY) ? ORDER_TYPE_BUY : ORDER_TYPE_SELL;
req.price = (direction == ORDER_TYPE_BUY) ?
SymbolInfoDouble(symbol, SYMBOL_ASK) :
SymbolInfoDouble(symbol, SYMBOL_BID);
req.sl = sl;
req.tp = tp;
req.deviation = 20;
req.magic = MagicNumber;
req.comment = "TebotechSignals Auto";
req.type_filling = ORDER_FILLING_IOC;
if(!OrderSend(req, res))
{
Print("Order failed: ", res.retcode, " - ", res.comment);
if(res.retcode == 10004 || res.retcode == 10021)
{ Sleep(2000); OrderSend(req, res); }
}
else
Print("Order placed: ", symbol, " ", lotSize, " lots");
}
Session Filter (Kill Zones)
mql5bool IsTradingSessionAllowed()
{
MqlDateTime dt; TimeToStruct(TimeCurrent(), dt);
int h = dt.hour;
if(TradeLondon && h >= 7 && h < 16) return true;
if(TradeNewYork && h >= 12 && h < 21) return true;
if(TradeAsian && (h >= 23 || h < 8)) return true;
if(!TradeLondon && !TradeNewYork && !TradeAsian) return true;
return false;
}
Breakeven + Partial Close at TP1
mql5void ManageOpenPositions()
{
for(int i = PositionsTotal()-1; i >= 0; i--)
{
ulong ticket = PositionGetTicket(i);
if(!PositionSelectByTicket(ticket)) continue;
if(PositionGetInteger(POSITION_MAGIC) != MagicNumber) continue;
double entry = PositionGetDouble(POSITION_PRICE_OPEN);
double sl = PositionGetDouble(POSITION_SL);
double tp = PositionGetDouble(POSITION_TP);
long type = PositionGetInteger(POSITION_TYPE);
string sym = PositionGetString(POSITION_SYMBOL);
double vol = PositionGetDouble(POSITION_VOLUME);
double bid = SymbolInfoDouble(sym, SYMBOL_BID);
double ask = SymbolInfoDouble(sym, SYMBOL_ASK);
bool tpHit = (type == POSITION_TYPE_BUY && bid >= tp) ||
(type == POSITION_TYPE_SELL && ask <= tp);
if(tpHit && MoveToBE)
{
MqlTradeRequest req; MqlTradeResult res;
ZeroMemory(req); ZeroMemory(res);
req.action = TRADE_ACTION_SLTP;
req.symbol = sym;
req.sl = entry;
req.tp = tp;
req.position = ticket;
OrderSend(req, res);
Print("Moved SL to breakeven for ", sym);
}
}
}
API Polling (Every 10 Seconds)
mql5string FetchActiveSignals()
{
char data[], result[];
string headers = "Content-Type: application/json\r\n";
if(ApiKey != "") headers += "Authorization: Bearer " + ApiKey + "\r\n";
bool ok = WebRequest("GET", ApiUrl, headers, 10000,
data, result, result_headers);
if(!ok) { Print("API error: ", GetLastError()); return ""; }
return CharArrayToString(result, 0, WHOLE_ARRAY, CP_UTF8);
}
Installation
- Copy source to `MQL5/Experts/TebotechSignals_EA.mq5`
- Compile in MetaEditor (F7)
- Enable WebRequest for `tebotechsignals.com` in Tools → Options → EA
- Drag onto chart, enter your API key, click OK
Risk Disclaimer
⚠️ Full source code provided for educational purposes. Trading involves significant risk. Test on demo first.
*VIP plan: $10/mo → Upgrade →*