NexusFi: Find Your Edge


Home Menu

 





CS0102 - Already contains a definition for Gann Indicator - Dropdown box


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one BChirhart with 3 posts (0 thanks)
    2. looks_two cory with 3 posts (3 thanks)
    3. looks_3 Quick Summary with 1 posts (0 thanks)
    4. looks_4 Fat Tails with 1 posts (3 thanks)
    1. trending_up 2,421 views
    2. thumb_up 6 thanks given
    3. group 3 followers
    1. forum 7 posts
    2. attach_file 3 attachments




 
Search this Thread

CS0102 - Already contains a definition for Gann Indicator - Dropdown box

  #1 (permalink)
BChirhart
Omaha, NE
 
Posts: 4 since Jun 2011
Thanks Given: 2
Thanks Received: 1

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.

Attached Files
Elite Membership required to download: BDCGann3.cs
Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Exit Strategy
NinjaTrader
Better Renko Gaps
The Elite Circle
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
REcommedations for programming help
Sierra Chart
NexusFi Journal Challenge - May 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Spoo-nalysis ES e-mini futures S&P 500
34 thanks
Just another trading journal: PA, Wyckoff & Trends
30 thanks
Tao te Trade: way of the WLD
24 thanks
Bigger Wins or Fewer Losses?
23 thanks
GFIs1 1 DAX trade per day journal
21 thanks
  #3 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090



BChirhart View Post
...

Entire code is attached and I will also post the final code once fixed if someone wants to use it.

I think it's hard to remember which letter is capital why not just give it a numner

Attached Files
Elite Membership required to download: BDCGann3.cs
Reply With Quote
Thanked by:
  #4 (permalink)
BChirhart
Omaha, NE
 
Posts: 4 since Jun 2011
Thanks Given: 2
Thanks Received: 1


cory View Post
I think it's hard to remember which letter is capital why not just give it a numner

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.

Reply With Quote
  #5 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090


BChirhart View Post
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.

my guess is it conflicts with sample indicator you imported.

Reply With Quote
  #6 (permalink)
BChirhart
Omaha, NE
 
Posts: 4 since Jun 2011
Thanks Given: 2
Thanks Received: 1


cory View Post
my guess is it conflicts with sample indicator you imported.

So each variable needs to be unique to ALL scripts?

Reply With Quote
  #7 (permalink)
 
cory's Avatar
 cory 
virginia
 
Experience: Intermediate
Platform: ninja
Trading: NQ
Posts: 6,098 since Jun 2009
Thanks Given: 877
Thanks Received: 8,090


BChirhart View Post
So each variable needs to be unique to ALL scripts?

check out good enum pratice here global namespace error already contains defination - [AUTOLINK]NinjaTrader[/AUTOLINK] Support Forum

Reply With Quote
Thanked by:
  #8 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker: Interactive Brokers
Trading: Keyboard
Posts: 9,888 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,102

I have posted a modified version of the Gann HiLo Activator here:



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.


Reply With Quote
Thanked by:




Last Updated on September 3, 2014


© 2024 NexusFi™, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
All information is for educational use only and is not investment advice. There is a substantial risk of loss in trading commodity futures, stocks, options and foreign exchange products. Past performance is not indicative of future results.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Privacy Policy - Downloads - Top
no new posts