NexusFi: Find Your Edge


Home Menu

 





NT Script Help for itrend.


Discussion in NinjaTrader

Updated
    1. trending_up 2,713 views
    2. thumb_up 0 thanks given
    3. group 1 followers
    1. forum 3 posts
    2. attach_file 0 attachments




 
Search this Thread

NT Script Help for itrend.

  #1 (permalink)
 
sudhirc's Avatar
 sudhirc 
detroit,mi
sc
 
Experience: Intermediate
Platform: NT
Broker: NT
Trading: ES
Frequency: Every few months
Duration: Hours
Posts: 417 since Sep 2011
Thanks Given: 1,709
Thanks Received: 471

Scipt: ITrend (I think i got this from Ninja forums)

Trying to change the color of the trigger to change to lime when it crosses above the itrend and red when it crosses below itrend.

/*
Price((H+L)/2),
alpha(.07);
Vars:
Smooth(0),
Itrend(0);
Smooth = (Price + 2*Price[1] + 2*Price[2] + Price[3])/6;
Itrend = (1 - .5*alpha)*(1 - .5*alpha)*(Smooth-2*Smooth[1] + Smooth[2]) + 2*(1 - alpha)*Itrend[1] - (1 - alpha)*(1 - alpha)*Itrend[2];
If currentbar < 7
then Itrend = (Price - 2*Price[1]+ Price[2]) / 4;
Plot1(Itrend, "Itrend");
Plot2(Itrend[1], "Trigger");
*/


Thanks for your help in advance.
Sudhir


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
ZombieSqueeze
Platforms and Indicators
REcommedations for programming help
Sierra Chart
About a successful futures trader who didnt know anythin …
Psychology and Money Management
MC PL editor upgrade
MultiCharts
How to apply profiles
Traders Hideout
 
  #2 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,469 since Jun 2009
Thanks Given: 33,246
Thanks Received: 101,669

 
Thread Moved


Moved to NinjaTrader Programming



When creating a new thread, note which subforum you are in. Here is a short list of suggestions:

- Topic: Anything to do with an Elite indicator -> Subforum: The Elite Circle
- Topic: Looking for an existing indicator, or how-to use an indicator -> Subforum: (the platform)
- Topic: Programmer needing help with non-Elite indicator -> Subforum: (the platform) - Programming
- Topic: Want an indicator created/modified -> Reply to "Want indicator created free" in Elite Circle
- Topic: Vendors (trading rooms, commercial indicators) -> Subforum: Vendors/Product Reviews
- Topic: Discussion of Forex or Currency trading -> Subforum: Forex and Currency Trading
- Topic: Journals of your trading -> Subforum: Trading Journals or Elite Trading Journals
- Topic: General trading related discussions -> Subforum: Traders Hideout
- Topic: Discussion of a trading method -> Subforum: Traders Hideout
- Topic: Automated Trading -> Subforum: Elite Automated Trading

Last, any Elite Member may create more or less any of these topics in The Elite Circle at your own discretion (your support is appreciated).

This is just a short general list and doesn't cover everything. If you are unsure where to create your new thread, just create it in Traders Hideout and a moderator will move it if necessary.

-- Big Mike Trading




Join the free Markets Chat beta: one platform, all the trade rooms!

We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on Twitter Visit my NexusFi Trade Journal Reply With Quote
  #3 (permalink)
 
sam028's Avatar
 sam028 
Site Moderator
 
Posts: 3,765 since Jun 2009
Thanks Given: 3,825
Thanks Received: 4,629


Is it for Ninjatrader or for another platform ?
It looks like EL, not C#...

Success requires no deodorant! (Sun Tzu)
Follow me on Twitter Reply With Quote
  #4 (permalink)
 
sudhirc's Avatar
 sudhirc 
detroit,mi
sc
 
Experience: Intermediate
Platform: NT
Broker: NT
Trading: ES
Frequency: Every few months
Duration: Hours
Posts: 417 since Sep 2011
Thanks Given: 1,709
Thanks Received: 471

It for NT7 may be i copied the wrong lines from the script.


///<summary>
/// This method is used to configure the indicator and is called once before any bar data is loaded.
///</summary>
protectedoverridevoid Initialize()
{

Add(
new Plot(Color.FromKnownColor(KnownColor.Blue), PlotStyle.Line, "TrendPlot"));
Add(
new Plot(Color.FromKnownColor(KnownColor.Red), PlotStyle.Line, "TriggerPlot"));


trend =
new DataSeries(this);
trigger =
new DataSeries(this);
smooth =
new DataSeries(this);


CalculateOnBarClose =
true;
Overlay =
false;
PriceTypeSupported =
false;

}
///<summary>
/// Called on each bar update event (incoming tick)
///</summary>
protectedoverridevoid OnBarUpdate()
{

if (CurrentBar==0)
{
smooth.Set(
0);
trigger.Set(
0);
trend.Set(
0);
TrendPlot.Set(
0);
TriggerPlot.Set(
0);

return;
}

int Per1=PeriodsP;
int Per2=PeriodsP;


if(CurrentBar <= 7)
return;

double SmoothTemp = (Median[0] + 2* Median[1] + 2* Median[2] + Median[3])/6;
smooth.Set(SmoothTemp);


double ItrendTemp = (alpha - alpha*alpha/4)* smooth[0]+0.5*alpha*alpha*smooth[1]-(alpha-0.75*alpha*alpha)*smooth[2]+2*(1-alpha)*trend[1]-(1-alpha)*(1-alpha)*trend[2];
//double ItrendTemp = (1 - .5 * alpha)* (1 - .5*alpha)*(smooth[0] - 2*smooth[1] + smooth[2]) + 2*(1 - alpha)* trend[1] - (1 - alpha)*(1 - alpha)*trend[2];
trend.Set(ItrendTemp);

trigger.Set(trend[
1]);

TrendPlot.Set(trend[
0]);
TriggerPlot.Set(trigger[
0]);

Thank you,
Sudhir

Started this thread Reply With Quote




Last Updated on October 17, 2011


© 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