Little coding help needed - NinjaTrader | futures io social day trading
futures io futures trading


Little coding help needed
Updated: Views / Replies:698 / 8
Created: by Abde 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
 

Little coding help needed

  #1 (permalink)
Elite Member
Germany
 
Futures Experience: Intermediate
Platform: FlatTrader
Broker/Data: GFT and Interactive Brokers
Favorite Futures: ES, DAX
 
Posts: 531 since Aug 2010
Thanks: 2,121 given, 719 received

Little coding help needed

Iīm trying to define the bar open and close as precondition in an code snippet.
If the bar open and close is located in the upper/lower third of the bar range, than do something.

if(Open[0] && Close[0] >= (High[0] + Low[0])/1.5 && (VOL()[0]>VOL()[1]))

The "if(Open[0] && Close[0]" is the part that didnīt work. Iīve searched the NT help guide and www, but couldnīt find anything helpful.

Has anyone an idea how I can set the open and close as a precondition?

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

Answer
This post has been selected as an answer to the original posters question Answer


Abde View Post
Iīm trying to define the bar open and close as precondition in an code snippet.
If the bar open and close is located in the upper/lower third of the bar range, than do something.

if(Open[0] && Close[0] >= (High[0] + Low[0])/1.5 && (VOL()[0]>VOL()[1]))

The "if(Open[0] && Close[0]" is the part that didnīt work. Iīve searched the NT help guide and www, but couldnīt find anything helpful.

Has anyone an idea how I can set the open and close as a precondition?


- open and close located in the upper third
- meaning: reversal bar up with a lower shadow that exceeds 2/3 of the bar range
 
Code
if( Math.Min (Open[0], Close[0])  >   (2*High[0] + Low[0])/3.0)


- open and close located in the lower third
- meaning: reversal bar down with an upper shadow that exceeds 2/3 of the bar range
 
Code
if( Math.Max (Open[0], Close[0])  <   (High[0] + 2*Low[0])/3.0)

Reply With Quote
The following 4 users say Thank You to Fat Tails for this post:
 
  #3 (permalink)
Elite Member
Cedar Rapids, iowa
 
Futures Experience: Intermediate
Platform: Ninjatrader
Broker/Data: Ninjatrader - Continuum
Favorite Futures: 6E, TF, 6J
 
Tasker_182's Avatar
 
Posts: 626 since Aug 2009
Thanks: 426 given, 1,126 received

Answer
This post has been selected as an answer to the original posters question Answer



Abde View Post
Iīm trying to define the bar open and close as precondition in an code snippet.
If the bar open and close is located in the upper/lower third of the bar range, than do something.

if(Open[0] && Close[0] >= (High[0] + Low[0])/1.5 && (VOL()[0]>VOL()[1]))

The "if(Open[0] && Close[0]" is the part that didnīt work. Iīve searched the NT help guide and www, but couldnīt find anything helpful.

Has anyone an idea how I can set the open and close as a precondition?

Hi Adbe,

Just for clarity, the if statement is looking for a logical true/false in which to move. Each side of && has to resolve to True or false To work. The statement part Open[0] doesn't have any T/F evaluation as written. , here is what it would need to look like:

if((Open[0] >= (High[0] + Low[0])/1.5 && (VOL()[0]>VOL()[1]))) && (Close[0] >= (High[0] + Low[0])/1.5 && (VOL()[0]>VOL()[1])))

@FatTails of course offers a superior method.

"Money is better than poverty, if only for financial reasons." - Woody Allen
Reply With Quote
The following 3 users say Thank You to Tasker_182 for this post:
 
  #4 (permalink)
Market Wizard
Columbus, OH
 
Futures Experience: None
Platform: NT 8, TOS
Favorite Futures: ES
 
Silvester17's Avatar
 
Posts: 3,332 since Aug 2009
Thanks: 4,579 given, 10,313 received

Answer
This post has been selected as an answer to the original posters question Answer


Abde View Post
Iīm trying to define the bar open and close as precondition in an code snippet.
If the bar open and close is located in the upper/lower third of the bar range, than do something.

if(Open[0] && Close[0] >= (High[0] + Low[0])/1.5 && (VOL()[0]>VOL()[1]))

The "if(Open[0] && Close[0]" is the part that didnīt work. Iīve searched the NT help guide and www, but couldnīt find anything helpful.

Has anyone an idea how I can set the open and close as a precondition?

@Abde,

here's an indicator that does something similar

edit: this is an old indicator I found here. don't know who made it. but I definitely would use @Fat Tails logic

Attached Files
Register to download File Type: cs ReversalBars.cs (12.1 KB, 32 views)

Last edited by Silvester17; April 10th, 2014 at 10:16 AM.
Reply With Quote
The following 5 users say Thank You to Silvester17 for this post:
 
  #5 (permalink)
Elite Member
Germany
 
Futures Experience: Intermediate
Platform: FlatTrader
Broker/Data: GFT and Interactive Brokers
Favorite Futures: ES, DAX
 
Posts: 531 since Aug 2010
Thanks: 2,121 given, 719 received


Fat Tails View Post
- open and close located in the upper third
- meaning: reversal bar up with a lower shadow that exceeds 2/3 of the bar range
 
Code
if( Math.Min (Open[0], Close[0])  >   (2*High[0] + Low[0])/3.0)


