Trouble Programming Simple Indicator - NinjaTrader Programming | futures io social day trading
futures io futures trading


Trouble Programming Simple Indicator
Updated: Views / Replies:2,091 / 16
Created: by buddy858 Attachments:10

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
 10  
 
Thread Tools Search this Thread
 

Trouble Programming Simple Indicator

  #1 (permalink)
Elite Member
Mandeville, LA
 
Futures Experience: Intermediate
Platform: Ninja Trader, Tradestation
Favorite Futures: CL, GC, ES
 
buddy858's Avatar
 
Posts: 101 since Dec 2011
Thanks: 495 given, 146 received

Trouble Programming Simple Indicator

I just started trying to learn how to program yesterday, but I'm having a really difficult go at it.

I was attempting to divide the volume output by seconds per bar for use with Tick, Range and Renko type charts, but I really have no idea what I'm doing. I've been working on it and watching videos and reading the help menu for hours and hours, but I'm getting pretty stuck now. I have looked at other indicators and taken a few ideas from a few, but it's just not working. Would anyone be willing to help me out with this? I would really appreciate it. My retarded code is attached. I'm sure it's laughable, at best.

Best,

Daniel

VolumePerSecond.cs


Last edited by buddy858; May 18th, 2013 at 06:58 PM.
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)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary



buddy858 View Post
I just started trying to learn how to program yesterday, but I'm having a really difficult go at it.

I was attempting to divide the volume output by seconds per bar for use with Tick, Range and Renko type charts, but I really have no idea what I'm doing. I've been working on it and watching videos and reading the help menu for hours and hours, but I'm getting pretty stuck now. I have looked at other indicators and taken a few ideas from a few, but it's just not working. Would anyone be willing to help me out with this? I would really appreciate it. My retarded code is attached. I'm sure it's laughable, at best.

Best,

Daniel

Attachment 112938

You have not declared the variable totalseconds, which would be of type double. Also there is a useless DataSeries volpersec, which has not been initialized and not be used so far. Just delete it.

Further your indicator will not display correctly for the first bar of each session and the first bar after a technical break, because your way of calculating the bar duration includes the session breaks and technical breaks.

Otherwise your indicator should work as expected.

Reply With Quote
The following 2 users say Thank You to Fat Tails for this post:
 
  #4 (permalink)
Elite Member
Mandeville, LA
 
Futures Experience: Intermediate
Platform: Ninja Trader, Tradestation
Favorite Futures: CL, GC, ES
 
buddy858's Avatar
 
Posts: 101 since Dec 2011
Thanks: 495 given, 146 received


Fat Tails View Post
You have not declared the variable totalseconds, which would be of type double. Also there is a useless DataSeries volpersec, which has not been initialized and not be used so far. Just delete it.

Further your indicator will not display correctly for the first bar of each session and the first bar after a technical break, because your way of calculating the bar duration includes the session breaks and technical breaks.

Otherwise your indicator should work as expected.

Ok, thank you very much. Going to take a look now and get back to you...

Reply With Quote
 
  #5 (permalink)
Elite Member
Mandeville, LA
 
Futures Experience: Intermediate
Platform: Ninja Trader, Tradestation
Favorite Futures: CL, GC, ES
 
buddy858's Avatar
 
Posts: 101 since Dec 2011
Thanks: 495 given, 146 received


Fat Tails View Post
You have not declared the variable totalseconds, which would be of type double. Also there is a useless DataSeries volpersec, which has not been initialized and not be used so far. Just delete it.

Further your indicator will not display correctly for the first bar of each session and the first bar after a technical break, because your way of calculating the bar duration includes the session breaks and technical breaks.

Otherwise your indicator should work as expected.

I added "private double totalseconds; under variables. Did I at least get that right? Probably not. Please forgive my ignorance.

Re: "your indicator will not display correctly for the first bar of each session..." I deleted the "If current bar < 1 return..." lines under OnBarUpdate. Was that what I should have done to address this problem? I suppose it's obvious I have no idea what I'm doing here, and that's fine. I just have to keep working at it and asking for help if I'm going to learn how to do this.

Also, under properties, is that all I need in that section?

Thank you so very much for your help; I really appreciate it

Reply With Quote
 
  #6 (permalink)
Elite Member
Mandeville, LA
 
Futures Experience: Intermediate
Platform: Ninja Trader, Tradestation
Favorite Futures: CL, GC, ES
 
buddy858's Avatar
 
Posts: 101 since Dec 2011
Thanks: 495 given, 146 received

I also deleted the DataSeries. It compiles, but it yields no values when added to a chart...

Attached Files
Register to download File Type: cs VolPerSec.cs (5.4 KB, 6 views)
Reply With Quote
 
  #7 (permalink)
