Conqueror Bot free

by evgrinaus in category Trend at 21/01/2021

Derived from "How to Make a Living Trading Foreign Exchange" by Courtney D. Smith

This is a trend following, long term system, so scalpers may leave now.

This robot uses simple indicators to show when it is safe to buy, safe to sell or just stay out of the market

They are:

1. Today's close is less than the 10-day moving average of the close.

2. Today's 10-day moving average is less than the 10-day moving average 10 days ago.

3. Today's close is less than the close of 40 days ago.

Utilizing the NNFX money management of ATR and 2% risk.

Feel free to use it at your own risk.

If anyone has a Ctrader indicator that can show this it would be appreciated.

Learned by watching NNFX Bot on Youtube. 


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 System.Linq;
using cAlgo.API;
using cAlgo.API.Indicators;
using cAlgo.API.Internals;
using cAlgo.Indicators;

namespace cAlgo.Robots
    //Set time zone to Eastern Standard Time EP9-Best time to trade
    [Robot(TimeZone = TimeZones.EasternStandardTime, AccessRights = AccessRights.None)]
    public class Template : Robot
        //Create Parameters EP10-Functions and Parameters
        [Parameter("Risk %", DefaultValue = 0.02)]
        public double RiskPct { get; set; }

        //Create indicator variables EP5-ATR
        private AverageTrueRange atr;
        public string botName;
        private MovingAverage hma10;

        protected override void OnStart()
            //Get Name of Bot and Currency pair of current instance EP15-Deploy
            botName = GetType().ToString();
            botName = botName.Substring(botName.LastIndexOf('.') + 1) + "_" + SymbolName;

            //Load indicators on start up EP5-ATR
            atr = Indicators.AverageTrueRange(14, MovingAverageType.Exponential);
            hma10 = Indicators.MovingAverage(Bars.ClosePrices, 10, MovingAverageType.Hull);


        protected override void OnTick()
            // Put your core logic here EP7-MACD and EP8-Custom Indicators
            var price = Bars.ClosePrices;
            var hmasmall = hma10.Result.Last(0);
            var hma10daysago = hma10.Result.Last(10);
            var Price40daysago = Bars.ClosePrices.Last(40);

            //check for entry signal
            if (price.Last(0) < hmasmall & hmasmall < hma10daysago & price.Last(0) < Price40daysago)
                Open(TradeType.Buy, "Conqueror");

            else if (price.Last(0) > hmasmall & hmasmall > hma10daysago & price.Last(0) > Price40daysago)
                Open(TradeType.Sell, "Conqueror");

        //Function for opening a new trade - EP10-Functions and Parameters
        private void Open(TradeType tradeType, string Label)
            //Calculate trade amount based on ATR - EP6-Money Management
            var ATR = Math.Round(atr.Result.Last(0) / Symbol.PipSize, 0);
            var TradeAmount = (Account.Equity * RiskPct) / (1.5 * ATR);
            // * Symbol.PipValue);
            TradeAmount = Symbol.NormalizeVolumeInUnits(TradeAmount, RoundingMode.Down);

            //Check there's no existing position before entering a trade
            var position = Positions.Find(Label, SymbolName);
            //Set trade entry time - EP9-Best time to trade
            if (position == null)
//            & Server.Time.Hour == 16 & Server.Time.Minute == 29)
                ExecuteMarketOrder(tradeType, SymbolName, TradeAmount, Label, 1.5 * ATR, ATR);

        //Function for closing trades - EP10-Functions and Parameters
        private void Close(TradeType tradeType, string Label)
            foreach (var position in Positions.FindAll(Label, SymbolName, tradeType))