Add martingale grid to EA. Entries and grid spacing for the martingale trades are the same as the grid trades without martingale enabled. Add option for margingale TRUE and FALSE in settings. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// CODING FOR MARTINGALE IS AS FOLLOWS ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Example with 600 PIP SL, 90 PIP spacing, 1.7x Lot Size multiplier: 600 + 510*1.7^1 + 420*1.7^2 + 330*1.7^3 + 240*1.7^4 + 150*1.7^5 = XAdjPips Total = MarketInfo(Symbol(), MODE_TICKVALUE) * XAdjPips; Risk = Total / AccountBalance(); Therefore, if: 1 lot = 0.33 from the tick_value, which is based on 1 standard lot suppose it results in 33% risk X lot = 0.10 but we want the lot size equivalent of just 10% of account risk X = 0.1/0.33 converts to: risk% * accountbalance() / total Finally: BaseLot = risk% * accountbalance() / total; This risk model is not like mm=1, which steps up risk in abrupt steps, especially on smaller account sizes. This special MM system uses the Outside In Risk Approach... or balanced risk approach: Note that using this method, the risk is first stepped up from the trades that come later in the sequence since it is less risky to add 0.01 lot to the 6th trade than it is to add 0.01 lot to the first trade. This results in a higher Profit Factor with a slightly lower draw down. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// if (maxorders > 0 && (openTradeCount==0 || (openTradeCount>0 && AccountBalance() > LotSizeArray[99,myDirection]))) { MaxLossAmount = 0; for (int cnt=0;cnt= MaxTradeLotSize1) { LotSizeArray[maxorders-1,myDirection]=MaxTradeLotSize2; for (int cnt=maxorders-2;cnt>=0;cnt--) LotSizeArray[cnt,myDirection]=LotSizeArray[cnt+1,myDirection]/multiply; for (int cnt=maxorders-2;cnt>=0;cnt--) LotSizeArray[cnt,myDirection]=NormalizedLots(LotSizeArray[cnt,myDirection],false); } // // // // // else { LotSizeArray[0,myDirection] = NormalizedLots(BaseLot,false); for (int cnt=1;cntMarketInfo(s_symbol,MODE_MAXLOT)) myLotSize=MarketInfo(s_symbol,MODE_MAXLOT); return(myLotSize); }