Category Other  Published on 25/03/2017

Advanced Grid System 1.0

Description

Advanced Grid cBot 1.0 by Rambutan Capital

Version 1.0 – February 2017


Demo Files & User Manual with Screenshots: https://goo.gl/tfVHYY 

Video Demonstration 1: https://youtu.be/T9sM7Y1Cbgw

Video Demonstration 2: https://youtu.be/5ZO7eaxmWvY

Buy License Key Here: https://gum.co/VHPDA

First 15 purchases receive $15 off using discount code "welovebots" - only 4 left !


Key Features

A very powerful combination of:

  • Advanced Grid System
  • Cap/Collar System
  • Daily EMA System
  • Parabolic Stop-and-Reverse System
  • Account, Risk and Volume Management

Summary

Rambutan Capital’s Advanced Grid system can be used with any FX Pair. It has been developed by a team of USD/JPY and EUR/USD analysts, traders and c# coders based in Sydney, Australia.

We use Pepperstone as our broker, and have back tested this strategy on major FX pairs over a 2 year horizon on tick data mode.

Parameters Explained [Recommended Settings for USD/JPY, M1]

Account Parameters

License Key: License Key available on purchase. Back testing will only be performed on Demo accounts

Account Opening Balance: Initial deposit or opening account balance at time of starting cBot [USDJPY: 10,000]

Stop cBot at +Equity Level: cBot will stop running when the account equity position rises by the amount defined in this field. Note that account equity position will be affected by other positions independent from this cBot.

Stop cBot at -Equity Level: cBot will stop running when the account equity position falls by the amount defined in this field. Note that account equity position will be affected by other positions independent from this cBot. Can be used as draw down risk mitigation [USDJPY: -5,000, i.e. 50% account drawdown]

Entry Parameters

Buy: Yes, or No for Long entries [USDJPY: Yes]

Sell: Yes, or No for Short entries [USDJPY: Yes]                                                                                                       

Buy Under Price: The bot will only enter Long trades below the price defined. Creates a Cap and Collar of trade opportunities when used. Recommend to use a cap value where the trader believes the currency pair is overvalued [USDJPY: 116]

Sell Over Price: The bot will only enter Short trades below the price defined. Creates a Cap and Collar of trade opportunities when used. Recommend to use a collar value where the trader believes the currency pair is undervalued [USDJPY: 110]

Max Spread Tolerance: The bot will only enter trades within the Spread tolerance defined [USDJPY: 1 pip]

Exit Parameters

Average Target Price: The cBot will automatically modify the average target price of all individual Long (and Short positions) to the target amount [USDJPY: 25 pips]

Stop Loss: The stop loss attached to each Long or Short position. The wider the stop loss, the more plausible and effective the Grid System will be [USDJPY: 1000 pips]

Enable Trailing Stop: Yes, or No for to attach Trailing Stop orders to each Long or Short position [USDJPY: No]

Trailing Stop: The trailing stop amount to be attached if enabled [USDJPY: N/A]

Trailing Start: The trailing start amount to be attached if enabled [USDJPY: N/A]

Volume Parameters

Account Risk (Risk) is defined as the Account Equity amount divided by the Opening Balance. For example, if account equity becomes $12,000 when the Opening Balance parameter set at $10,000, the Risk multiple becomes 1.20. Conversely, as equity positions decrease, the risk multiple decreases below 1.0

First Volume * e(Risk): Defined as the First Volume to use when there are no existing Long or Short entries. First Volume will mathematically exponentially increase by 2.718 multiplied by the Account Risk value. The cBot will conditionally normalize the volume order with ‘Symbol.NormalizeVolume’ to avoid bad volume errors and rejections from your broker.  [USDJPY: 15,000]

Volume Multiplier on Step: For each grid step, multiply the trade volume order by a multiple of the volume amount of the preceding order [USDJPY: 1.0]

Max Volume per Trade per Step * Risk: Defined as the maximum Volume to use on each grid step relative to Account Risk [USDJPY: 15,000]

Daily Exponential Moving Average Parameters

EMA (Daily – Fast): The ‘fast’ exponential moving average on a daily frame over X periods. The cBot will enter Long/Short when this daily parameter is either Rising/Falling.  This parameter condition applies to all grid orders [USDJPY: 5 periods]

EMA (Daily – Slow): The ‘slow’ exponential moving average on a daily frame over X periods. The cBot will enter Long/Short when this daily parameter is either Rising/Falling. This parameter condition applies to all grid orders [USDJPY: 5 periods]

Grid Parameters

Pip Step in Profit: The Grid feature of this cBot will add to existing Long/Short positions that are in profit to maximum grid distance defined by this parameter. Can be thought of as the Anti-Grid method for adding to winning positions until the average target is reached [USDJPY: 30 pips, i.e. Not used]

