Trading is the hardest way to make easy money...
- Joined Mar 2016 | Status: Full Trader | 1,378 Posts
Martingale, Anti-martingale, and Compounding 40 replies
Martingale, Reverse Martingale, Modified Martingale, Maths 1 reply
Martingale Calculation EA (also reverse martingale) 3 replies
How to change this Martingale to Reverse Martingale ? 3 replies
Martingale vs. Non Martingale (Simplified RoR vs Profit) 1 reply
Disliked{quote} My idea: Simply dynamic grid - multiplying grid size with adjustable coefficient (1.1 ... 1.2 ... 1.8).Ignored
DislikedHere are my settings. Some of them are running on a real-account with success until now. But I do not use the newest version of the EA, just older one's, because in my settings trades are just opened with "open price", not on "every tick". {file}Ignored
DislikedI reorganized my test demo earlier posted in #555 + #696 completely. Bcz I use now only the recently posted v 1.90 this test looks now more consistent. Nearly all demos are at TF H1. Have one H4 + D1 platform. For now I test all pairs - even the CHFs - at an exemplary 50k account. The setfiles are attached. These are the MFXBook links to follow the development of the trading results of this handsfree test continuously: (Platforms GP 35,36,38,39,46,50,51,52,53) https://www.myfxbook.com/members/AGT...h1-all/1772860...Ignored
DislikedHI guys! Is any body can share M1 timeframe settings for small account? Thanks for your help! cheersIgnored
DislikedVersion 1.92 of the EA released (I updated Post 1). - Dynamic grid size based on daily ATR added. - Bug fixes. {image}Ignored
Disliked{quote} Thank you for your advice I'll trust you Have you got any good settings for share? cheers!Ignored
DislikedIt is possible we choise to open position on next Candle?
Or have a delay from the last order?Ignored
// ------------------------------------------------------------------------------------------------- // // Martingale // *MA Cross // Dynamic Grid // by: Protito 11/September/2016 // ------------------------------------------------------------------------------------------------- using System; using System.Linq; using cAlgo.API; using cAlgo.API.Indicators; using cAlgo.API.Internals; using cAlgo.Indicators; namespace cAlgo { [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)] public class MartingaleBot : Robot { [Parameter("MA Type")] public MovingAverageType MAType { get; set; } [Parameter()] public DataSeries SourceSeries { get; set; } [Parameter("Slow Periods", DefaultValue = 10)] public int slowPeriods { get; set; } [Parameter("Fast Periods", DefaultValue = 5)] public int fastPeriods { get; set; } [Parameter("Martingale Factor", DefaultValue = 1.5)] public double mgFactor { get; set; } [Parameter("Min. Grid size", DefaultValue = 150)] public int minGridSize { get; set; } [Parameter("Periods Grid", DefaultValue = 30)] public int gridPeriod { get; set; } [Parameter("Initial Lot Size", DefaultValue = 0.02)] public double iniLotSize { get; set; } [Parameter("Target Profit (money)", DefaultValue = 3.0)] public double targetProfit { get; set; } [Parameter("Min. Margin Level(%)", DefaultValue = 100)] public double minMarginLevel { get; set; } private MovingAverage slowMa; private MovingAverage fastMa; private RelativeStrengthIndex rsi; bool buyTradeActive = false; bool sellTradeActive = false; TradeType tradeType = TradeType.Buy; double currentGridSize = 0; int mgLevel = 1; Position basePosition = null; double currentMgVolume; long currentMgVolumeInt; bool invertedBuy = false; bool invertedSell = false; protected override void OnStart() { currentMgVolume = iniLotSize * 100000; currentMgVolumeInt = Convert.ToInt64(currentMgVolume); fastMa = Indicators.MovingAverage(SourceSeries, fastPeriods, MAType); slowMa = Indicators.MovingAverage(SourceSeries, slowPeriods, MAType); rsi = Indicators.RelativeStrengthIndex(SourceSeries, 9); currentGridSize = minGridSize; if (Init("Sell")) { sellTradeActive = true; tradeType = TradeType.Buy; } if (Init("Buy")) { buyTradeActive = true; tradeType = TradeType.Sell; } } private bool Init(string tradeTypeString) { if (Positions.Find("MGBase" + tradeTypeString + Symbol.Code) != null) { basePosition = Positions.Find("MGBase" + tradeTypeString + Symbol.Code); foreach (Position p in Positions.FindAll("MG" + tradeTypeString + Symbol.Code)) { mgLevel++; currentMgVolume *= mgFactor; } return true; } return false; } protected override void OnTick() { if (buyTradeActive || sellTradeActive) { AdjustGrid(); CheckProfit(); TickOperation(); } } protected override void OnBar() { if (buyTradeActive || sellTradeActive) { return; } var currentSlowMa = slowMa.Result.Last(0); var currentFastMa = fastMa.Result.Last(0); var previousSlowMa = slowMa.Result.Last(1); var previousFastMa = fastMa.Result.Last(1); bool rsiBuy = rsi.Result.IsRising(); bool rsiSell = rsi.Result.IsFalling(); //Buy signal if (previousSlowMa > previousFastMa && currentSlowMa <= currentFastMa && rsiBuy) { if (OpenPosition("Buy")) buyTradeActive = true; } //Sell signal else if (previousSlowMa < previousFastMa && currentSlowMa >= currentFastMa && rsiSell) { if (OpenPosition("Sell")) sellTradeActive = true; } } private void AdjustGrid() { double low = MarketSeries.Low.Minimum(gridPeriod); double high = MarketSeries.High.Maximum(gridPeriod); double distance = high - low; double distancePips = distance / Symbol.PipSize; double newGrid = distancePips * 10 * 0.23; if (newGrid < minGridSize) currentGridSize = minGridSize; else currentGridSize = newGrid; } private bool OpenPosition(string tradeTypeString) { tradeType = TradeType.Buy; if (tradeTypeString == "Sell") tradeType = TradeType.Sell; var result = ExecuteMarketOrder(tradeType, Symbol, currentMgVolumeInt, "MGBase" + tradeTypeString + Symbol.Code); if (!result.IsSuccessful) { return false; } basePosition = result.Position; Print(tradeTypeString + " BASE Position open at: " + basePosition.EntryPrice); return true; } private void TickOperation() { if (!WorkingHours()) return; string tradeTypeString = ""; if (Symbol.Ask < basePosition.EntryPrice - mgLevel * currentGridSize * Symbol.PipSize / 10 && buyTradeActive) { tradeTypeString = "Buy"; } else if (Symbol.Bid > basePosition.EntryPrice + mgLevel * currentGridSize * Symbol.PipSize / 10 && sellTradeActive) { tradeTypeString = "Sell"; } else return; mgLevel++; currentMgVolume *= mgFactor; currentMgVolumeInt = Convert.ToInt64(currentMgVolume) / 1000 * 1000; var result = ExecuteMarketOrder(tradeType, Symbol, currentMgVolumeInt, "MG" + tradeTypeString + Symbol.Code); if (!result.IsSuccessful) { mgLevel--; currentMgVolume /= mgFactor; return; } Print(tradeTypeString + " Position open at " + result.Position.EntryPrice + " Volume(double): " + currentMgVolume + " GridSize: " + currentGridSize); } private bool WorkingHours() { //return true; var currentHour = Server.Time.TimeOfDay.TotalHours; if (currentHour > 1.25 && currentHour < 5.75) return true; if (currentHour > 7.25 && currentHour < 17.25) return true; return false; } private bool CheckProfit() { string tradeTypeString = "Buy"; if (sellTradeActive) tradeTypeString = "Sell"; double profit = 0; profit += basePosition.NetProfit; foreach (Position p in Positions.FindAll("MGBuy" + Symbol.Code)) { profit += p.NetProfit; } foreach (Position p in Positions.FindAll("MGSell" + Symbol.Code)) { profit += p.NetProfit; } if (profit >= targetProfit) { CloseAll(); } Colors labelColor = Colors.LightGreen; if (Account.MarginLevel < minMarginLevel) { CloseAll(); } if (profit < 0) labelColor = Colors.LightSalmon; string labelText = "## MG " + tradeTypeString + " Order ##"; labelText += "\nDepth:\t" + mgLevel; labelText += "\nProfit:\t " + profit; labelText += "\nGrid:\t" + currentGridSize; ChartObjects.DrawText("Label1", labelText, StaticPosition.TopLeft, labelColor); //Print("Profit: " + profit); return false; } private void CloseAll() { Print("-- Closed All"); foreach (Position p in Positions.FindAll("MGSell" + Symbol.Code)) { ClosePositionAsync(p); } foreach (Position p in Positions.FindAll("MGBuy" + Symbol.Code)) { ClosePositionAsync(p); } ClosePositionAsync(basePosition); buyTradeActive = false; sellTradeActive = false; mgLevel = 1; currentMgVolume = iniLotSize * 100000; currentMgVolumeInt = Convert.ToInt64(currentMgVolume); } } }
Disliked- I have a own Indicator for ADR - ADR I use = monthly + weekly + last day : 3 = example EU 89 EF 40 UF 88 - I look by London open time 7:15 GMT about ADR and change the GridSize or not - is the ADR from the last day much greater or little, then I change with this the settings I read here the ADR / tomorrow in the morning 7:00 GMT I will sent a newest picture from the ADR {image}Ignored