Help Coding In Ninja From TS - NinjaTrader Programming | futures io social day trading
futures io futures trading


Help Coding In Ninja From TS
Updated: Views / Replies:1,652 / 8
Created: by marketprofiletrader Attachments:2

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 Coding In Ninja From TS

  #1 (permalink)
Elite Member
Fort Lupton, CO/ USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, Market Delta
Broker/Data: AMP Futures and CQG Data
Favorite Futures: 30yr Bonds ZB
 
marketprofiletrader's Avatar
 
Posts: 7 since Aug 2009
Thanks: 2 given, 1 received

Help Coding In Ninja From TS

Hello All,

I am new to ninja trader development and trying to see if anyone can help me to create an indicator that plots current days price + or - to previous days close as of 4:15pm EST on each bar of the current day as a histogram.

ie; ES close previous day 982.00 & Current 5min or whatever period bar closes at 984.00

so histogram at close of current bar below it would plot, +2.00

or if current bar closed at 980.00 then the histogram at close of bar below it would plot, -2.00

If anyone could put me on the path or show me how that would be written in ninja, I would greatly appreciate it! God Bless and Good Trading To All.

Brian

Reply With Quote
 
  #2 (permalink)
Elite Member
USA
 
Futures Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 109 received


marketprofiletrader View Post
Hello All,

I am new to ninja trader development and trying to see if anyone can help me to create an indicator that plots current days price + or - to previous days close as of 4:15pm EST on each bar of the current day as a histogram.

ie; ES close previous day 982.00 & Current 5min or whatever period bar closes at 984.00

so histogram at close of current bar below it would plot, +2.00

welcome to the forum there bud. i see you and i think alike it seems because this is exactly the kind of work i like to do and discover and research. i think this type of method has much more value than traditional indicators.

thinking out loud...

 
Code
                            

