need help
need help
15 Aug 2015, 14:47
Hi All,
is it possible to show how to use the HMA (hull moving average) in Cbot code? i.e what will be the correct way to code it in cbot since the HMA is a custom indicator
thanks
Replies
ClickAlgo
16 Aug 2015, 13:19
RE:
hiba7rain said:
Hi All,
is it possible to show how to use the HMA (hull moving average) in Cbot code? i.e what will be the correct way to code it in cbot since the HMA is a custom indicator
thanks
Hello,
Open your cbot, click on manage references and add the Hull indicator, if it is not showing then you will need to install it from the custom cbots by clicking on the cbot option in the menu above and search for the hull indicator.
Add a new user defined property:
[Parameter("Hull Period", DefaultValue = 5, MinValue = 1)] public int HullPeriod { get; set; }
Add a new private variable:
private HMA hull;
- In the onstart method add this:
// HULL moving Average hull = Indicators.GetIndicator<HMA>(HullPeriod);
Now you can use it to filter:
// false signal to buy if (hull.hma.IsFalling()) return 0;
@ClickAlgo
hiba7rain
16 Aug 2015, 13:37
RE: RE:
Thanks Paul I really appreciate your help
my mistake was not defining the indicator int period on Getindicator method :)
Paul_Hayes said:
hiba7rain said:
Hi All,
is it possible to show how to use the HMA (hull moving average) in Cbot code? i.e what will be the correct way to code it in cbot since the HMA is a custom indicator
thanks
Hello,
Open your cbot, click on manage references and add the Hull indicator, if it is not showing then you will need to install it from the custom cbots by clicking on the cbot option in the menu above and search for the hull indicator.
Add a new user defined property:
[Parameter("Hull Period", DefaultValue = 5, MinValue = 1)] public int HullPeriod { get; set; }Add a new private variable:
private HMA hull;
- In the onstart method add this:
// HULL moving Average hull = Indicators.GetIndicator(HullPeriod);Now you can use it to filter:
// false signal to buy if (hull.hma.IsFalling()) return 0;
@hiba7rain
hiba7rain
19 Aug 2015, 21:42
( Updated at: 21 Dec 2023, 09:20 )
RE: RE:
hello Paul
hope all fine, i have applied the same codes to my cbot but on test no trades made am not sure if am missing something :)
need your help/advise
Paul_Hayes said:
hiba7rain said:
Hi All,
is it possible to show how to use the HMA (hull moving average) in Cbot code? i.e what will be the correct way to code it in cbot since the HMA is a custom indicator
thanks
Hello,
Open your cbot, click on manage references and add the Hull indicator, if it is not showing then you will need to install it from the custom cbots by clicking on the cbot option in the menu above and search for the hull indicator.
Add a new user defined property:
[Parameter("Hull Period", DefaultValue = 5, MinValue = 1)] public int HullPeriod { get; set; }Add a new private variable:
private HMA hull;
- In the onstart method add this:
// HULL moving Average hull = Indicators.GetIndicator(HullPeriod);Now you can use it to filter:
// false signal to buy if (hull.hma.IsFalling()) return 0;
@hiba7rain
ClickAlgo
19 Aug 2015, 22:12
hi,
without seeing the code its very hard to see where the problem may be
@ClickAlgo
hiba7rain
19 Aug 2015, 22:17
RE:
hi , here is the codes below
[Parameter("Hull Period", DefaultValue = 5, MinValue = 1)]
public int HullPeriod { get; set; }
[Parameter("Hull Period2", DefaultValue = 10, MinValue = 1)]
public int HullPeriod2 { get; set; }
on start
hull = Indicators.GetIndicator<HMA>(HullPeriod);
hull2 = Indicators.GetIndicator<HMA>(HullPeriod2);
Paul_Hayes said:
hi,
without seeing the code its very hard to see where the problem may be
@hiba7rain
hiba7rain
19 Aug 2015, 22:24
RE: RE:
[Parameter("Hull Period", DefaultValue = 5, MinValue = 1)]
public int HullPeriod { get; set; }
[Parameter("Hull Period2", DefaultValue = 10, MinValue = 1)]
public int HullPeriod2 { get; set; }
private HMA hull;
private HMA hull2;
on start
hull = Indicators.GetIndicator<HMA>(HullPeriod);
hull2 = Indicators.GetIndicator<HMA>(HullPeriod2);
on tick
double _h = hull.hma.LastValue;
double _h2 = hull2.hma.LastValue;
if (_h < _h2)
{
var positionsToClose = Positions.FindAll(label, Symbol, TradeType.Buy);
foreach (var position in positionsToClose)
{
ClosePosition(position);
}
}
if (_h > _h2)
{
var positionsToClose = Positions.FindAll(label, Symbol, TradeType.Sell);
foreach (var position in positionsToClose)
{
ClosePosition(position);
}
}
hiba7rain said:
hi , here is the codes below
[Parameter("Hull Period", DefaultValue = 5, MinValue = 1)]
public int HullPeriod { get; set; }
[Parameter("Hull Period2", DefaultValue = 10, MinValue = 1)]
public int HullPeriod2 { get; set; }on start
hull = Indicators.GetIndicator(HullPeriod);
hull2 = Indicators.GetIndicator(HullPeriod2);
Paul_Hayes said:
hi,
without seeing the code its very hard to see where the problem may be
@hiba7rain
ClickAlgo
20 Aug 2015, 09:08
You probably already know this but, look at this extract about the Hull Average which is a trend indicator:-
A shorter period HMA may be used for entry signals in the direction of the prevailing trend. A long entry signal, when the prevailing trend is rising, occurs when the HMA turns up and a short entry signal, when the prevailing trend is falling, occurs when the HMA turns down.
So its common to use the property hull.hma.IsFalling() or hull.hma.IsRising(), I see you strategy compares 2 hull periods and closes positions depending on the period of the first indicator being higher or lower than the last indicator.
Your code snippet just closes any positions it finds, you are not opening any new positions, i recommend that you either:-
- Write the design of your strategy down in a document so that you have for example; a flow chart showing how it will work and then develop your code to match this.
- Post on the job board for someone to write this for you.
Cheers,
Paul.
@ClickAlgo
hiba7rain
20 Aug 2015, 10:09
RE:
Hi Paul,
thanks again for your support, actually the robot opens trades based on ADX indicator , and i wanted to use the HMA to exit from entries based on the cross of short and long period HMAs , so when i applied the > or < i noticed that no trades created, i will apply the function IsFalling or IsRising or might try to use different indicator that is more sensitive to price moves, the good thing about HMA is the indicator reacts to price more than EMA or SMA
Paul_Hayes said:
You probably already know this but, look at this extract about the Hull Average which is a trend indicator:-
A shorter period HMA may be used for entry signals in the direction of the prevailing trend. A long entry signal, when the prevailing trend is rising, occurs when the HMA turns up and a short entry signal, when the prevailing trend is falling, occurs when the HMA turns down.
So its common to use the property hull.hma.IsFalling() or hull.hma.IsRising(), I see you strategy compares 2 hull periods and closes positions depending on the period of the first indicator being higher or lower than the last indicator.
Your code snippet just closes any positions it finds, you are not opening any new positions, i recommend that you either:-
- Write the design of your strategy down in a document so that you have for example; a flow chart showing how it will work and then develop your code to match this.
- Post on the job board for someone to write this for you.
Cheers,
Paul.
@hiba7rain
ClickAlgo
20 Aug 2015, 10:44
hello again, I am sure you will work it out, you gave me an idea about the HULL average so i extended the original one to include signals:-
/algos/indicators/show/930
@ClickAlgo
hiba7rain
20 Aug 2015, 11:14
RE:
again i will say a big thanks to you and your interaction with me and other users i will reference your indicator to my cbot i just need more elaboration about IsBullish (IsRising) and IsBearish (IsFalling) :)
Paul_Hayes said:
hello again, I am sure you will work it out, you gave me an idea about the HULL average so i extended the original one to include signals:-
/algos/indicators/show/930
@hiba7rain
ClickAlgo
20 Aug 2015, 12:25
I am fixing it now to work with a cBot, will update indicator when its done
@ClickAlgo
ClickAlgo
20 Aug 2015, 13:30
RE: RE:
hiba7rain said:
again i will say a big thanks to you and your interaction with me and other users i will reference your indicator to my cbot i just need more elaboration about IsBullish (IsRising) and IsBearish (IsFalling) :)
Paul_Hayes said:
hello again, I am sure you will work it out, you gave me an idea about the HULL average so i extended the original one to include signals:-
/algos/indicators/show/930
Download the latest indicator HMA Signals and the instructions on use with a cBot, read up on the HULL indicator as I mentioned before it will tell you how it is useful with trend.
@ClickAlgo
hiba7rain
20 Aug 2015, 19:04
RE: RE: RE:
Hi Paul
thanks, i will download the latest update and ill do a search about HULL indicator to have more ideas :)
Paul_Hayes said:
hiba7rain said:
again i will say a big thanks to you and your interaction with me and other users i will reference your indicator to my cbot i just need more elaboration about IsBullish (IsRising) and IsBearish (IsFalling) :)
Paul_Hayes said:
hello again, I am sure you will work it out, you gave me an idea about the HULL average so i extended the original one to include signals:-
/algos/indicators/show/930
Download the latest indicator HMA Signals and the instructions on use with a cBot, read up on the HULL indicator as I mentioned before it will tell you how it is useful with trend.
@hiba7rain
ClickAlgo
16 Aug 2015, 13:19
RE:
hiba7rain said:
Hello,
Open your cbot, click on manage references and add the Hull indicator, if it is not showing then you will need to install it from the custom cbots by clicking on the cbot option in the menu above and search for the hull indicator.
Add a new user defined property:
Add a new private variable:
Now you can use it to filter:
@ClickAlgo