Help with adding new code to existing oscillator indicator script - NinjaTrader Programming | futures io social day trading
futures io futures trading


Help with adding new code to existing oscillator indicator script
Updated: Views / Replies:1,491 / 3
Created: by kendallw4 Attachments:1

Welcome to futures io.

(If you already have an account, login at the top of the page)

futures io is the largest futures trading community on the planet, with over 90,000 members. At futures io, our goal has always been and always will be to create a friendly, positive, forward-thinking community where members can openly share and discuss everything the world of trading has to offer. The community is one of the friendliest you will find on any subject, with members going out of their way to help others. Some of the primary differences between futures io and other trading sites revolve around the standards of our community. Those standards include a code of conduct for our members, as well as extremely high standards that govern which partners we do business with, and which products or services we recommend to our members.

At futures io, our focus is on quality education. No hype, gimmicks, or secret sauce. The truth is: trading is hard. To succeed, you need to surround yourself with the right support system, educational content, and trading mentors Ė all of which you can find on futures io, utilizing our social trading environment.

With futures io, you can find honest trading reviews on brokers, trading rooms, indicator packages, trading strategies, and much more. Our trading review process is highly moderated to ensure that only genuine users are allowed, so you donít need to worry about fake reviews.

We are fundamentally different than most other trading sites:
  • We are here to help. Just let us know what you need.
  • We work extremely hard to keep things positive in our community.
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts.
  • We firmly believe in and encourage sharing. The holy grail is within you, we can help you find it.
  • We expect our members to participate and become a part of the community. Help yourself by helping others.

You'll need to register in order to view the content of the threads and start contributing to our community.  It's free and simple.

-- Big Mike, Site Administrator

Reply
 
Thread Tools Search this Thread
 

Help with adding new code to existing oscillator indicator script

  #1 (permalink)
Trading Apprentice
Raleigh, USA
 
Futures Experience: Intermediate
Platform: Ninjatrader
Favorite Futures: Stocks
 
Posts: 3 since May 2011
Thanks: 0 given, 1 received

Help with adding new code to existing oscillator indicator script

Iím new to Ninjatrader and have really struggled with coding thus far but trying to learn it. I want to write code into the attached Ninjascript that will signal a BUY arrow on the oscillator when the following conditions occur:

REI line below -40 for 6 or fewer consecutive bars AND
Close[1] < Close[2] AND
Open [0] <= High[1] and High[2] AND
(High[0] > High[1]) OR (High[0] > High[2]) AND High[0]>Open[0]


I also want it to cancel the above BUY condition signal if the following occurs:

REI line below -40 for 7 or more consecutive bars


Can someone help me with this?


///<summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
///</summary>
protectedoverridevoid Initialize()
{
Add(
new Line(Color.Blue, -45, "Lower"));
Add(
new Line(Color.Blue, 45, "Upper"));


Add(
new Plot(Color.LimeGreen, "DeMarkREI_Plot_Up"));
Add(
new Plot(Color.Red, "DeMarkREI_Plot_Down"));

rei =
new DataSeries(this);
}
///<summary>
/// Calculates the indicator value(s) at the current index.
///</summary>
protectedoverridevoid OnBarUpdate()
{
if (CurrentBar>period)
{
double SUM=0;
double SUMABS=0;
double DeMarkREI=0;
double TDREI=0;

for(int x=0; x<period; x++)
{
SUM += ((High[x]-High[x+
2])+(Low[x]-Low[x+2]));
SUMABS += (Math.Abs(High[x]-High[x+
2])+Math.Abs(Low[x]-Low[x+2]));
}

if (SUMABS>0) DeMarkREI=SUM/SUMABS;
TDREI=
100*DeMarkREI;
rei.Set(TDREI);


if (Rising(rei))
{
if (!wasRising) DeMarkREI_Plot_Rising.Set(1,rei[1]);
DeMarkREI_Plot_Rising.Set(TDREI);
wasRising=
true;
}
else
{
if (wasRising) DeMarkREI_Plot_Falling.Set(1,rei[1]);
DeMarkREI_Plot_Falling.Set(TDREI);
wasRising=
false;
}
}
}
#region Properties

///<summary>
///</summary>
[Browsable(false)]
[XmlIgnore()]
public DataSeries DeMarkREI_Plot_Rising
{
get { return Values[0]; }
}
///<summary>
///</summary>
[Browsable(false)]
[XmlIgnore()]
public DataSeries DeMarkREI_Plot_Falling
{
get { return Values[1]; }
}
///<summary>
///</summary>
[Browsable(false)]
[XmlIgnore()]
public DataSeries DeMarkREI_Values
{
get { return rei; }
}
[Description(
"Number of bars to calculate")]
[Category(
"Parameters")]
publicint Period
{
get { return period; }
set { period = Math.Max(1, value); }
}

#endregion

Reply With Quote
 
  #2 (permalink)
Quick Summary
Quick Summary Post

Quick Summary is created and edited by users like you... Add FAQ's, Links and other Relevant Information by clicking the edit button in the lower right hand corner of this message.

 
  #3 (permalink)
Market Wizard
Las Vegas, NV
 
Futures Experience: Advanced
Platform: Abacus, Slide Rule, HP-65, Metastock, TOS, NT
Favorite Futures: Futures
 
aligator's Avatar
 
Posts: 3,424 since Aug 2010
Thanks: 1,053 given, 5,822 received
Forum Reputation: Legendary


kendallw4,

It is easier to get help here if you attach the zip file of the NT code so that it can be modified.

Reply With Quote
 
  #4 (permalink)
Trading Apprentice
Raleigh, USA
 
Futures Experience: Intermediate
Platform: Ninjatrader
Favorite Futures: Stocks
 
Posts: 3 since May 2011
Thanks: 0 given, 1 received

zip file of base indicator attached

Attached Files
Register to download File Type: zip demarkrei.zip (1.8 KB, 29 views)
Reply With Quote
The following 2 users say Thank You to kendallw4 for this post:

Reply



futures io > > > > > Help with adding new code to existing oscillator indicator script

Thread Tools Search this Thread
Search this Thread:

Advanced Search



Upcoming Webinars and Events (4:30PM ET unless noted)

Jigsaw Trading: TBA

Elite only

FuturesTrader71: TBA

Elite only

NinjaTrader: TBA

Jan 18

RandBots: TBA

Jan 23

GFF Brokers & CME Group: Futures & Bitcoin

Elite only

Adam Grimes: TBA

Elite only

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I add existing indicators to an indicator I am creating? forrestang NinjaTrader Programming 27 July 19th, 2011 04:31 AM
Ninja script - learning code + programming alias NinjaTrader Programming 20 May 11th, 2011 06:01 AM
code for NT7 volume oscillator euroventure NinjaTrader 2 December 22nd, 2010 12:42 PM


All times are GMT -4. The time now is 06:54 PM.

Copyright © 2017 by futures io, s.a., Av Ricardo J. Alfaro, Century Tower, Panama, +507 833-9432, info@futures.io
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.
no new posts
Page generated 2017-12-13 in 0.34 seconds with 20 queries on phoenix via your IP 54.90.92.204