PDA

View Full Version : How to Detect Arrow in Chart


NingNing
07-21-2010, 12:18 AM
Hi

I am using third arty indicator and it plots Up/Down Arrow for Buy/Sell signals. I want to know how to code in order to detect Up/Down Arrows being drawn and exeute the relevant strategy? thx in advance

NinjaTrader_Tim
07-21-2010, 06:04 AM
Hi NingNing,

With NinjaTrader 7, you can access drawing objects with IDrawObject:
http://www.ninjatrader.com/support/helpGuides/nt7/index.html?idrawobject.htm

Aside from that, there is no explicit way of accessing/detecting an arrow. Instead, you will need to copy the same condition the indicator uses, and make executions based on that.

kevinlouie
07-21-2010, 06:19 AM
is there something similar available for 6.5V?

NinjaTrader_Tim
07-21-2010, 06:33 AM
Hi kevinlouie,

Unfortunately not, in that case you would want to use the same conditions/logic the indicator uses. As an alternative, you can add a plot to the indicator, for example setting it to a value of 1 when the arrow conditions are true, and base your conditions on the plot value of the indicator.

kevinlouie
07-21-2010, 07:04 AM
do you have a sample of it to share or from other thread?

NinjaTrader_Tim
07-21-2010, 07:12 AM
Hi kevinlouie,

Unfortunately not, however, lets say the condition in the indicator, "Indicator1", for the arrow is....

if (Close[0] > Close[1])
{
DrawArrowUp(....)
}

you could create a plot, (with the necessary code in Initialize() and Properties), then add it to the condition...

if (Close[0] > Close[1])
{
DrawArrowUp(....)
Plot1.Set(1);
}
else
{
Plot1.Set(0);
}


then access the code from your strategy...

if (Indicator1().Plot1[0] ==0)
{
EnterLong();
}

everington_f
03-17-2011, 04:01 AM
So if a third party indicator plots a black line width 3 on the price panel there is no way to detect this new plot via ninjacript? I do not have access to the indicator code, but simply want to detect new drawing objects that appear on the price panel.

Regards

NinjaTrader_Tim
03-17-2011, 08:33 AM
Hi everington_f,

It's generally recommend that developers send logic along with the drawing objects, as in my example, like a bool, or explicit plot value.

You may be able to do something like:
if (Indicator1().Plot1[0] >0)
do something;

koganam
03-17-2011, 06:16 PM
Hi

I am using third arty indicator and it plots Up/Down Arrow for Buy/Sell signals. I want to know how to code in order to detect Up/Down Arrows being drawn and exeute the relevant strategy? thx in advance

You will have to iterate through the DrawObjects collection, and act on the relevant arrow.

ref: http://www.ninjatrader.com/support/helpGuides/nt7/index.html?drawobjects.htm

koganam
03-17-2011, 06:19 PM
... You may be able to do something like:
if (Indicator1().Plot1[0] >0)
do something;

That only works if the developer has not set the ChartOnly property.