NexusFi: Find Your Edge


Home Menu

 





The indicator appears and disappears


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one eryo with 5 posts (0 thanks)
    2. looks_two Fat Tails with 3 posts (3 thanks)
    3. looks_3 cory with 1 posts (0 thanks)
    4. looks_4 bobwest with 1 posts (0 thanks)
    1. trending_up 3,435 views
    2. thumb_up 3 thanks given
    3. group 3 followers
    1. forum 10 posts
    2. attach_file 1 attachments




 
Search this Thread

The indicator appears and disappears

  #1 (permalink)
 eryo 
Babia, Spain
 
Experience: Intermediate
Platform: ninja trader
Broker: zen fire
Trading: gold
Posts: 48 since Apr 2010
Thanks Given: 22
Thanks Received: 8

Excuse my English. I have scheduled an indicator that sometimes appears on the graph and not others. Why? Help please

Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Build trailing stop for micro index(s)
Psychology and Money Management
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
Are there any eval firms that allow you to sink to your …
Traders Hideout
New Micros: Ultra 10-Year & Ultra T-Bond -- Live Now
Treasury Notes and Bonds
ZombieSqueeze
Platforms and Indicators
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Get funded firms 2023/2024 - Any recommendations or word …
59 thanks
Funded Trader platforms
36 thanks
NexusFi site changelog and issues/problem reporting
22 thanks
The Program
20 thanks
GFIs1 1 DAX trade per day journal
19 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



eryo View Post
Excuse my English. I have scheduled an indicator that sometimes appears on the graph and not others. Why? Help please

what is indicator's name?

Reply With Quote
  #4 (permalink)
 eryo 
Babia, Spain
 
Experience: Intermediate
Platform: ninja trader
Broker: zen fire
Trading: gold
Posts: 48 since Apr 2010
Thanks Given: 22
Thanks Received: 8

It is one that I designed for practicing simple. If the closure of 0 is greater than the closing of the closure 1 and 2 to draw a triangle. It works but it does not always appear in the graph

Started this thread Reply With Quote
  #5 (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


eryo View Post
It is one that I designed for practicing simple. If the closure of 0 is greater than the closing of the closure 1 and 2 to draw a triangle. It works but it does not always appear in the graph

You need to post your indicator as an attachment, otherwise we can only make guesses.

Reply With Quote
  #6 (permalink)
 eryo 
Babia, Spain
 
Experience: Intermediate
Platform: ninja trader
Broker: zen fire
Trading: gold
Posts: 48 since Apr 2010
Thanks Given: 22
Thanks Received: 8

the code is this. I have placed overlay in true and still fails
Thank you.


#region Using declarations
using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Xml.Serialization;
using NinjaTrader.Cbi;
using NinjaTrader.Data;
using NinjaTrader.Gui.Chart;
#endregion

// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
[Description("Enter the description of your new custom indicator here")]
public class aaaTad : Indicator
{
#region Variables
// Wizard generated variables
// User defined variables (add any user defined variables below)
#endregion

/// <summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
/// </summary>
protected override void Initialize()
{
Overlay = false;
}

/// <summary>
/// Called on each bar update event (incoming tick)
/// </summary>
protected override void OnBarUpdate()
{
if(Close[0]>=Close[1]&& //modificacion
Close[0]>Open[1]&&
Close[0]>Close[-1]&&
Close[0]>Close[-2]&&
Close[0]>Close[-3])

DrawTriangleDown(CurrentBar.ToString(),true,0,High[0]+((TickSize*4)*2),Color.Blue);//codigo para dibujar una raya

//modificacion a partir de aqui

if(Close[0]<=Close[1]&&
Close[0]<Open[1]&&
Close[0]<Close[-1]&&
Close[0]<Close[-2]&&
Close[0]<Close[-3])

DrawTriangleUp(CurrentBar.ToString(),true,0,Low[0]-((TickSize*4)*2),Color.Red);

DrawRay("tag1", 10, 1000, 0, 1001, Color.Green);//nuevo


}

#region Properties

#endregion
}
}

