Category Trend  Published on 27/02/2021

cTrader HMA Signals

Description

This cTrader HMA indicator is an extension to the Hull Moving Average where it shows optional signals for trend:-

  • Optional Arrows on the chart where the trend changes
  • Optional Text on the chart displaying trend direction
  • Optional display of HULL line and only displays trend description.
  • Set how far away the arrow is spaced from the HMA with different time-frames.
  • Two public properties for usage with cBots

DOWNLOAD THE INDICATOR

 

 


Contactinstant chat group
Websitehttps://clickalgo.com

ClickAlgo

Twitter | Facebook | YouTube | Pinterest | LinkedIn

 


using cAlgo.API;
using System.Windows.Forms;

namespace cAlgo
{
    [Indicator(IsOverlay = false, TimeZone = TimeZones.UTC, AccessRights = AccessRights.FullAccess)]
    public class ClickAlgoIndicator : Indicator
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }

        [Output("Main")]
        public IndicatorDataSeries Result { get; set; }


        protected override void Initialize()
        {
            var ret = MessageBox.Show("Please click YES to open a web browser where you can download this product from ClickAlgo.com", "Downloading...", MessageBoxButtons.YesNo, MessageBoxIcon.Information);

            if (ret == DialogResult.Yes)
            {
                System.Diagnostics.Process.Start("https://clickalgo.com/hma-indicator");
            }
        }

        public override void Calculate(int index)
        {
            // Calculate value at specified index
            // Result[index] = ...
        }
    }
}


ClickAlgo's avatar
ClickAlgo

Joined on 05.02.2015

  • Distribution: Free
  • Language: C#
  • Trading platform: cTrader Automate
  • File name: ClickAlgo Indicator.algo
  • Rating: 4
  • Installs: 10756
  • Modified: 13/10/2021 09:54
Comments
Log in to add a comment.
JA
janiolos · 5 years ago

I have a question!

Do this indicator repaint?

JA
janiolos · 5 years ago

Hey Guys,

I have developed the Telegram interface for this indicator, now we can send a telegra m message when the arrow is written.

Who wants more information, call me in private.

 

Att

ER
erikvb · 5 years ago

Hello , i get some error when i try the robot ?

someone have the robot running ?

i installed the indicator , and work fine.

 

Severity Code Description Project File Line Suppression State

Error CS0234 The type or namespace name 'HMASingal' does not exist in the namespace 'cAlgo' (are you missing an assembly reference?) HMASignals d:\Users\Erik\Documents\cAlgo\Sources\Robots\HMASignals\HMASignals\HMASignals.cs 3 Active

Severity Code Description Project File Line Suppression State

Error CS0052 Inconsistent accessibility: field type 'HMASignals' is less accessible than field 'HMASmartBotFirstEdition.hmaSignals' HMASignals d:\Users\Erik\Documents\cAlgo\Sources\Robots\HMASignals\HMASignals\HMASignals.cs 11 Active

Severity Code Description Project File Line Suppression State

Error CS0118 'HMASignals' is a type but is used like a variable HMASignals d:\Users\Erik\Documents\cAlgo\Sources\Robots\HMASignals\HMASignals\HMASignals.cs 20 Active

Severity Code Description Project File Line Suppression State

Error CS0246 The type or namespace name 'HMASignal' could not be found (are you missing a using directive or an assembly reference?) HMASignals d:\Users\Erik\Documents\cAlgo\Sources\Robots\HMASignals\HMASignals\HMASignals.cs 20 Active

 

 

using cAlgo.API;
using cAlgo.API.Internals;
using cAlgo.HMASingal;
namespace cAlgo
{
    [Robot(TimeZone = TimeZones.UTC, AccessRights = AccessRights.None)]
    public class HMASmartBotFirstEdition : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }
        public HMASignals hmaSignals;

        private MarketSeries HmaDaySeries;
        private HMASignals _hmaSignal;

        protected override void OnStart()
        {
            // Put your initialization logic here
            HmaDaySeries = MarketData.GetSeries(TimeFrame.Daily);
            HMASignals = Indicators.GetIndicator<HMASignal>(HmaDaySeries, 21, false, false, 3, false, 50);
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }

    internal class HMASignals
    {
    }
}

SE
Serpico · 8 years ago

Thanks for this Indicator, can someone make a cbot of this or explain were to insert the imputs the creator of this mentioned but not very clear were they should be, i have tried with Smart grid but no succes 

Thanks in advance

ClickAlgo's avatar
ClickAlgo · 8 years ago

quite simply add indicator to cbot and use properties, IsBullish and IsBearish to decide if you should open long or short positions.

HI
hiba7rain · 8 years ago

hey Paul

nice to see the new updates you know most i like is hma :)

just a question how to use it on smartgrid cbot to reduce the drawdown 

thanks

CO
ColossusFX · 9 years ago

I figured it out :)

CO
ColossusFX · 9 years ago

is this correct for referencing and changing HTF HMA?

        [Parameter("HMA HTF Period", DefaultValue = 1, MinValue = 1, MaxValue = 200, Step = 1)]
        public double Parameter { get; set; }

I need to change HMA on the set timeframe.

CO
ColossusFX · 9 years ago

@Paul_Hayes

Thanks very much for this, my scalping algo was just just causing havoc on big moves, this is exactly what I wanted to do with it!

