Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
Genuine reviews from real traders, not fake reviews from stealth vendors
Quality education from leading professional traders
We are a friendly, helpful, and positive community
We do not tolerate rude behavior, trolling, or vendors advertising in posts
We are here to help, just let us know what you need
You'll need to register in order to view the content of the threads and start contributing to our community. It's free for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
CS0102 - Already contains a definition for Gann Indicator - Dropdown box
Hello all - Let me start by saying that I am new a C++ but have plenty of experience with Perl and Javascript, so programming isn't foreign to me... C++ is throwing me however.
I've created a new Gann indicator to look more like the one offered in ToS - This Gann indicator allows you to choose the period length, allows you to choose SMA or EMA, and colors the lines based on buy or sell indicators. The current Gann only plots the line from a 12 period SMA and only paints it gray. So I hope this is an improvement that others can use.
I do have an issue - All of the above works great, but the choice for SMA or EMA is just a simple string input in the properties. I am attempting to turn that in to a dropdown box and that is where I am getting held up. The dropdown box variable is set up as such:
// Wizard generated variables
private int lENGTH = 12; // Default setting for LENGTH
// User defined variables (add any user defined variables below)
private double vALUE_LOW = 1; // Default setting for VALUE_LOW
private double vALUE_HIGH = 1; // Default setting for VALUE_HIGH
private double SWING; private MADROPDOWN MATYPE = MADROPDOWN.SMA;
#region Properties
[Description("Variable for Moving Average type")]
[Category("Parameters")]
public MADROPDOWN MATYPE
{
get { return mATYPE; }
set { mATYPE = value; }
}
public enum MADROPDOWN
{
EMA,
HMA,
SMA,
WMA,
}
Entire code is attached and I will also post the final code once fixed if someone wants to use it.
Can you help answer these questions from other members on NexusFi?
Works great - of course Cory. Thank you so much! Still a little confused however. Looks to me like you simply added 2 to the end of the MATYPE variable for all instances of that variable in the code. I guess I'm confused as to where the conflict was.
Exported using NT Version 7.0.1000.10
This is a new implementation of the Gann HiLo activator for NinjaTrader 7. The HiLo Activator was introduced by Robert Krausz with his FibonacciTrader and first described by him in "The New Gann Swing Chartist", …
It comes with 28 different moving averages, colors, arrows, paintbars and sound alerts.
Improved code efficiency
In order to improve code efficiency the stop line is not based on the current value of the moving average, but on the value 1 bar ago. This is a specific modification that is useful for intraday charts. In order to obtain real-time sound alerts, you need to run the indicator with the setting COBC (CalculateOnBarClose) = false. If you use the moving average of the current value, the moving average needs to be recalculated with every incoming tick. The stopline - that is the high average or low average depending on the trend - thus becomes a moving target. When price approaches the stopline, it moves away from price, which is an absolutely useless feature. Calculating the moving average from the prior n values of the high or low results in a stable stop line, which is only calculated once when the first tick of a bar is detected.
The HiLo Activator is just a special case of the SuperTrend, which is more versatile, as it allows you to increase or decrease the distance between stop line and price based on volatility. I therefore suggest not to use the Gann HiLo Activator but to use the SuperTrend instead, as it is a better tool.
Attached is a chart that compares the HiLo Activator with an adapted SuperTrend, which uses the bar median as input series and half the average bar range as offset.