#region NinjaScript generated code. Neither change nor remove.
// This namespace holds all indicators and is required. Do not change it.
namespace NinjaTrader.Indicator
{
public partial class Indicator : IndicatorBase
{
private aaaTad[] cacheaaaTad = null;

private static aaaTad checkaaaTad = new aaaTad();

/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public aaaTad aaaTad()
{
return aaaTad(Input);
}

/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public aaaTad aaaTad(Data.IDataSeries input)
{
if (cacheaaaTad != null)
for (int idx = 0; idx < cacheaaaTad.Length; idx++)
if (cacheaaaTad[idx].EqualsInput(input))
return cacheaaaTad[idx];

lock (checkaaaTad)
{
if (cacheaaaTad != null)
for (int idx = 0; idx < cacheaaaTad.Length; idx++)
if (cacheaaaTad[idx].EqualsInput(input))
return cacheaaaTad[idx];

aaaTad indicator = new aaaTad();
indicator.BarsRequired = BarsRequired;
indicator.CalculateOnBarClose = CalculateOnBarClose;
#if NT7
indicator.ForceMaximumBarsLookBack256 = ForceMaximumBarsLookBack256;
indicator.MaximumBarsLookBack = MaximumBarsLookBack;
#endif
indicator.Input = input;
Indicators.Add(indicator);
indicator.SetUp();

aaaTad[] tmp = new aaaTad[cacheaaaTad == null ? 1 : cacheaaaTad.Length + 1];
if (cacheaaaTad != null)
cacheaaaTad.CopyTo(tmp, 0);
tmp[tmp.Length - 1] = indicator;
cacheaaaTad = tmp;
return indicator;
}
}
}
}

// This namespace holds all market analyzer column definitions and is required. Do not change it.
namespace NinjaTrader.MarketAnalyzer
{
public partial class Column : ColumnBase
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.aaaTad aaaTad()
{
return _indicator.aaaTad(Input);
}

/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.aaaTad aaaTad(Data.IDataSeries input)
{
return _indicator.aaaTad(input);
}
}
}

// This namespace holds all strategies and is required. Do not change it.
namespace NinjaTrader.Strategy
{
public partial class Strategy : StrategyBase
{
/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
[Gui.Design.WizardCondition("Indicator")]
public Indicator.aaaTad aaaTad()
{
return _indicator.aaaTad(Input);
}

/// <summary>
/// Enter the description of your new custom indicator here
/// </summary>
/// <returns></returns>
public Indicator.aaaTad aaaTad(Data.IDataSeries input)
{
if (InInitialize && input == null)
throw new ArgumentException("You only can access an indicator with the default input/bar series from within the 'Initialize()' method");

return _indicator.aaaTad(input);
}
}
}
#endregion

Started this thread Reply With Quote
  #7 (permalink)
 
bobwest's Avatar
 bobwest 
Western Florida
Site Moderator
 
Experience: Advanced
Platform: Sierra Chart
Trading: ES, YM
Frequency: Several times daily
Duration: Minutes
Posts: 8,162 since Jan 2013
Thanks Given: 57,343
Thanks Received: 26,267


eryo View Post
the code is this. I have placed overlay in true and still fails
Thank you.

It's going to be difficult for anyone to deal with unformatted code like this. You would be better off to export the indicator and attach it as an attachment to a post here, so someone can figure out what's going on.

If you're not sure how to do that, it's in Ninja Help, or you can ask here.

Bob.

When one door closes, another opens.
-- Cervantes, Don Quixote
Reply With Quote
  #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

Please post indicator as attachement.

The code above is difficult to read.

Reply With Quote
  #9 (permalink)
 eryo 
Babia, Spain
 
Experience: Intermediate
Platform: ninja trader
Broker: zen fire
Trading: gold
Posts: 48 since Apr 2010
Thanks Given: 22
Thanks Received: 8

thank you

Attached Files
Elite Membership required to download: aaaTac.cs
Started this thread Reply With Quote
  #10 (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



eryo View Post
thank you

(1) In the beginning of OnBarUpdate() you need to insert the line
 
Code
if(CurrentBar < 3)
    return;

This is to avoid to try to access a value 3 bars ago for the first three bars, as such a value would not exist.


(2) You cannot use negative indices with Close.

Close[0], Open[0] refer to the last bar on your chart.

Reply With Quote
Thanked by:




Last Updated on October 30, 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