Hedging and Scalping cBot

by skoutz.rothchild in category Trend at 16/05/2017

A simple cBot that uses hedging ans scalping.


  • Can make you nice profits in consolidating markets.
  • It can blow your account in trending markets.
  • Use always in context. 
  • Volume intensive. Use brokers with low commisions and tight spreads for better results.
  • Use at your own risk

Backtesting based on EURUSD and h1 for last two years in which EURUSD are in a rather consolidating state.

How to install
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
// -------------------------------------------------------------------------------------------------
//    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 Martingale cBot" creates a random Sell or Buy order. If the Stop loss is hit, a new 
//    order of the same type (Buy / Sell) is created with double the Initial Volume amount. The cBot will 
//    continue to double the volume amount for  all orders created until one of them hits the take Profit. 
//    After a Take Profit is hit, a new random Buy or Sell order is created with the Initial Volume amount.
// -------------------------------------------------------------------------------------------------

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 HedgingandScalpingAlgo : Robot

        [Parameter("Volume", DefaultValue = 1000, MinValue = 1000, Step = 1000)]
        public int Volume { get; set; }
        protected override void OnStart()

        protected override void OnBar()
            ExecuteMarketOrder(TradeType.Buy, Symbol, Volume, "BUY");
            ExecuteMarketOrder(TradeType.Sell, Symbol, Volume, "SELL");
            foreach (var position in Positions)
                if (position.Pips > 2)




boyrayza - May 29, 2017 @ 06:10

hi . when it TP for Order? EA. or User ? i Dont see in code to Take Profit. ?

Thank you ^ ^

skoutz.rothchild - May 29, 2017 @ 15:46

Profit is taken when a position earns more than 2 pips

nilesh400@gmail.com - June 02, 2017 @ 14:28

Hi, seems to take up 20+ positions at a time. What is the max it will take on?

Also - what are your stop loss limits?  and how do you stop them all?

yosifov - June 19, 2017 @ 15:28


if (position.Pips > 2) doesnt seems to work correct .... I have position already 15 pips in profit, but the cBot doesnt close the the position. why?

skoutz.rothchild - June 21, 2017 @ 15:07


In which timeframe to you trade? Positions close on bar change

agapitoharmony - July 30, 2017 @ 18:53

Hi cant see this on my ctrader account, Indicators - Custom. Any workaround for this, thank you. Tested on cAlgo but cant be seen on cTrader.


ctid357966 - August 25, 2017 @ 03:59

When Hedging and Scalping cBot close loss position? Where stop-loss?