Wanted a higher TF HMA for larger direction for opening trades, and you did it! :)

EL
ellcz · 9 years ago

Oh Im stupid.. I almost fixed it on my own.. But when i updated this code "<HMASignals>" calgo fixed it automatically to "<HMASignal>" so there was new error which makes me cunfused.. 

 

However, i made it thanks to you Paul. And it is profitable on its own with some good settings. I will probably update this and see what i can do. :) 

For now i added just TP and SL.

 

So thanks again! 

 

ClickAlgo's avatar
ClickAlgo · 9 years ago

Yes, that's the spacing for the arrow from hma line, use any value from your cBot, not tried it will null.

HI
hiba7rain · 9 years ago

Hey Paul,

yes i noticed that it was missing <HMASignals> and Private HMAsignals,  I have add it and I got no error, i thought you must missed to include it :)

I See that you have included 24 on (HmaDaySeries, 21, false, false, 3, false, 24);

ClickAlgo's avatar
ClickAlgo · 9 years ago

I don't know why, but when i copy/paste from visual studio it stripped some of the text, I had to paste into notepad and then paste into here, it is correct now:-

hmaSignal = Indicators.GetIndicator<HMASignals>(HmaDaySeries, 21, false, false, 3, false, 24);

EL
ellcz · 9 years ago

I'm totally out of ideas now.. :/ I wanted to try this indicator for my own cbot, so i have only this code. Did i forget something? Ummm, your HMA Signal is added as reference. (Via Manage References)

 

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 HMASmartBotFirstEdition : Robot
    {
        [Parameter(DefaultValue = 0.0)]
        public double Parameter { get; set; }
        private MarketSeries HmaDaySeries;
        private HMASignals hmaSignal;

        protected override void OnStart()
        {
            // Put your initialization logic here
            HmaDaySeries = MarketData.GetSeries(TimeFrame.Daily);
            hmaSignal = Indicators.GetIndicator(HmaDaySeries, 21, falsefalse, 3, false, 50);
        }

        protected override void OnTick()
        {
            // Put your core logic here
        }

        protected override void OnStop()
        {
            // Put your deinitialization logic here
        }
    }
}

EL
ellcz · 9 years ago

Well, I'm still learning C# so... It's ok. I knew there is missing something, but i could not find it. However, when I update your code like this, compiler still saying that error "Error CS0411: The type arguments for method cAlgo.API.Internals.IIndicatorsAccessor.GetIndicator<TIndicator>(params object[]) cannot be inferred from the usage. Try specifying the type arguments explicitly."

What is this? Shouldn't we do it like in this example "sma = Indicators.GetIndicator<SampleSMA>(Source, SmaPeriod);" instead of "hmaSignal = Indicators.GetIndicator(HmaDaySeries, 21, falsefalse, 3, false, 50);

 

Or these brackets <> doesn't work for custom indis?

ClickAlgo's avatar
ClickAlgo · 9 years ago

Hello again Ellcz,

You did everything correct, it was my fault, a private variable declaration was missing, add this and it should work:-

private HMASignals hmaSignal;

 

ClickAlgo's avatar
ClickAlgo · 9 years ago

Hi Ellcz,

Thank you for spotting an error, I added an extra user defined parameter and did not update the documentation correctly, 

hmaSignal = Indicators.GetIndicator(HmaDaySeries, 21, false, false, 3, false, 50);

As you see above the last parameter was missing for the arrow spacing.

This still does not solve the first error you are getting; the first error sounds like you don't have a reference to the indicator from your cBot, did you add this reference?

Can you post a code example here on how you are calling the GetIndicator method please

EL
ellcz · 9 years ago

Did EXACTLY what you said, got two errors. 

 

Error CS0103: The name `hmaSignal' does not exist in the current context. And next error is..

 

Error CS0411: The type arguments for method cAlgo.API.Internals.IIndicatorsAccessor.GetIndicator<TIndicator>(params object[]) cannot be inferred from the usage. Try specifying the type arguments explicitly.

 

Any help? please?

ClickAlgo's avatar
ClickAlgo · 9 years ago

you can code it so only one email is sent when the trend first changes direction like when the arrow is drawn or else yes it will fire off emails continually while the IsBullish or IsBearish values are true.

HI
hiba7rain · 9 years ago

hi 

i think the frequency of emails out will be an issue i have not try it yet but i just assume that will be the case 

ClickAlgo's avatar
ClickAlgo · 9 years ago

Hi, I did, but took it out, it was an idea that when the trend changes on a larger time-frame; for example daily, an email is sent to you so you can look at additional signals to help decide on what to do.

If you want it then just look in the API reference:-

http://ctrader.com/api/reference/internals/inotifications/sendemail-5edf

HI
hiba7rain · 9 years ago

Hey Paul 

just a question, have you included email alert on your first version because am not sure i thought that i saw the option available  :)

HI
hiba7rain · 9 years ago

:)

ClickAlgo's avatar
ClickAlgo · 9 years ago

Thanks, I am just in a quiet period at work, so keeping myself busy. 

HI
hiba7rain · 9 years ago

Paul

your work should be appreciated by all CTDN users -:) , you are providing a valuable inputs and comments, i have just download it and i will test it and give you my feedback