PDA

View Full Version : HMA (Hull Moving Average) color change


Mexie
10-02-2007, 03:54 PM
Hi, does anyone know how to code the HMA, so that it changes color, say blue when it is trending up, and red when trending down?

Thanks,

Pablo

NinjaTrader_Ray
10-02-2007, 03:58 PM
Hi Pablo,

This can be accomplished by using multiple plots. The following link is a reference sample demonstrating this concept.

http://www.ninjatrader-support.com/vb/showthread.php?t=3227

Mexie
10-02-2007, 04:21 PM
Hi Ray,

That's is exactly what I am looking for, but how do I apply it to the HMA indicator?

Sorry, not too technically savvy here.

Thanks,

Pablo

KBJ
10-02-2007, 05:18 PM
Pablo,

This might not be the most elegant way to do this, but its very simple:

Just download the SampleMultiColoredPlot.zip file and extract the files.

Then edit SampleMultiColoredPlot with Tools + Edit NinjaScript.

Then do a "Save As" to rename the file (pick a new name).

Lastly, change all occurrences of "SMA" to "HMA", compile and you're done.

Best regards,

KBJ

Mexie
10-02-2007, 06:59 PM
That worked great!

Thanks KBJ

DORAIRAJ_S@HOTMAIL.COM
10-21-2007, 12:48 AM
This works great for HMA (cLOSE).
What if I want to draw hma (High) and HMA(LOW) in multi color format?

NinjaTrader_Josh
10-21-2007, 01:14 AM
When you load the indicator there is an option that lets you select Close, Median, etc. The option is called "Price type" and you can set those as you please. It is in the "Parameters" section of the indicator dialog window.

DORAIRAJ_S@HOTMAIL.COM
10-21-2007, 01:17 AM
This option isa available only in the Ninja script generated standard HMA INDICATORS.
The mulicolor HMA using samplecolorplot script does not have option to select anything other than close.
Please advise.

NinjaTrader_Josh
10-21-2007, 01:19 AM
Add this to the Initialize() section of the indicator.
PriceTypeSupported = true;
http://www.ninjatrader-support.com/HelpGuideV6/PriceTypeSupported.html

DORAIRAJ_S@HOTMAIL.COM
10-21-2007, 01:24 AM
Please advise in between which line numbers should I insert the subject statement?

NinjaTrader_Josh
10-21-2007, 02:09 AM
You can put it anywhere inside the Initialize() method.

For instance:
protected override void Initialize()
{
CalculateOnBarClose = false;
Overlay = true;
PriceTypeSupported = false;
}

It doesn't matter what order

DORAIRAJ_S@HOTMAIL.COM
10-21-2007, 02:41 AM
Revised as per your advise.
But, the price type does not appear under the parameter as a variable for selection( open,close,high,low,etc).
Please advise.

NinjaTrader_Josh
10-21-2007, 03:41 AM
Please post up your indicator file and I will take a look.

DORAIRAJ_S@HOTMAIL.COM
10-21-2007, 08:58 AM
I have realised that I have not compiled the file after inserting the text.
After compilation it worked perfectly and got the price type variable under parameters.
Thanks a lot for your help.