Description
Hello Traders and FX aficionados
Here we meet again with a new cBot.
This time I’m showcasing one of my oldest cBots, the MEDIAN MULTI , which is a trading robot.
THE CBOT Enclosed into the post is just a template from the cAlgo installation.
IF YOU LIKE THE RESULTS ABOVE AND WOULD LIKE TO TRY YOURSELF, you can download the backtesting only version from https://bregu.al/wpv1/automated-trading-robot-median-multi/ .
As you can see from the stats it has managed to turn 10k $ in more than 76k $ , from 08/02/2011 to 25/12/2016.
I always backtest my robots with a commission of 100$ , just to cover any swap effects which might not be included.
Total trades of 69474 for the period aforementioned
Also from the Equity Chart you can see the very small drawdown due to the volume size of mainly 1k.
THE CBOT Enclosed into the post is just a template from the cAlgo installation.
IF YOU LIKE THE RESULTS ABOVE AND WOULD LIKE TO TRY YOURSELF, you can download the backtesting only version from https://bregu.al/wpv1/automated-trading-robot-median-multi/ .
The settings used are as shown into the pictures.
Update with EURUSD, going from 10k $ to more than 300k $ , and EURGBP going from 10 k $ to more than 50k $.
The theory behind this robot is almost foolproof and it shoud work on all pairs, with the right settings.
Have Fun and enjoy your time trading
https://bregu.al/wpv1/automated-trading-robot-median-multi/
Oltion Bregu
// -------------------------------------------------------------------------------------------------
//
// 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.
//
// The "Sample Trend cBot" will buy when fast period moving average crosses the slow period moving average and sell when
// the fast period moving average crosses the slow period moving average. The orders are closed when an opposite signal
// is generated. There can only by one Buy or Sell order at any time.
//
// -------------------------------------------------------------------------------------------------
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 SampleTrendcBot : 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(DefaultValue = 10000, MinValue = 0)]
public int Volume { get; set; }
private MovingAverage slowMa;
private MovingAverage fastMa;
private const string label = "Sample Trend cBot";
protected override void OnStart()
{
Print("Hope you will enjoy this dashboard and use it everyday");
Print("please visit us @ https://www.bregu.al and contact me directly form the contact page");
Print("If want to know more about this robot or think that something can be improved, ");
fastMa = Indicators.MovingAverage(SourceSeries, FastPeriods, MAType);
slowMa = Indicators.MovingAverage(SourceSeries, SlowPeriods, MAType);
}
protected override void OnTick()
{
Print("Hope you will enjoy this dashboard and use it everyday");
Print("please visit us @ https://www.bregu.al and contact me directly form the contact page");
Print("If you want to know more about this robot or think that something can be improved, ");
var longPosition = Positions.Find(label, Symbol, TradeType.Buy);
var shortPosition = Positions.Find(label, Symbol, TradeType.Sell);
var currentSlowMa = slowMa.Result.Last(0);
var currentFastMa = fastMa.Result.Last(0);
var previousSlowMa = slowMa.Result.Last(1);
var previousFastMa = fastMa.Result.Last(1);
if (previousSlowMa > previousFastMa && currentSlowMa <= currentFastMa && longPosition == null)
{
if (shortPosition != null)
ClosePosition(shortPosition);
ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, label);
}
else if (previousSlowMa < previousFastMa && currentSlowMa >= currentFastMa && shortPosition == null)
{
if (longPosition != null)
ClosePosition(longPosition);
ExecuteMarketOrder(TradeType.Sell, Symbol, Volume, label);
}
}
}
}
9544315
Joined on 29.12.2015
- Distribution: Free
- Language: C#
- Trading platform: cTrader Automate
- File name: Median_MULTI_NO_DEMO.algo
- Rating: 0
- Installs: 3041
- Modified: 13/10/2021 09:54
Comments
How do I download the full version? Or, can it be purchased?
Hi,
So what's the principle behind this bot?
Can it be used on live accounts?
Thanks!
Great sample template, thanks