gmkenneyy's avatar


Member since: 20 Mar 2020





Last Algorithm Comments

@KF_Mtf_MacdStoc_v1:  10 Nov 2022, 00:03

@velu130486 Telegram: TG_KFTD

@Gold cbot no Loss by> Durrani:  03 Sep 2022, 20:16

Anything multiplied by zero would equal zero Your formula for volume is a bit flawed "Account.Balance * 0 * InitialVolumePercent" - The zero should be 1

@Finding Tops and Bottons on stock prices:  31 Jul 2022, 22:50

int barSpan = 10; Bars.HighPrices.Maximum(barSpan); Bars.LowPrices.Minimum(barSpan); will also do the job, no need to reinvent the wheel

@KF - TEMA - DEMA - v3:  31 Jul 2022, 22:47

@lemieuxhelmsis65 Are you sure about that? - Stochastic is an oscillator, so is the DMS. Tema-Dema is not

@PAC (Price Action Channel):  05 Jun 2022, 02:19

Hello, Thanks for uploading the source code for your PAC. 1. May i ask what the Red line is? It seems best to use it in conjunction with the PAC you uploaded.   2. What chart timeframe does the PAC work best on. I'm guessing its the H4? Regards Kenneth


I was under the impression the word 'FREE' means 'no money involved'. So why is this bot not free as advertised?

@Hora Específica de la estrategia:  15 Nov 2021, 13:08

How is this useful to anyone? All it does is place a buy order when a new bar opens. It never places sell orders. There is no logic whatsoever to determine trend direction. The buy order will then wait for however long it takes to hit either SL or TP.  

@MeanReversionOverlayIteration2:  08 Jun 2021, 18:51

También vivo en el centro de BCN. Este indicador suyo no indica nada. No se puede saber la dirección de la tendencia Micro o la tendencia Macro. No hay ninguna indicación de dónde ingresar o colocar su stop-loss. Espero que sepas lo que estás haciendo y cómo comerciar

@Swing Gann Experto:  08 Jun 2021, 16:52

@TraderExperto - i take my hat off to you. You Italians amaze me!!!  To code this indicator is not easy but you managed to achieve this in style !!!  

@Swing Gann Experto:  08 Jun 2021, 16:46

