Black Corvette free

by Quant in category Range at 12/01/2014
Description

Symbol: EURUSD
Time frame: Minute5
Backtesting period: 01/04/2011-12/01/2014 (almost 3 years)

Robot is based on Bollinger Bands indicator which combines moving averages and standard deviation. The main purpose of Bollinger Bands is to provide price range. If you know the range you can buy at minimum price level and sell at maximum price level.

Robot is listening to following Bollinger Bands signals:

  • close price is above top Bollinger Bands line. Actions: close long position, open short position
  • close price is bellow bottom Bollinger Bands line. Actions: close short position, open buy position

Backtesting report:

Balance-equity chart:

 

Warning! Executing the following cBot may result in loss of funds. Use it at your own risk.
Notification Publishing copyrighted material is strictly prohibited. If you believe there is copyrighted material in this section you may use the Copyright Infringement Notification form to submit a claim.
Formula / Source Code
Language: C#
Trading Platform: cAlgo
using System;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;
using System.Linq;

namespace cAlgo.Robots
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class BlackCorvette : Robot
    {
        const string Label = "BlackCorvette robot label";

        [Parameter(DefaultValue = 30)]
        public int Period { get; set; }

        [Parameter(DefaultValue = 2.5)]
        public double StandardDeviation { get; set; }

        [Parameter(DefaultValue = MovingAverageType.TimeSeries)]
        public MovingAverageType MAType { get; set; }

        [Parameter(DefaultValue = 10000)]
        public int Volume { get; set; }

        [Parameter(DefaultValue = 113)]
        public int StopLoss { get; set; }

        [Parameter(DefaultValue = 193)]
        public int TakeProfit { get; set; }

        private BollingerBands _bb;
        private TradeType _lastTradeType;

        protected override void OnStart()
        {
            if (Symbol.Code != "EURUSD" || TimeFrame != TimeFrame.Minute5)
            {
                Print("This robot can be run only on EURUSD Minute5");
                Stop();
                return;
            }

            _bb = Indicators.BollingerBands(MarketSeries.High, Period, StandardDeviation, MAType);
        }

        protected override void OnBar()
        {
            var index = MarketSeries.Close.Count - 2;
            var position = Positions.Find(Label);

            if (MarketSeries.Close[index] > _bb.Top[index] && MarketSeries.Close[index - 1] <= _bb.Top[index - 1] && _lastTradeType != TradeType.Sell)
            {
                if (position != null)
                    ClosePosition(position);
                ExecuteMarketOrder(TradeType.Sell, Symbol, Volume, Label, StopLoss, TakeProfit);
                _lastTradeType = TradeType.Sell;
            }
            if (MarketSeries.Close[index] < _bb.Bottom[index] && MarketSeries.Close[index - 1] <= _bb.Bottom[index - 1] && _lastTradeType != TradeType.Buy)
            {
                if (position != null)
                    ClosePosition(position);
                ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, Label, StopLoss, TakeProfit);
                _lastTradeType = TradeType.Buy;
            }
        }
    }
}
Comments

oktrader - January 29, 2014 @ 00:35

Why in the second condition you write this:

MarketSeries.Close[index - 1] <= _bb.Bottom[index - 1]

instead of that:

MarketSeries.Close[index - 1] >= _bb.Bottom[index - 1]

?

jumpsolid1 - April 13, 2016 @ 11:16

Hello if someone still look @ this one,

which settings do you use?

Regards

 

J.

0