Posts

Showing posts from October, 2025

MQL5: MAX TRADES , RISK BASED LOTSIZE implementation

 //+------------------------------------------------------------------+ //|                                       SachinMarketingProject.mq5 | //|                                  Copyright 2025, MetaQuotes Ltd. | //|                                             https://www.mql5.com | //+------------------------------------------------------------------+ #property copyright "Copyright 2025, MetaQuotes Ltd." #property link      "https://www.mql5.com" #property version   "1.00" #include <Trade\Trade.mqh> CTrade trade; input int MagicNumber=12345; input double lotsize=3; input string INFO1="Moving Average settings"; input int MA_Period=20; input ENUM_MA_METHOD ...

Python True Data Integration (2025)

  import os import logging import time from dotenv import load_dotenv from truedata import TD_live   # official TrueData client load_dotenv () # ---- helpers ---- def _to_kv_string ( obj ):     try :         items = {k: v for k , v in vars ( obj ). items () if not k . startswith ( "_" ) }     except Exception:         return repr ( obj )     # stringify safely     def s ( v ):         try :             return str ( v )         except Exception:             return repr ( v )     return " " . join ( f " { k } = { s ( items [ k ]) } " for k in sorted ( items )) def _first_pair ( values ):     # Accept shapes like [(price, qty)] or [price, qty]     try :         if isinstance ( values , list ) and values:      ...

MQL5 : Risk percentage based lotsize XAUUSD

 double calculate_lot(double ep, double sl,double contractSize)   {    double accountBal=AccountInfoDouble(ACCOUNT_BALANCE);    double riskval= accountBal* riskpercentage* 0.01;    Print("account bal: "+accountBal);    Print("riskval: "+riskval);    double diff_ep_sl=MathAbs(ep-sl);    Print("diff_ep_sl: "+diff_ep_sl);    diff_ep_sl=diff_ep_sl*contractSize;    Print("diff_ep_sl * 100: "+diff_ep_sl);    lots=riskval/diff_ep_sl;    lots= NormalizeDouble(lots, 2);    Print("lots : "+lots);    return lots;   }