- open and close located in the lower third
- meaning: reversal bar down with an upper shadow that exceeds 2/3 of the bar range
 
Code
if( Math.Max (Open[0], Close[0])  <   (High[0] + 2*Low[0])/3.0)

A big thank you @Fat Tails for the kind help!

It works perfect and is by the way, a very elegant solution.

Reply With Quote
 
  #6 (permalink)
Elite Member
Germany
 
Futures Experience: Intermediate
Platform: FlatTrader
Broker/Data: GFT and Interactive Brokers
Favorite Futures: ES, DAX
 
Posts: 531 since Aug 2010
Thanks: 2,121 given, 719 received


Tasker_182 View Post
Hi Adbe,

Just for clarity, the if statement is looking for a logical true/false in which to move. Each side of && has to resolve to True or false To work. The statement part Open[0] doesn't have any T/F evaluation as written. , here is what it would need to look like:

if((Open[0] >= (High[0] + Low[0])/1.5 && (VOL()[0]>VOL()[1]))) && (Close[0] >= (High[0] + Low[0])/1.5 && (VOL()[0]>VOL()[1])))

@FatTails of course offers a superior method.

Hi @Tasker_182,

Thanks for tying to help. Have tested your provided code, but unfortunately it didnīt work (Compile).

Maybe I did something wrong, here is the code how I used it:

 
Code
                            
if((Open[0] >= (High[0] + Low[0])/1.5 && (VOL()[0]<VOL()[1]))) && (Close[0] >= (High[0] + Low[0])/1.5 && (VOL()[0]<VOL()[1]))); 


Reply With Quote
 
  #7 (permalink)
Elite Member
Cedar Rapids, iowa
 
Futures Experience: Intermediate
Platform: Ninjatrader
Broker/Data: Ninjatrader - Continuum
Favorite Futures: 6E, TF, 6J
 
Tasker_182's Avatar
 
Posts: 626 since Aug 2009
Thanks: 426 given, 1,126 received


Abde View Post
Hi @Tasker_182,

Thanks for tying to help. Have tested your provided code, but unfortunately it didnīt work (Compile).

Maybe I did something wrong, here is the code how I used it:

 
Code
                            
if((Open[0] >= (High[0] + Low[0])/1.5 && (VOL()[0]<VOL()[1]))) && (Close[0] >= (High[0] + Low[0])/1.5 && (VOL()[0]<VOL()[1]))); 


Hi Abde,

I wasn't trying to write your correct code, i was trying to help you understand that having Open[0] by itself was not a condition of true of false and that the correct way to write the condition based on your code was what i was showing. Sorry I should have been more clear.

"Money is better than poverty, if only for financial reasons." - Woody Allen
Reply With Quote
The following user says Thank You to Tasker_182 for this post:
 
  #8 (permalink)
Elite Member
Germany
 
Futures Experience: Intermediate
Platform: FlatTrader
Broker/Data: GFT and Interactive Brokers
Favorite Futures: ES, DAX
 
Posts: 531 since Aug 2010
Thanks: 2,121 given, 719 received


Silvester17 View Post
@Abde,

here's an indicator that does something similar

edit: this is an old indicator I found here. don't know who made it. but I definitely would use @Fat Tails logic

Thanks @Silvester17 for posting the ReversalBars, which I didnīt had before.

Itīs a interesting one because of the selectable wick percent feature. But of course, I will use Fat Tails code for my purpose.

Reply With Quote
The following user says Thank You to Abde for this post:
 
  #9 (permalink)
Elite Member
Germany
 
Futures Experience: Intermediate
Platform: FlatTrader
Broker/Data: GFT and Interactive Brokers
Favorite Futures: ES, DAX
 
Posts: 531 since Aug 2010
Thanks: 2,121 given, 719 received


Tasker_182 View Post
Hi Abde,

I wasn't trying to write your correct code, i was trying to help you understand that having Open[0] by itself was not a condition of true of false and that the correct way to write the condition based on your code was what i was showing. Sorry I should have been more clear.

@Tasker_182,

Ok have understood. Will have a closer look to study it and try to make it work for learning purposes.

Reply With Quote
The following user says Thank You to Abde for this post:

Reply



futures io > > > > Little coding help needed

Thread Tools Search this Thread
Search this Thread:

Advanced Search



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

Linda Bradford Raschke: Reading The Tape

Elite only

Adam Grimes: TBA

Elite only

NinjaTrader: TBA

January

Ran Aroussi: TBA

Elite only
     

Similar Threads
Thread Thread Starter Forum Replies Last Post
Coding help Pitrader EasyLanguage Programming 5 January 30th, 2014 10:12 AM
Question about coding bdd069 Elite Automated NinjaTrader Trading 10 January 20th, 2012 04:05 PM
Strategy Coding - help needed - ORB & Trailing conditions RodS The Elite Circle 24 December 8th, 2010 09:30 AM
Stochastics coding help needed! RodS NinjaTrader Programming 33 October 24th, 2009 06:58 PM
Tradestation Coding Blz17 EasyLanguage Programming 1 September 17th, 2009 02:51 PM


All times are GMT -4. The time now is 08:43 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-10 in 0.14 seconds with 38 queries on phoenix via your IP 54.83.122.227