double PrevDayClose
()
{

double _prevclose 0;

try
{
DateTime _prevday Time[0].AddDays(-1);

// make sure prior day is always mon-fri never sat or sun

if (Time[0].DayOfWeek == DayOfWeek.Monday)
 
_prevday Time[0].AddDays(-3);

if (
Time[0].DayOfWeek == DayOfWeek.Sunday)
 
_prevday Time[0].AddDays(-2);

_prevclose Close[GetBar(new DateTime(_prevday.Year_prevday.Month_prevday.Day16150))]; // where 16,15,0 means 4:15:00pm based on local PC time

}
catch(
Exception e)
{
Print (
e.ToString()); // just incase index is exceeded somewhere
}


return 
_prevclose;


i think that will get you the prev day close and account for weekends and lack of historical data, etc.

then you need to compare that value vs current close of last bar... something like:

 
Code
                            
double difference PrevDayClose() - Close[0]; 

you should be able to then plot that difference easily if you've ever written any indicator before. once you have the final product please do post it back and share it!

"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain


Last edited by caprica; August 3rd, 2009 at 04:42 AM. Reason: corrected type-o in code
Reply With Quote
The following user says Thank You to caprica for this post:
 
  #3 (permalink)
Elite Member
Fort Lupton, CO/ USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, Market Delta
Broker/Data: AMP Futures and CQG Data
Favorite Futures: 30yr Bonds ZB
 
marketprofiletrader's Avatar
 
Posts: 7 since Aug 2009
Thanks: 2 given, 1 received


Hi Caprica,

Thanks for this code, I will play around and see if I can get what I want from here and then I will repost as requested. Since I am new here, when I get it the way I want it you will be the first to know!

Thanks again for your help in this.

Reply With Quote
 
  #4 (permalink)
Elite Member
Fort Lupton, CO/ USA
 
Futures Experience: Intermediate
Platform: NinjaTrader, Market Delta
Broker/Data: AMP Futures and CQG Data
Favorite Futures: 30yr Bonds ZB
 
marketprofiletrader's Avatar
 
Posts: 7 since Aug 2009
Thanks: 2 given, 1 received

Here is an exact copy of the TS code I am trying to Reproduce in NinjaTrader,
I am not sure, but I don't think I can have 2 symbols on the same chart in NinjaTrader, like you can in TS so I am only interested in the Plot working for the current symbol that I would be able to place the indicator on. If I needed to place 2 seperate charts up to get the same effect as TS with 1 chart that would be fine also. Thanks all, Brian.

Inputs: PriceES(Close of Data1),
PriceNDQ(Close of Data2);
Vars: ESLevel(0), NDQLevel(0), ESYDC(0), NDQYDC(0),
Started(FALSE);
if Date<>Date[1] then
begin
ESYDC = Close[1];
NDQYDC = PriceNDQ[1];
Started=TRUE;
end;
if Started then
begin

ESLevel = Close-ESYDC;
NDQLevel = PriceNDQ-NDQYDC;

end;

Plot1(ESLevel,"es");
Plot2(NDQLevel,"ndq");
Plot3(0,"zero");

if Date<>Date[1] then begin

Print("");
Print("");

end;

Print(Date:10:0,Time:6:0,"ES=",ESLevel," NQ=",NDQLevel);

Reply With Quote
 
  #5 (permalink)
Elite Member
UK
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 88 since Jun 2009
Thanks: 35 given, 84 received

Theres actually a bug in Caprica's code.

You should change this line:

 
Code
_prevclose = Close[0][GetBar(new DateTime(_prevday.Year, _prevday.Month, _prevday.Day, 16, 15, 0); // where 16,15,0 means 4:15:00pm based on local PC time 
to
 
Code
                
_prevclose = Close[GetBar(new DateTime(_prevday.Year, _prevday.Month, _prevday.Day, 16, 15, 0))]; // where 16,15,0 means 4:15:00pm based on local PC time
It creates an interesting indicator :-)

David

Reply With Quote
The following user says Thank You to David for this post:
 
  #6 (permalink)
Elite Member
UK
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 88 since Jun 2009
Thanks: 35 given, 84 received

Here is a working indicator based on Caprica's code

David

Attached Thumbnails
Help Coding In Ninja From TS-es-09-09-25_06_2009-4-range-.jpg  
Attached Files
Register to download File Type: zip ClosingPriceComparison.zip (2.0 KB, 19 views)
Reply With Quote
The following user says Thank You to David for this post:
 
  #7 (permalink)
Elite Member
USA
 
Futures Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 109 received


David View Post
Theres actually a bug in Caprica's code.

You should change this line:

 
Code
_prevclose = Close[0][GetBar(new DateTime(_prevday.Year, _prevday.Month, _prevday.Day, 16, 15, 0); // where 16,15,0 means 4:15:00pm based on local PC time 
to
 
Code
                
_prevclose = Close[GetBar(new DateTime(_prevday.Year, _prevday.Month, _prevday.Day, 16, 15, 0))]; // where 16,15,0 means 4:15:00pm based on local PC time
It creates an interesting indicator :-)

David

oops thanks david I typed that by hand as i went because i've got some similar code that i use for some other functions and i had to take only the relevant portion out of my code.

if you have thrown it all the way into an indicator can you post it and a screenshot? do you find it useful?

"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

Reply With Quote
 
  #8 (permalink)
Elite Member
USA
 
Futures Experience: Master
Platform: NinjaTrader
 
caprica's Avatar
 
Posts: 155 since Jul 2009
Thanks: 45 given, 109 received

oh cool you just did

"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain

Reply With Quote
 
  #9 (permalink)
Elite Member
UK
 
Futures Experience: Intermediate
Platform: NinjaTrader
Favorite Futures: Futures
 
Posts: 88 since Jun 2009
Thanks: 35 given, 84 received

Caprica, you did all the hard work, I just threw it into an indicator

Its too early to tell if the indicator is useful. It seems to be one of those that intuitively should provide a good insight - I personally think yesterdays closing, high and low do influence trading today, however I won't be using it as part of my ATS.

David

Reply With Quote

Reply



futures io > > > > > Help Coding In Ninja From TS

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
TS Supertrend gwaco Traders Hideout 14 November 21st, 2014 09:20 AM
How To Build A Ninja Indicator - coding / programming hondo69 NinjaTrader Programming 3 August 30th, 2013 01:37 PM
TS with OwnData and esignal mpascal TradeStation 1 December 14th, 2010 01:07 AM
esig v.s TS chanman Trading Reviews and Vendors 2 September 28th, 2010 05:45 PM
look for 2 TS indicators jz166 EasyLanguage Programming 2 June 13th, 2010 06:49 PM


All times are GMT -4. The time now is 10:48 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-16 in 0.12 seconds with 20 queries on phoenix via your IP 54.227.51.103