View Full Version : RMMA & ModHeikenAshi
Gumphrie
07-28-2007, 03:58 PM
"Rainbow Multiple Moving Averages" and "Modified Heiken Ashi".
As you can see from the screenshot these are a couple of pretty trend indicators. Please feel free to make your own modifications, suggested uses and report bugs. Note the RMMA comes with alpha and draw, as well as colour options.
http://www.acuclick.net/rmma.jpg
Changelog:
Changed ModHeikenAshi 19th August - Vers 0.2, now has option to hide the shadow lines
To import:
- Download the file(s) contained in this thread to your desktop
- From the Control Center window select the menu File > Utilities > Import NinjaScript
- Select the downloaded file(s)
NinjaTrader_Josh
07-28-2007, 04:34 PM
Looks sweet Gumphrie. Good job and thanks.
pdawg
08-10-2007, 05:08 PM
Gumphrie, Thanks so much. Exactly what I was looking for!
jojojo
08-11-2007, 06:43 AM
Hello Gumphrie
Could you please explain a bid more in detail , how to use "alpha" and "draw" - method to generate this transparent color effect in general ?
Kind regs
Jojo
Gumphrie
08-11-2007, 09:19 AM
Could you please explain a bid more in detail , how to use "alpha" and "draw" - method to generate this transparent color effect in general ?
Sure Jojo, I was referring to the "Alpha" and "Drawtype" in the RMMA indicator properties. The "DrawType" isn't related to the transparency, but to the indicator's ability to draw the MAs either as lines or as filled areas.
In the C# code generally, to set the transparency you take the colour you want to set the transparency on and use the following function :
Color.FromArgb(Alpha, inputColor)Where Alpha is a value between 0-255, 255 being solid and 0 being invisible and inputColor is the standard colour you want to adapt such as "Color.Blue", "Color.Red", etc..
This use of the Color.FromArgb method like this with 2 arguments is just one of four possible overloads. Another use of it that I have deployed in ModHeikenAshi (and in the BBS indicator and others for the dot border colour) is to automatically create a colour which is the oposite of the chart background colour, useful if you want a 'border' or 'shadow' colour without having to worry about the user's settings for the chart background. Here is the relevant code for that:
byte bRed = (byte)~(ChartControl.BackColor.R);
byte bGreen = (byte)~(ChartControl.BackColor.G);
byte bBlue = (byte)~(ChartControl.BackColor.B);
Pen pen = new Pen(Color.FromArgb(bRed,bGreen,bBlue), ShadowWidth);
jojojo
08-12-2007, 08:03 AM
Very good explanation. Helps again to the next steps of learning this amazing platform. I'm glad to join .Thank you and keep going on.
Jojo
Gumphrie
08-12-2007, 03:32 PM
Sorry, that should be 0 - 255, rather than 0 -128 for the Alpha range, I'll edit the above post.
zelli
08-18-2007, 01:44 PM
Gump
Thanks for Mod HA!!
Is it possible to have the "shadow color" added? With the standard NT H.A. the shadow can be set to "transparent" which allows the full candle to paint one solid color. This eliminates the black vertical shadow bar inside the candle.
Thanks again. Love your work!
Z
Gumphrie
08-18-2007, 01:58 PM
Gump
Thanks for Mod HA!!
Is it possible to have the "shadow color" added? With the standard NT H.A. the shadow can be set to "transparent" which allows the full candle to paint one solid color. This eliminates the black vertical shadow bar inside the candle.
Thanks again. Love your work!
Z
Thanks. I can add an option to hide it / turn it off if you like? The "shadow color" is not editable at the moment because its auto-adjusting to the background color of you chart which is why you can't find it in properties. I was also thinking of changing it so it paints like a normal candle and works better on OHLC and HiLow bars. What do you think?
pdawg
08-18-2007, 03:38 PM
Gumphrie,
I would like to see that option to hide the shadow color if possible.
Thanks'
P
Gumphrie
08-18-2007, 06:20 PM
I've added the option in, please download from the first post.
I can see now that solves the OHLC and HiLoBar issue too, great!
Rollins
11-02-2007, 02:13 AM
Gumphrie, I owe you one on this indicator, it is a great example of how to do some non standard stuff in NT.
Thanks a lot, can't tell you how much time it saved me!
Of course also thanks to Josh & KBJ and all other contributing members whose names I haven't mentioned
Fulcrum
12-30-2007, 11:03 PM
Is anyone using the Heiken Ashi in NT with a smoothing capability? I see the NT HA in V6.5 can be "displaced" but no way to "smooth" it.
Fulcrum
01-06-2008, 10:14 AM
In the enclosed link ( http://www.ensignsoftware.com/tips/tradingtips57.htm ) you while find an Aroon Indicator article which has the very last chart image as the image I have included. Does anyone know what the very bottom indicator is showing (with the red .800 value and the blue .200 value)...it looks like what may be a "smoothed" Heikin Ashi or Average Bar. Anyone have any idea how this indicator is formated?
Fulcrum
01-06-2008, 01:42 PM
Here is an additional link that talks about the Heikin Ashi "smoothed" with the perfect example from a MT4 forex platform chart image from a "Teed63" posting (post #4)........ http://forum.vtsystems.com/index.php?showtopic=7248&pid=33944&st=0&#entry33944
"Teed63" has also included a .zip file for the indicator already in a MQL format (post #8). Maybe someone here can make heads or tails from the .zip file included programming for this indicator.
Gumphrie
01-28-2008, 12:15 PM
Here is an additional link that talks about the Heikin Ashi "smoothed" with the perfect example from a MT4 forex platform chart image from a "Teed63" posting (post #4)........ http://forum.vtsystems.com/index.php?showtopic=7248&pid=33944&st=0&#entry33944
"Teed63" has also included a .zip file for the indicator already in a MQL format (post #8). Maybe someone here can make heads or tails from the .zip file included programming for this indicator.
You can effectively do the samething inside my MTF indicator which has ModHeikenAshi embedded into it as a 'Style'
Fulcrum
01-28-2008, 03:28 PM
You can effectively do the samething inside my MTF indicator which has ModHeikenAshi embedded into it as a 'Style'Sorry...I am slow today (and many days...LOL) what is your MTF indicator? (or where is it exacly)...thanks!
Gumphrie
01-28-2008, 03:47 PM
Sorry...I am slow today (and many days...LOL) what is your MTF indicator? (or where is it exacly)...thanks!
Here http://www.ninjatrader-support.com/vb/showthread.php?t=3185
Fulcrum
01-28-2008, 09:13 PM
OK...thank you and I will check this out.
^eagle^
03-02-2009, 09:29 AM
I was wondering if anyone could rewrite the following file into ninjascript. This is an mt4 file I find useful for rainbow trading. I found it on FF.
I think it would be a great addition to the set up here.
what this does is track when the MMA consolidate. I would like an alet given when it reaches a certain point of consolidation. Like a range of the user could input.
Once the rainbow consolidates its just a matter of waititng for the breakout and trade in that direction.:cool:
NinjaTrader_Bertrand
03-02-2009, 09:36 AM
Thank you for your post and welcome to our support forums ^eagle^!
Hopefully someone from the community can help you out with the conversion, for our indicator coding tutorials please check here - http://www.ninjatrader-support.com/HelpGuideV6/Overview18.html
For professional custom coding, you can contact those consultants - http://www.ninjatrader.com/webnew/partners_onlinetrading_NinjaScript.htm
In the meanwhile you can check out this script - http://www.ninjatrader-support2.com/vb/local_links.php?action=jump&id=162&catid=1
whself beginner
03-06-2009, 03:17 AM
test this. not the same, but you see what you want.
best regards
make some change on the source and it's good for trend trading like guppy. code comes from his book "trend trading".
^eagle^
03-08-2009, 09:36 AM
test this. not the same, but you see what you want.
best regards
make some change on the source and it's good for trend trading like guppy. code comes from his book "trend trading".
This file does not import into NT. Is it still in Mq4? I do not know how to code.
Thanks:)
eDanny
03-08-2009, 12:21 PM
That is a Ninja Script file but in a raw .cs format. You can import .zip files but not this. Copy it to you indicators folder, open any indicator and complile. Then you will see it.
^eagle^
03-09-2009, 07:43 AM
That is a Ninja Script file but in a raw .cs format. You can import .zip files but not this. Copy it to you indicators folder, open any indicator and complile. Then you will see it.
I tried to open up Ninjatrader files but "Find target" box is greyed out. I am using free demo version and I do not think they allow you to go inside.
Tried .zip ing the file and import with no luck either.
NinjaTrader_Bertrand
03-09-2009, 07:54 AM
The free simulatation version will allow you to import and edit NinjaScript files. For the cs file posted below, please copy it to MyDocuments\NinjaTrader 6.5\bin\Custom\Indicator.
The open up any NinjaScript file in NinjaTrader (Tools > Edit NinjaScript) and hit F5 to compile all your files, after this the new indicator should be available in the 'Indicators' selection window on your charts.
^eagle^
03-09-2009, 08:42 AM
The free simulatation version will allow you to import and edit NinjaScript files. For the cs file posted below, please copy it to MyDocuments\NinjaTrader 6.5\bin\Custom\Indicator.
The open up any NinjaScript file in NinjaTrader (Tools > Edit NinjaScript) and hit F5 to compile all your files, after this the new indicator should be available in the 'Indicators' selection window on your charts.
That worked. Thanks.:)
^eagle^
03-10-2009, 08:06 PM
test this. not the same, but you see what you want.
best regards
make some change on the source and it's good for trend trading like guppy. code comes from his book "trend trading".
This is good but not quite what i need. I'm looking for an audible alert when rainbow goes in to consolidation. This just shows trend. and trend shift. Thanks though. Its a great indicator. Just not whaT I need.
I am a cluelss noob when It comes to programming. So I just will probably have to do without.:)
whself beginner
03-11-2009, 01:59 AM
please more information.
a screen or so.
best regards
^eagle^
03-13-2009, 04:56 AM
This is what I am asking for. A picture is worth a thousand words.:)
Thank you for your time
whself beginner
03-13-2009, 05:18 AM
it is simple math, but in the moment (for a short look) i can not explain.
i must understand, this for me, than i can code in c#
for(int i=0; i<limit; i++) {
AverageDistanceBuffer[i] = (((
( iMA(NULL, 0, BasePeriod + (PeriodStep * 0), 0, MODE_LWMA, PRICE_CLOSE, i) -
iMA(NULL, 0, BasePeriod + (PeriodStep * 1), 0, MODE_LWMA, PRICE_CLOSE, i) ) +
( iMA(NULL, 0, BasePeriod + (PeriodStep * 1), 0, MODE_LWMA, PRICE_CLOSE, i) -
iMA(NULL, 0, BasePeriod + (PeriodStep * 2), 0, MODE_LWMA, PRICE_CLOSE, i) ) + ...
whself beginner
03-13-2009, 05:22 AM
double iMA( string symbol, int timeframe, int period, int ma_shift, int ma_method, int applied_price, int shift)
Parameters:
symbol - Symbol the data of which should be used to calculate indicator. NULL means the current symbol. timeframe - Timeframe. It can be any of Timeframe enumeration (http://docs.mql4.com/constants/timeframes) values. 0 means the current chart timeframe. period - Averaging period for calculation. ma_shift - MA shift. Indicators line offset relate to the chart by timeframe. ma_method - MA method. It can be any of the Moving Average method enumeration (http://docs.mql4.com/constants/movings) value. applied_price - Applied price. It can be any of Applied price enumeration (http://docs.mql4.com/constants/prices) values. shift - Index of the value taken from the indicator buffer (shift relative to the current bar the given amount of periods ago).
NinjaTrader_Bertrand
03-13-2009, 06:20 AM
From a quick look this just generates the multiple MA rainbow in a more efficient way because previously calculated MA values are reused...the shift paramter explains this in your second post.
lgarcia3
03-13-2009, 02:12 PM
Hi Gumphrie,
Looks very good. I am interested in using the "mod HA" in my own automated system. I need to convert it to 0 and 1. Zeros being the red color in the bar, 1 the green ones. Now, what you do is to go back a number of bars, check if the current HA open and current HA close are between the min(open, close) and max(open,close) of the "n" bar back. If so, you get that color for your current bar, correct?
It seems that later you shift the position in the "colorArr" array and save the current color at position zero. Is that the algorithm?
I am trying that; but not working too well. Please, let me know if your algorithm is different than that.
Thanks!
tjendra
03-22-2009, 11:59 PM
I am trying to use the ModHeikenAshi indicator for entry and exit in a strategy.
Therefore I am trying to add a flag to test for the color of the bar with the following code in the indicator: "if(BarColor = barColorUp) bullIndication.Set(true); else bullIndication.Set(false);"
However I got this error: "Cannot implicitly convert type 'System.Drawing.Color' to 'bool'"
I tried to work around this problem by using the following code: "if(Values[3][0] > Values[0][0]) bullIndication.Set(true); else bullIndication.Set(false);" i.e. where close is higher than open, set flag to true.
When I test it in the strategy it doesn't seem to give the correct buy/sell signal. Any idea why? I have already set
CalculateOnBarClose = true;, so it shouldn't be computing before the bar finish.
The buy/sell strategy using the following code:
protected override void OnBarUpdate()
{
if (ModHeikenAshi(6).BullIndication[0]==true)
EnterLong();
if (ModHeikenAshi(6).BullIndication[0]==false)
EnterShort();
}
The bar is green all the way, not sure why the sell short order got executed.
whself beginner
03-23-2009, 12:50 AM
if(BarColor == barColorUp)
tjendra
03-23-2009, 01:15 AM
Thanks, that solve the "Cannot implicitly convert type 'System.Drawing.Color' to 'bool'" error. However changing the if(BarColor == barColorUp) bullIndication.Set(true); else bullIndication.Set(false);" statement, when I test the strategy, no trades got executed. Not sure why is that so?
NinjaTrader_Bertrand
03-23-2009, 07:06 AM
Please don't check directly for the barcolor to enter a trade, instead check for the chart conditions that trigger the coloring of the bars. After this change, you should see trades generated.
tjendra
03-23-2009, 07:08 AM
I tried doing what you said by using the following code: "if(Values[3][0] > Values[0][0]) bullIndication.Set(true); else bullIndication.Set(false);" i.e. where close is higher than open, set flag to true. But it doesn't seem correct when tested out in the strategy. (Refer to my pic in the earlier post)
NinjaTrader_Josh
03-23-2009, 08:45 AM
tjendra,
You will need to post complete code for us to be able to evaluate further. Also, if you do not mind could you please open a new thread as this has become unrelated to the original thread. Thank you.
sukhsan
04-09-2009, 03:17 PM
Hi Gumphrie, (http://www.ninjatrader-support2.com/vb/member.php?u=1661)
I downloaded RMMA zip imported working fine, I tried to change color bands from band 5 to band 2 i mean looking for only band 1 and band2 , when i complied code and gave me error
" Indicator\RMMA.cs The type or namespace name 'RMMAAverageType' could not be found (are you missing a using directive or an assembly reference?) CS0246 - click for info 557 26"
Even after importing RMMA.zip file when I compiled RMMA.cs i got the same message.
Help will be appericiated
regards
Sukh
whself beginner
04-10-2009, 03:14 AM
#region Using declarations
using System;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.ComponentModel;
using System.Xml.Serialization;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
using NinjaTrader.Gui.Design;
#endregion
public enum RMMAAverageType
{
EMA,
SMA,
WMA,
LSMA,
HMA,
}
public enum RMMADrawType
{
Fill,
Line,
Both,
}
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
///
/// </summary>
[Description("Rainbow Multiple Moving Averages.")]
[Gui.Design.DisplayName("Rainbow Multiple Moving Averages")]
public class RMMA : Indicator
{
sukhsan
04-10-2009, 10:12 AM
Thanks whself beginner (http://www.ninjatrader-support2.com/vb/member.php?u=7871),
Got it :)
Regards
Sukh
sukhsan
04-10-2009, 01:32 PM
HI
This is GMMA with color filled instead of lines!!!!
May be helpful for some one.
Sukh
sukhsan
04-10-2009, 01:55 PM
Sorry
Previous file was too big for attachment here is to compare.
All Credit goes to Gumphrie and Whself beginner !!!!!!!!
Enjoy:)
Sukh
TxTrader
04-11-2009, 09:24 PM
Have you had any luck with anyone being able to convert this particular Rainbow Indicator to Ninja Script?
If so ... where or could someone re-post?
Chris
This is what I am asking for. A picture is worth a thousand words.:)
Thank you for your time