how to extract nearest support price from arraylist? - NinjaTrader Programming | futures io social day trading
futures io futures trading


how to extract nearest support price from arraylist?
Updated: Views / Replies:3,041 / 15
Created: by zacharydw00 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
 1  
 
Thread Tools Search this Thread
 

how to extract nearest support price from arraylist?

  #1 (permalink)
Elite Member
Idaho
 
Futures Experience: Intermediate
Platform: NinjaTrader,ToS
Broker/Data: Amp Futures, ToS
Favorite Futures: ES, E7, CL, GC
 
zacharydw00's Avatar
 
Posts: 139 since Aug 2009
Thanks: 81 given, 164 received

how to extract nearest support price from arraylist?

Does anyone have code that can do this, or something similar?

I have the prices of support/resistance (S/R) lines stored in an ArrayList. When price is moving up, I want to find the nearest S/R line, in said ArrayList, that is currently below the Close price, once price gets 1 point above the nearest S/R line. And, the opposite when price is moving down.
See attached image for illustration.
Thanks guys.

Attached Thumbnails
how to extract nearest support price from arraylist?-how-find-nearest-sr-price-array.jpg  

Last edited by zacharydw00; September 28th, 2010 at 02:22 AM.
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
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received

Swing Gap?



zacharydw00 View Post
Does anyone have code that can do this, or something similar?

I have the prices of support/resistance (S/R) lines stored in an ArrayList. When price is moving up, I want to find the nearest S/R line that is currently below the Close price, and the opposite when price is moving down.
See attached image for illustration.
Thanks guys.

Not exactly what you asked, and it _might_ do if you dont have a resolution : Swing Gap Links and Downloads Manager - NinjaTrader Support Forum

use the MostRecentOccurance ... I might have other thoughts after a nites sleep

TJ

Reply With Quote
 
  #4 (permalink)
Elite Member
Idaho
 
Futures Experience: Intermediate
Platform: NinjaTrader,ToS
Broker/Data: Amp Futures, ToS
Favorite Futures: ES, E7, CL, GC
 
zacharydw00's Avatar
 
Posts: 139 since Aug 2009
Thanks: 81 given, 164 received


Trader.Jon View Post
Not exactly what you asked, and it _might_ do if you dont have a resolution : Swing Gap Links and Downloads Manager - NinjaTrader Support Forum
use the MostRecentOccurance ... I might have other thoughts after a nites sleep TJ

That's funny... sending me a link to my own modified code. LOL
The Swing ind. only stores the most recent occurance. I have an ArrayList, which may have up to 15 stored prices, that I need to look through.

Reply With Quote
 
  #5 (permalink)
Market Wizard
virginia
 
Futures Experience: Intermediate
Platform: ninja
Favorite Futures: ES
 
cory's Avatar
 
Posts: 5,220 since Jun 2009
Thanks: 628 given, 6,318 received
Forum Reputation: Legendary

loop thru your array, for support look for smallest negative price - s/r value, for resis look for smallest positive price - s/r value.

Reply With Quote
 
  #6 (permalink)
Elite Member
Idaho
 
Futures Experience: Intermediate
Platform: NinjaTrader,ToS
Broker/Data: Amp Futures, ToS
Favorite Futures: ES, E7, CL, GC
 
zacharydw00's Avatar
 
Posts: 139 since Aug 2009
Thanks: 81 given, 164 received

Thanks cory. I get the concept. The details are another thing.

Any code givers... any one... any one... Bueller.... any body

Reply With Quote
 
  #7 (permalink)
Elite Member
Near the BEuTiFULL Horse Shoe
 
Futures Experience: Beginner
Platform: NinjaTrader
Broker/Data: MBTrading Dukascopy ZenFire
Favorite Futures: $EURUSD when it is trending
 
Trader.Jon's Avatar
 
Posts: 500 since Jul 2009
Thanks: 401 given, 176 received


zacharydw00 View Post
That's funny... sending me a link to my own modified code. LOL
The Swing ind. only stores the most recent occurance. I have an ArrayList, which may have up to 15 stored prices, that I need to look through.

MostRecentOccurence (MRO(SwingGap)[0]) ...MRO(SwingGap)[15] gets those values, me thinks

Reply With Quote
 
  #8 (permalink)
Elite Member
North Carolina
 