@indrakh - Use H4 You still need to combine this indi with others. It is good for trading Micro-trends(H4 & below). If you are trading Macro trends (D3 - WK1) then this indi should be used for gauging your entry (and remember, you still need the help of other indi's) 

Last Forum Posts

@Stop C Trader automatically removing my indicators:  10 Nov 2021, 17:21

ClickAlgo said:

One possible cause is below.


  while (bars.OpenTimes[0] > Bars.OpenTimes[0])


infinite loop perhaps, this will continue to load data and use all the machines resources until the platform freezes, this could be why the cTrader Sentinal removed the offending indicator.


I only had a quick look, but consider checking this code to see if it is causing the probem.

Thank you!

I moved that while-loop to the OnBar() routine and used a boolean to ensure it only gets called once. It now works like a dream !!!

Thanks again.

@Problem on indicator performance:  10 Nov 2021, 17:21

PanagiotisCharalampous said:

Hi noppanon,

Please skip the following part of the code during backtesting and let us know if this resolves the issue

                while (bars.OpenTimes[0] > Bars.OpenTimes[0])

Best Regards,


Join us on Telegram and Facebook

Thank you!

I moved that while-loop to the OnBar() routine and used a boolean to ensure it only gets called once. It now works like a dream !!!

Thanks again.

@Custom Indicator use inside cBot not working:  20 Jan 2021, 15:57

Best to use visual studio for cAlgo coding. The free version of it works wonders

@Occasional OnTick() system problem:  20 Jan 2021, 15:51

Why are you triggering simultaneous trades instead of one after the other? - its a recipe for disaster in my opinion.

What i would do is trigger one trade first, then after the close of the next bar, i will check if the market is moving in the direction of my trade before increasing my volume on that trade. This way you have a safety net.

@Can't view output from a different timeframe:  20 Jan 2021, 15:44

In the Calculate event - change the first line to "source_index = bars_source_close.Count - index";

@Hi There How to truncate double type in an exact digit precision.:  06 Jan 2021, 17:05

imrealfighter said:

HI there hope you guys doing well in this 2021 want some help here. 

Edit : Problem Solved !!! but welcome to another suggestion and method. Thx.

( From Philippe Leybaert I just edit some ) 

public double RoundDown(this double value, int digits)
     double factor = Math.Pow(10,digits);

     return Math.Truncate(value * factor) / factor;


I want to compare double type with double type (which is a product price with product price or product price with some price level) and I found that we could use double.CompareTo() method.

but have some problem with that 


double a = 1.2345

double b = 1.23456789  if we compare these two on 4 digit precision it will get the equal result right.

so to use double.CompareTo() we need to get b price with an exact digit as a 

I try to use Math.Round() but it doesn't give what I want Round() medthod it add the value of b up 1.2346 instead of 1.2345 

is there a way then? 

Thank you. 

Rounding double b = 1.23456789 to 4 decimal places will give you 1.2346 - so its correct!

@How to get datetime1, datetime2 on the chart:  06 Jan 2021, 16:54

the actual bar gives you your x-axis (bar.OpenTime [datetime]). The price gives you your y-axis (the bar, Open, high, Low or close)

this.Chart.DrawRectangle("RectBU", pos.EntryTime, pos.EntryPrice, curBar.OpenTime, curBar.Open, this.Bullish_Box_Color);

the line above draws a rectangle from an entry-time & price to a bar open time & price

I hope this helps.


@How to get list of running cBots programatically:  06 Jan 2021, 15:57

Can anyone help?


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.
free  10 Nov 2022
Stochastic lovers: Here's an indicator that super-imposes a maximum of 3 Stochastic indicators (each of a different timeframe) onto the current chart In the screen shot below, we can see the Stochastics of the H1 timeframe and also of the H4 both placed on a M5 chart
free  10 Nov 2022
Gives you the ability to supper-impose a moving average line of a higher timeframe onto the current chart. The screen shot below shows the moving average line of the H4 chart on a H1 chart - enjoy!!!
free  10 Nov 2022
A great indicator that combines the Macd & Stochastics of different timefames to give you a birds eye view of the current chart Will find time to put all the code in just one class and then re-upload. At the momment only coders will know what to do with this current code. Bear with me.     ** Source code ** using cAlgo.API; using cAlgo.API.Indicators; namespace cAlgo {     public class ErrorMessage : CustomControl     {         public ErrorMessage(string text)         {             VerticalAlignment = VerticalAlignment.Center;             HorizontalAlignment = HorizontalAlignment.Center;             IsHitTestVisible = false;             var border = new Border              {                 CornerRadius = 8,                 Padding = "40 20",                 BorderColor = Color.DimGray,                 BackgroundColor = "#aa3b3b3b",                 BorderThickness = 1             };             var textBlock = new TextBlock              {                 VerticalAlignment = VerticalAlignment.Center,                 HorizontalAlignment = HorizontalAlignment.Center,                 Text = text,                 ForegroundColor = Color.White             };             border.Child = textBlock;             AddChild(border);         }     }     [Indicator(IsOverlay = true, TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]     public class KF_Mtf_MacdStoc_v1 : Indicator     {         [Parameter(DefaultValue = "26|12|9", Group = "Macd")]         public string D3_L_S_Sig { get; set; }         [Parameter(DefaultValue = "26|12|9", Group = "Macd")]         public string D1_L_S_Sig { get; set; }         [Parameter(DefaultValue = "26|12|9", Group = "Macd")]         public string H4_L_S_Sig { get; set; }         [Parameter(DefaultValue = "26|12|9", Group = "Macd")]         public string H1_L_S_Sig { get; set; }         [Parameter(DefaultValue = "9|3|3", Group = "Stochastic")]         public string D3_kP_kS_dP { get; set; }         [Parameter(DefaultValue = "9|3|3", Group = "Stochastic")]         public string D1_kP_kS_dP { get; set; }         [Parameter(DefaultValue = "9|3|3", Group = "Stochastic")]         public string H4_kP_kS_dP { get; set; }         [Parameter(DefaultValue = "9|3|3", Group = "Stochastic")]         public string H1_kP_kS_dP { get; set; }         [Parameter("Vertical position", Group = "Dashboard", DefaultValue = VerticalAlignment.Bottom)]         public VerticalAlignment DB_Vert_Posn { get; set; }         [Parameter("Horizontal position", Group = "Dashboard", DefaultValue = HorizontalAlignment.Right)]         public HorizontalAlignment DB_Horz_Posn { get; set; }         private Bars D3_brs, D1_brs, H4_brs, H1_brs;         private StochasticOscillator D3_sto, D1_sto, H4_sto, H1_sto;         private MacdCrossOver D3_mco, D1_mco, H4_mco, H1_mco;         private Button btnD3_sto, btnD1_sto, btnH4_sto, btnH1_sto;         private Button btnD3_mco, btnD1_mco, btnH4_mco, btnH1_mco;         private Button btnMicro, btnMacro;         private readonly Color clrBU = Color.FromHex("#009345"), clrBE = Color.FromHex("#F05824");         private Button RenderBtn(string txt, int btnHeight = 1, int btnHwidth = 110)         {             return new Button              {                 Width = btnHwidth,                 Height = 20 * btnHeight,                 Margin = 2,                 Text = txt,                 ForegroundColor = Color.Snow,                 FontWeight = FontWeight.Light,                 FontSize = 10,                 FontFamily = "Arial"             };         }         protected override void Initialize()         {             RefreshData();             H1_brs = MarketData.GetBars(TimeFrame.Hour);             H4_brs = MarketData.GetBars(TimeFrame.Hour4);             D1_brs = MarketData.GetBars(TimeFrame.Daily);             D3_brs = MarketData.GetBars(TimeFrame.Day3);             while (H1_brs.OpenTimes[0] > Bars.OpenTimes[0])                 H1_brs.LoadMoreHistory();             while (H4_brs.OpenTimes[0] > Bars.OpenTimes[0])                 H4_brs.LoadMoreHistory();             D3_mco = Indicators.MacdCrossOver(D3_brs.ClosePrices, D3_L_S_Sig.GV(0), D3_L_S_Sig.GV(1), D3_L_S_Sig.GV(2));             D1_mco = Indicators.MacdCrossOver(D1_brs.ClosePrices, D1_L_S_Sig.GV(0), D1_L_S_Sig.GV(1), D1_L_S_Sig.GV(2));             H4_mco = Indicators.MacdCrossOver(H4_brs.ClosePrices, H4_L_S_Sig.GV(0), H4_L_S_Sig.GV(1), H4_L_S_Sig.GV(2));             H1_mco = Indicators.MacdCrossOver(H1_brs.ClosePrices, H1_L_S_Sig.GV(0), H1_L_S_Sig.GV(1), H1_L_S_Sig.GV(2));             D3_sto = Indicators.StochasticOscillator(D3_brs, D3_kP_kS_dP.GV(0), D3_kP_kS_dP.GV(1), D3_kP_kS_dP.GV(2), MovingAverageType.Simple);             D1_sto = Indicators.StochasticOscillator(D1_brs, D1_kP_kS_dP.GV(0), D1_kP_kS_dP.GV(1), D1_kP_kS_dP.GV(2), MovingAverageType.Simple);             H4_sto = Indicators.StochasticOscillator(H4_brs, H4_kP_kS_dP.GV(0), H4_kP_kS_dP.GV(1), H4_kP_kS_dP.GV(2), MovingAverageType.Simple);             H1_sto = Indicators.StochasticOscillator(H1_brs, H1_kP_kS_dP.GV(0), H1_kP_kS_dP.GV(1), H1_kP_kS_dP.GV(2), MovingAverageType.Simple);             const int half = 55;             var hdr_St = RenderBtn("Stoc", 1, half);             var hdr_Md = RenderBtn("Macd", 1, half);             btnD3_sto = RenderBtn("D3", 1, half);             btnD3_mco = RenderBtn("D3", 1, half);             btnD1_sto = RenderBtn("D1", 1, half);             btnD1_mco = RenderBtn("D1", 1, half);             btnH4_sto = RenderBtn("H4", 1, half);             btnH4_mco = RenderBtn("H4", 1, half);             btnH1_sto = RenderBtn("H1", 1, half);             btnH1_mco = RenderBtn("H1", 1, half);             btnMicro = RenderBtn("Micro-trend", 2, 116);             btnMacro = RenderBtn("Macro-trend", 2, 116);             var d3_Hd = new WrapPanel              {                 Orientation = Orientation.Horizontal             };             d3_Hd.AddChild(hdr_St);             d3_Hd.AddChild(hdr_Md);             var d3_Wp = new WrapPanel              {                 Orientation = Orientation.Horizontal             };             d3_Wp.AddChild(btnD3_sto);             d3_Wp.AddChild(btnD3_mco);             var d1_Wp = new WrapPanel              {                 Orientation = Orientation.Horizontal             };             d1_Wp.AddChild(btnD1_sto);             d1_Wp.AddChild(btnD1_mco);             var h4_Wp = new WrapPanel              {                 Orientation = Orientation.Horizontal             };             h4_Wp.AddChild(btnH4_sto);             h4_Wp.AddChild(btnH4_mco);             var h1_Wp = new WrapPanel              {                 Orientation = Orientation.Horizontal             };             h1_Wp.AddChild(btnH1_sto);             h1_Wp.AddChild(btnH1_mco);             var vSpacer = 2;             var sp = new StackPanel              {                 VerticalAlignment = DB_Vert_Posn,                 HorizontalAlignment = DB_Horz_Posn             };             sp.AddChild(d3_Hd);             sp.AddChild(d3_Wp);             sp.AddChild(d1_Wp);             sp.AddChild(h4_Wp);             sp.AddChild(h1_Wp);             sp.AddChild(new TextBlock              {                 Height = vSpacer             });             sp.AddChild(btnMacro);             sp.AddChild(new TextBlock              {                 Height = vSpacer             });             sp.AddChild(btnMicro);             var bdr = new Border              {                 CornerRadius = 8,                 Padding = "6 4",                 BorderColor = Color.DimGray,                 BackgroundColor = Color.White,                 //"#aa3b3b3b",                 BorderThickness = 1,                 Child = sp,                 Height = 224,                 Width = 136             };             this.Chart.AddControl(bdr);         }         public override void Calculate(int index)         {             const int BU = 1, BE = -1;             var d3_stoBU = D3_sto.Dir(BU, index, Bars, D3_brs);             var d3_stoBE = D3_sto.Dir(BE, index, Bars, D3_brs);             btnD3_sto.BackgroundColor = d3_stoBU ? clrBU : d3_stoBE ? clrBE : Color.DarkGray;             var d1_stoBU = D1_sto.Dir(BU, index, Bars, D1_brs);             var d1_stoBE = D1_sto.Dir(BE, index, Bars, D1_brs);             btnD1_sto.BackgroundColor = d1_stoBU ? clrBU : d1_stoBE ? clrBE : Color.DarkGray;             var h4_stoBU = H4_sto.Dir(BU, index, Bars, H4_brs);             var h4_stoBE = H4_sto.Dir(BE, index, Bars, H4_brs);             btnH4_sto.BackgroundColor = h4_stoBU ? clrBU : h4_stoBE ? clrBE : Color.DarkGray;             var h1_stoBU = H1_sto.Dir(BU, index, Bars, H1_brs);             var h1_stoBE = H1_sto.Dir(BE, index, Bars, H1_brs);             btnH1_sto.BackgroundColor = h1_stoBU ? clrBU : h1_stoBE ? clrBE : Color.DarkGray;             var d3_macd_BU = D3_mco.Dir(BU, index, Bars, D3_brs);             var d3_macd_BE = D3_mco.Dir(BE, index, Bars, D3_brs);             btnD3_mco.BackgroundColor = d3_macd_BU ? clrBU : d3_macd_BE ? clrBE : Color.DarkGray;             var d1_macd_BU = D1_mco.Dir(BU, index, Bars, D1_brs);             var d1_macd_BE = D1_mco.Dir(BE, index, Bars, D1_brs);             btnD1_mco.BackgroundColor = d1_macd_BU ? clrBU : d1_macd_BE ? clrBE : Color.DarkGray;             var h4_macd_BU = H4_mco.Dir(BU, index, Bars, H4_brs);             var h4_macd_BE = H4_mco.Dir(BE, index, Bars, H4_brs);             btnH4_mco.BackgroundColor = h4_macd_BU ? clrBU : h4_macd_BE ? clrBE : Color.DarkGray;             var h1_macd_BU = H1_mco.Dir(BU, index, Bars, H1_brs);             var h1_macd_BE = H1_mco.Dir(BE, index, Bars, H1_brs);             btnH1_mco.BackgroundColor = h1_macd_BU ? clrBU : h1_macd_BE ? clrBE : Color.DarkGray;             var macBU = (!d3_macd_BE && d1_macd_BU) && (d3_macd_BU && !d1_macd_BE);             var macBE = (!d3_macd_BU && d1_macd_BE) && (d3_macd_BE && !d1_macd_BU);             btnMacro.BackgroundColor = macBU ? clrBU : macBE ? clrBE : Color.DarkGray;             btnMicro.BackgroundColor = ((h1_macd_BU && !h1_macd_BE) || (!h1_macd_BE && h1_macd_BU)) ? clrBU : ((h1_macd_BE && !h1_macd_BU) || (!h1_macd_BU && h1_macd_BE)) ? clrBE : Color.DarkGray;         }     } }
free  09 Nov 2022
Gives you the ability to add up to 4 SSL channels of any timeframe onto the current chart Makes life easier - Enjoy!!!  
free  09 Nov 2022
For those of us who utilise price channels on our charts, this indicator makes life easier  You can add up to 4 moving average channels of (different timeframes) super-imposed onto the current chart 
free  09 Nov 2022
For those of us who use GannHilos on the chart. This indicator simplifies your life by providing the ability to add up to 4 GannHilos of ANY timeframe onto the current chart. Very very usefull - Enjoy !!!
KF - TEMA - DEMA - v3
free  05 Jul 2022
This is a far better version than the one i uploaded prior to this.  PLEASE USE THIS ONE INSTEAD.   Most of us use moving average cross-overs to enter / exit trades. This composite indicator that i created combines the best two of the Moving Average types as cross-over pairs It lets you place a moving average of a higher timeframe onto the current chart.  YOU WONT BE DISSAPPOiNTED!!!   Please feel free to reshape all my uploaded tools and PLEASE share the code. Thanks!!!
Warning! Executing cBots downloaded from this section may result in loss of funds. Use them at your own risk.

No uploaded.