Elite Member
Mandeville, LA
 
Futures Experience: Intermediate
Platform: Ninja Trader, Tradestation
Favorite Futures: CL, GC, ES
 
buddy858's Avatar
 
Posts: 101 since Dec 2011
Thanks: 495 given, 146 received


Fat Tails View Post
You have not declared the variable totalseconds, which would be of type double. Also there is a useless DataSeries volpersec, which has not been initialized and not be used so far. Just delete it.

Further your indicator will not display correctly for the first bar of each session and the first bar after a technical break, because your way of calculating the bar duration includes the session breaks and technical breaks.

Otherwise your indicator should work as expected.

Ok, I found this Make sure you have enough bars in the data series you are accessing - NinjaTrader Support Forum so I now realize I need that "If (currentbar < 1) return;" statement...

It's still not working for me though...not sure what the problem is now...

Reply With Quote
 
  #8 (permalink)
Elite Member
Mandeville, LA
 
Futures Experience: Intermediate
Platform: Ninja Trader, Tradestation
Favorite Futures: CL, GC, ES
 
buddy858's Avatar
 
Posts: 101 since Dec 2011
Thanks: 495 given, 146 received


Fat Tails View Post
You have not declared the variable totalseconds, which would be of type double. Also there is a useless DataSeries volpersec, which has not been initialized and not be used so far. Just delete it.

Further your indicator will not display correctly for the first bar of each session and the first bar after a technical break, because your way of calculating the bar duration includes the session breaks and technical breaks.

Otherwise your indicator should work as expected.

Ok, I've got it now. Bertrand at NT support actually helped me get this all worked out over the past hour or so. One step closer now...

Daniel

Attached Files
Register to download File Type: cs VolumePerSecond.cs (5.7 KB, 18 views)
Reply With Quote
 
  #9 (permalink)
Elite Member
Mandeville, LA
 
Futures Experience: Intermediate
Platform: Ninja Trader, Tradestation
Favorite Futures: CL, GC, ES
 
buddy858's Avatar
 
Posts: 101 since Dec 2011
Thanks: 495 given, 146 received


Fat Tails View Post
You have not declared the variable totalseconds, which would be of type double. Also there is a useless DataSeries volpersec, which has not been initialized and not be used so far. Just delete it.

Further your indicator will not display correctly for the first bar of each session and the first bar after a technical break, because your way of calculating the bar duration includes the session breaks and technical breaks.

Otherwise your indicator should work as expected.


Just a couple of questions left now: Bertrand used int instead of double. What are your thoughts on that? And how do I make it display correctly for the first bar of each session and for the first bar after a technical break? I don't really understand what I could possibly do here.

best,

Daniel

Reply With Quote
 
  #10 (permalink)
Elite Member
Berlin, Europe
 
Futures Experience: Advanced
Platform: NinjaTrader, MultiCharts
Broker/Data: Interactive Brokers
Favorite Futures: Keyboard
 
Fat Tails's Avatar
 
Posts: 9,653 since Mar 2010
Thanks: 4,226 given, 25,601 received
Forum Reputation: Legendary



buddy858 View Post
Just a couple of questions left now: Bertrand used int instead of double. What are your thoughts on that? And how do I make it display correctly for the first bar of each session and for the first bar after a technical break? I don't really understand what I could possibly do here.

best,

Daniel

int or double:

timer.TotalSeconds returns a double value. There is no need to convert it to int, because you will use it as divisor for Volume[0], which itself contains a double value.

first bar of session:

Check for Bars.FirstBarOfSession with every bar. In case that you have a first bar of the session, you do not calculate timer = Time[0] - Time[1], but timer = Time[0] - sessionBegin. You can find out the sessionBegin via Bars.Session.GetNextBeginEnd(Bars, 0, out sessionBegin, out sessionEnd), where sessionBegin and sessionEnd are DateTime objects.

Reply With Quote
The following 3 users say Thank You to Fat Tails for this post:

Reply



futures io > > > > > Trouble Programming Simple Indicator

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
Programming simple strategy Hermo Elite Automated Trading 1 October 24th, 2012 08:21 PM
NT7 Elite Indicator Trouble. taylor NinjaTrader 10 August 11th, 2011 10:07 PM
Trouble with multiple plots on an indicator eddd NinjaTrader Programming 3 May 31st, 2011 04:45 PM
Indicator programming Mondrakete NinjaTrader Programming 3 April 3rd, 2011 02:02 PM
A Simple Programming Request thenckel NinjaTrader Programming 2 December 2nd, 2010 09:34 AM


All times are GMT -4. The time now is 09:34 AM.

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-14 in 0.14 seconds with 20 queries on phoenix via your IP 54.82.56.95