Max Positions to Add in Profit: The cBot will add positions to this maximum count value when existing positions are in unrealized gain [USDJPY: 1, i.e. Not used]

Pip Step in Loss: The Grid feature of this cBot will add to existing Long/Short positions that are in loss for each pip step defined by this parameter. This continues for every step to a maximum count value until the average target is reached [USDJPY: 30 pips]

Max Positions to Add in Loss: The cBot will add positions to this maximum count value when existing positions are in unrealized loss [USDJPY: 30]

High Minus Low Parameter

High Minus Low Hurdle Level: The cBot will only execute a first order when the High Minus Low value is above the specified hurdle level. This parameter does not apply to grid step orders. [USDJPY: 0.10]

Parabolic SAR Parameter

The cBot will execute Long/Short when Market Price is Below/Above the main PSAR value. This condition applies the following view;

Prices will eventually rise (i.e. Stop and Reverse) when below PSAR and prices will eventually fall when above PSAR. This view becomes extremely effectively when used in conjunction with a Grid and Cap/Collar system.

PSaR Min AF Step: For the recommend settings and M1 timeframe, a non-sensitive value is recommended [USDJPY: 0.0004]

PSaR Max AF: Use default PSaR max value [USDJPY: 0.2]

Contact

Question and Support or trial copies, please contact the team!

Email: RambutanCapital@gmail.com

 Twitter Handle: @RambutanCapital

 


//Advanced Grid cBot

//Version 1.0 – February 2017

//Demo Files & User Manual with Screenshots: https://drive.google.com/open?id=0B3x2HKHjgIAaUFJJaFhNVjZRUGc

//Video Demonstration 1: https://youtu.be/T9sM7Y1Cbgw

//Video Demonstration 2: https://youtu.be/5ZO7eaxmWvY

//Buy License Key Here: https://gum.co/VHPDA


















// -------------------------------------------------------------------------------------------------
//
//    This code is a cAlgo API sample.
//
//    This cBot is intended to be used as a sample and does not guarantee any particular outcome or
//    profit of any kind. Use it at your own risk
//
// -------------------------------------------------------------------------------------------------

using System;
using System.Linq;
using cAlgo.API;
using cAlgo.API.Internals;

namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class SampleAdvancedTakeProfit : Robot
    {
        private const string DefaultPositionIdParameterValue = "PID";

        [Parameter("Position Id", DefaultValue = DefaultPositionIdParameterValue)]
        public string PositionId { get; set; }

        [Parameter("Take Profit 1 Enabled", DefaultValue = false)]
        public bool TakeProfit1Enabled { get; set; }

        [Parameter("Take Profit 1 Pips", DefaultValue = 10)]
        public double TakeProfit1Pips { get; set; }

        [Parameter("Take Profit 1 Volume", DefaultValue = 1000)]
        public int TakeProfit1Volume { get; set; }

        [Parameter("Take Profit 2 Enabled", DefaultValue = false)]
        public bool TakeProfit2Enabled { get; set; }

        [Parameter("Take Profit 2 Pips", DefaultValue = 20)]
        public double TakeProfit2Pips { get; set; }

        [Parameter("Take Profit 2 Volume", DefaultValue = 2000)]
        public int TakeProfit2Volume { get; set; }

        [Parameter("Take Profit 3 Enabled", DefaultValue = false)]
        public bool TakeProfit3Enabled { get; set; }

        [Parameter("Take Profit 3 Pips", DefaultValue = 10)]
        public double TakeProfit3Pips { get; set; }

        [Parameter("Take Profit 3 Volume", DefaultValue = 3000)]
        public int TakeProfit3Volume { get; set; }

        private TakeProfitLevel[] _levels;

        private Symbol _symbol;

        protected override void OnStart()
        {
            if (PositionId == DefaultPositionIdParameterValue)
                PrintErrorAndStop("You have to specify \"Position Id\" in cBot Parameters");

            var position = FindPositionOrStop();
            _symbol = GetSymbol(position);
            _levels = GetTakeProfitLevels();

            ValidateLevels(position);
        }

        private Symbol GetSymbol(Position position)
        {
            return MarketData.GetSymbol(position.SymbolCode);
        }

        private void ValidateLevels(Position position)
        {
            MakeSureAnyLevelEnabled();
            ValidateTotalVolume(position);
            ValidateReachedLevels(position);
            ValidateVolumes();
        }

        private void ValidateVolumes()
        {
            var enabledLevels = _levels.Where(level => level.IsEnabled);
            foreach (var level in enabledLevels)
            {
                if (level.Volume < _symbol.VolumeMin)
                    PrintErrorAndStop("Volume for " + _symbol.Code + " cannot be less than " + _symbol.VolumeMin);
                if (level.Volume > _symbol.VolumeMax)
                    PrintErrorAndStop("Volume for " + _symbol.Code + " cannot be greater than " + _symbol.VolumeMax);
                if (level.Volume % _symbol.VolumeMin != 0)
                    PrintErrorAndStop("Volume " + level.Volume + " is invalid");
            }
        }

        private void ValidateReachedLevels(Position position)
        {
            var reachedLevel = _levels.FirstOrDefault(l => l.Pips <= position.Pips);
            if (reachedLevel != null)
                PrintErrorAndStop("Level " + reachedLevel.Name + " is already reached. The amount of Pips must be more than the amount of Pips that the Position is already gaining");
        }

        private void MakeSureAnyLevelEnabled()
        {
            if (_levels.All(level => !level.IsEnabled))
                PrintErrorAndStop("You have to enable at least one \"Take Profit\" in cBot Parameters");
        }

        private void ValidateTotalVolume(Position position)
        {
            var totalVolume = _levels.Where(level => level.IsEnabled).Sum(level => level.Volume);

            if (totalVolume > position.Volume)
                PrintErrorAndStop("The sum of all Take Profit respective volumes cannot be larger than the Position's volume");
        }

        private TakeProfitLevel[] GetTakeProfitLevels()
        {
            return new[] 
            {
                new TakeProfitLevel("Take Profit 1", TakeProfit1Enabled, TakeProfit1Pips, TakeProfit1Volume),
                new TakeProfitLevel("Take Profit 2", TakeProfit2Enabled, TakeProfit2Pips, TakeProfit2Volume),
                new TakeProfitLevel("Take Profit 3", TakeProfit3Enabled, TakeProfit3Pips, TakeProfit3Volume)
            };
        }

        private Position FindPositionOrStop()
        {
            var position = Positions.FirstOrDefault(p => "PID" + p.Id == PositionId || p.Id.ToString() == PositionId);
            if (position == null)
                PrintErrorAndStop("Position with Id = " + PositionId + " doesn't exist");

            return position;
        }

        private void PrintErrorAndStop(string errorMessage)
        {
            Print(errorMessage);
            Stop();

            throw new Exception(errorMessage);
        }

        protected override void OnTick()
        {
            var position = FindPositionOrStop();
            var reachedLevels = _levels.Where(level => level.IsEnabled && !level.IsTriggered && level.Pips <= position.Pips);

            foreach (var reachedLevel in reachedLevels)
            {
                reachedLevel.MarkAsTriggered();

                Print("Level \"" + reachedLevel.Name + "\" is reached. Level.Pips: " + reachedLevel.Pips + ", Position.Pips: " + position.Pips + ", Position.Id: " + position.Id);
                var volumeToClose = Math.Min(reachedLevel.Volume, position.Volume);
                ClosePosition(position, volumeToClose);

                if (!LastResult.IsSuccessful)
                    Print("Cannot close position, Id: " + position.Id + ", Error: " + LastResult.Error);

                var remainingLevels = _levels.Where(level => level.IsEnabled && !level.IsTriggered);
                if (!remainingLevels.Any())
                {
                    Print("All levels were reached. cBot is stopping...");
                    Stop();
                    return;
                }
            }
        }
    }

    internal class TakeProfitLevel
    {
        public string Name { get; private set; }

        public bool IsEnabled { get; private set; }

        public double Pips { get; private set; }

        public int Volume { get; private set; }

        public bool IsTriggered { get; private set; }

        public TakeProfitLevel(string name, bool isEnabled, double pips, int volume)
        {
            Name = name;
            IsEnabled = isEnabled;
            Pips = pips;
            Volume = volume;
        }

        public void MarkAsTriggered()
        {
            IsTriggered = true;
        }
    }
}


rambutancapital's avatar
rambutancapital

Joined on 26.02.2017

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: RAMBUTAN CAPITAL - Sample.algo
  • Rating: 0
  • Installs: 3312
Comments
Log in to add a comment.
AB
ABC1 · 7 years ago

Hi, demo does not work. Please advise

ZA
zarathustra · 7 years ago

high dd. Not good

VA
Valium · 7 years ago

"this system had been deleted by user" - myfxbook link...

another dud trying to make a few bucks!

BA
Bagina · 7 years ago
rambutancapital's avatar
rambutancapital · 7 years ago

After 10 trading days, cBot is up 28.2% in equity.  FXBOOK --> https://goo.gl/2YKssP​

The large -pips realised loss (and drawdown during the 2 weeks)  due to the USDJPY cbot malfunction and stopping on the VPS without us realising. We rebooted the VPS and restarted nonetheless.