cwik_m's avatar
~ Don't stop until you're proud
cwik_m's avatar


Member since: 26 Jun 2018




~ Don't stop until you're proud

Last Algorithm Comments

@pankaj bhandari:  26 Apr 2021, 11:37

That’s an exact copy line-by-line of the indicator I added couple of weeks ago. Wondering why you added it again

@Fisher Transformation:  08 Jul 2018, 19:04

Most of your indicators are great! and really useful Unfortunatelly, this one doesn't show anything once loaded onto the chart Moreover, the variable from line 22 (int tr = 0;) is not used anywhere.. Could you, by any chance, look into this code again, please?

Last Forum Posts

@cTrader Community Member of the Month - January:  02 Mar 2021, 08:23

Nice initiative with the Award, Spotware.

And congratulations, Paul Hayes! I myself began learning to code from your videos back in 2018 when Youtube had almost no tutorials on cAlgo. With the knowledge you shared I began learning from scratch. Keep doing the amazing job and good luck!

@QuickStart - Execute market order:  29 Jun 2018, 09:15

May I ask what exactly this piece of code does ?

And why its necessary in the above sample cBot code?

Positions.Opened += OnPositionsOpened;
Positions.Closed += OnPositionsClosed;

@inport an indicator:  26 Jun 2018, 17:28

Panagiotis Charalampous said:

Hi cwik_m.

The reason is that the cBot seems to crash due to a wrong number of parameters when initializing the indicator. Change your initialization code to the following

 fastMa = Indicators.GetIndicator<HullMovingAverage>(MarketSeries.Close, 21);

Best Regards,


Thank you Mr Panagiotis! It seems to work properly now!

@inport an indicator:  26 Jun 2018, 16:40

Thank you Mr Panagiotis,

I am surprised it worked now (according to your version of the code and the HullMovingAverage I am very thankful for such quick help.

Unfortunatelly while doing the backtesting - this cBot code you posted makes no trades. Seems that it cannot retrieve the Hull MA values from the custom indicator into the cBot.

Could you advise please how code the cBot to get access to these list of values or dataseries (like from any Moving Average or Indicator - I mean these references and ?

@inport an indicator:  26 Jun 2018, 14:58

Panagiotis Charalampous said:

Hi cwik_m,

Thanks for posting in our forum. What is the error you receive? Can you please post a screenshot?

Best Regards,


Dear Mr Panagiotis,

Thank you for a quick reply. I have tried to include the Hull MA ( to the Sample Trend cBot. Problem is the cBot cannot build itself because the HMA indicator does not have the 'Result' definition (pls forgive me the error is not in english, although I have set the cTrader language to ENG...)

Below is the cBot full code for your reference

//#reference: C:\Users\HP\Documents\cAlgo\Sources\Indicators\HMA.algo

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 SampleTrend : Robot
        [Parameter("MA Type")]
        public MovingAverageType MAType { get; set; }

        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("Quantity (Lots)", DefaultValue = 1, MinValue = 0.01, Step = 0.01)]
        public double Quantity { get; set; }

        private MovingAverage slowMa;
        private HMA fastMa;
        private const string label = "Sample Trend";

        protected override void OnStart()
            fastMa = Indicators.GetIndicator<HMA>(21);
            slowMa = Indicators.MovingAverage(SourceSeries, SlowPeriods, MAType);

        protected override void OnTick()
            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);

            if (currentSlowMa <= currentFastMa && longPosition == null)
                if (shortPosition != null)
                ExecuteMarketOrder(TradeType.Buy, Symbol, VolumeInUnits, label);
            else if (currentSlowMa >= currentFastMa && shortPosition == null)
                if (longPosition != null)
                ExecuteMarketOrder(TradeType.Sell, Symbol, VolumeInUnits, label);

        private long VolumeInUnits
            get { return Symbol.QuantityToVolumeInUnits(Quantity); }

@inport an indicator:  26 Jun 2018, 12:15

Hello cAlgo fans,

I just want to continue this topic since its the latest one that I have found - I am having the same problems as other traders with importing a custom indicator.

I have started to experiment with using custom indicators from and I have been doing exactly according to this link

Apparently my cAlgo cannot Build successfully ANY robot with ANY custom indicator. Somehow maybe problem is in the code 'GetIndicator'.

I have searched it thoroughly and also checked on other cBots - for example the one RsiAtrII  which is based on a custom indicator PipsAtr

Now If I add the robot and indicator to my cTrader and try to 'Build' the robot, it cannot be built because cannot find any PipsAtr indicator... I mean it cannot 'Get' it onto the cBot script. I am sure it was well tested by the author so the problem is not in the code... Its the same with other custom indicators.

Recently there has been and update of cTrader which merged cAlgo together with cTrader into one tool. Maybe this caused some bug while invoking custom indicators..? Pls note I have done everything according to the instruction for a proper indicator reference as it says here -

Anyone found a reason for that... ?

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.
by cwik_m
free  01 Mar 2021
Found this open-source oscillator online and adapted to C# for cAlgo. It’s a combination of two algorithms applied in a different way. The first one (set MODE to “1”) analyzes the bullish/bearishness of each bar using OHLC prices then averages all percentages to give the final value (the always sum to 100%). The second one (set MODE to “2”) treats the period group of bars as one bar and then determines the sentiment percentage with the OHLC points of the group. The first mode is noisier but also more accurate, whereas the second mode gives smoother results and adds more weight to the price movement range. They can be used separately as Mode = 1 and Mode = 2, or combined as Mode = 0.    
Inverse MFI
by cwik_m
free  16 Aug 2018
The Inverse Fisher Transform version of the MoneyFlowIndex indicator. This method once applied gives more clear and unequivocal signals also helping to avoid some whipsaw trades.  
Inverse Cyber Cycle
by cwik_m
free  16 Aug 2018
The Inverse Fisher Transform version of the CyberCycle indicator. This method once applied gives more clear and unequivocal signals also helping to avoid some whipsaw trades.  
Inverse Fisher RSI
by cwik_m
free  16 Aug 2018
The Inverse Fisher Transform version of RSI indicator created by John Ehlers. The purpose of this indicator is to help with determining the turn points on the market and improve timing decisions. Signals are more clear and unequivocal thanks to smoothing function and logarithmic equation (this method can be applied to most of the oscillator-type indicators). BUY when the indicator crosses over -0.5 or crosses over 0.5 if it has not previously crossed over -0.5. SELL when the indicator crosses under 0.5 or crosses under -0.5 if it has not previously crossed under 0.5.  
Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.

No uploaded.