Futures Experience: Beginner
Platform: Ninja Trader
Broker/Data: Ninja Trader Broker / Continuum
Favorite Futures: ES
 
Posts: 57 since Jun 2009
Thanks: 4 given, 56 received

In variables section declare a list object...they are more efficient than arrays and do not need to be initialized with a size. Or just use arrays, no matter. Methods are the same.

List<double>listSR = new List<double>();
privatedouble SRNextHigh = 0;
privatedouble SRNextLow = 0;


 
Code
protected void FindNextSR()
{
 
listSR.Sort();
for (int x = 0; x < listSR.Count; x++)
{
if (listSR[x] > Close[0])
{
SRNextHigh = listSR[x];
if (x != 0) SRNextLow = listSR[x - 1];
Print(SRNextHigh + " High   Close=" + Close[0] + "   Low " + SRNextLow);
break;
}
if (listSR[x] > Close[0]) SRNextLow = 0;
if (listSR[x] < Close[0]) SRNextHigh = 0;
}
}
This routine will go thru the list object and put the next supprt (SRNextLow) below the Close of the current bar, and the next resistance (SRNextHigh) above the current close

if there are no support values above, it sets SRNextHigh to 0
if there are no support values below, it sets SRNextLow to 0

items may be added to the List object using .add method

Hope this helps

PS. dont forget to add a ref to
using System.Collections.Generic;

Laserdan

Last edited by Laserdan; September 29th, 2010 at 12:36 AM. Reason: typos
Reply With Quote
The following user says Thank You to Laserdan for this post:
 
  #9 (permalink)
Elite Member
Calcutta, India
 
Futures Experience: Intermediate
Platform: ArthaChitra
 
Posts: 278 since Jun 2009
Thanks: 161 given, 259 received

most recent occurrence. wouldnt that be the last value of the List.

like

 
Code
 List<double>listSR = new List<double>();



 
Code
double SR = listSR[listSR.Count - 1];


Reply With Quote
 
  #10 (permalink)
Elite Member
North Carolina
 
Futures Experience: Beginner
Platform: Ninja Trader
Broker/Data: Ninja Trader Broker / Continuum
Favorite Futures: ES
 
Posts: 57 since Jun 2009
Thanks: 4 given, 56 received


This way you don't need to worry about which way price is moving. The current bar close is always sandwiched between the two SR lines (one above and one below).


Laserdan View Post
In variables section declare a list object...they are more efficient than arrays and do not need to be initialized with a size. Or just use arrays, no matter. Methods are the same.

List<double>listSR = new List<double>();
privatedouble SRNextHigh = 0;
privatedouble SRNextLow = 0;


 
Code
protected void FindNextSR()
{
 
listSR.Sort();
for (int x = 0; x < listSR.Count; x++)
{
if (listSR[x] > Close[0])
{
SRNextHigh = listSR[x];
if (x != 0) SRNextLow = listSR[x - 1];
Print(SRNextHigh + " High   Close=" + Close[0] + "   Low " + SRNextLow);
break;
}
if (listSR[x] > Close[0]) SRNextLow = 0;
if (listSR[x] < Close[0]) SRNextHigh = 0;
}
}
This routine will go thru the list object and put the next supprt (SRNextLow) below the Close of the current bar, and the next resistance (SRNextHigh) above the current close

if there are no support values above, it sets SRNextHigh to 0
if there are no support values below, it sets SRNextLow to 0

items may be added to the List object using .add method

Hope this helps

PS. dont forget to add a ref to
using System.Collections.Generic;


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

Reply



futures io > > > > > how to extract nearest support price from arraylist?

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
Alert as price crosses resistance and support... Houston Jr NinjaTrader Programming 7 July 23rd, 2011 01:07 PM
Settlement Price vs. Closing Price srgtroy The Elite Circle 3 June 26th, 2011 02:15 AM
I'm trying to print the values from an ArrayList kaywai NinjaTrader Programming 13 May 13th, 2011 10:33 AM
What's better, Price alone, or Price + Volume Profiling? josh Traders Hideout 14 March 11th, 2011 10:51 PM
Keepin' It Simple: Support and Resistance, Volume, Price Action pmccandless Traders Hideout 11 April 16th, 2010 08:05 PM


All times are GMT -4. The time now is 05:13 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-18 in 0.16 seconds with 20 queries on phoenix via your IP 23.22.136.56