Highest or lowest swings - futures io
futures io futures trading



Highest or lowest swings


Discussion in NinjaTrader

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




Welcome to futures io: the largest futures trading community on the planet, with well over 125,000 members
  • Genuine reviews from real traders, not fake reviews from stealth vendors
  • Quality education from leading professional traders
  • We are a friendly, helpful, and positive community
  • We do not tolerate rude behavior, trolling, or vendors advertising in posts
  • We are here to help, just let us know what you need
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

(If you already have an account, login at the top of the page)

 
Search this Thread
 

Highest or lowest swings

(login for full post details)
  #1 (permalink)
Firenze, Italy
 
 
Posts: 4 since Mar 2011
Thanks: 0 given, 0 received

I am trying to write a code that will able to find the lowest of the last X swing lows and the highest of the X swing lows by using the Swing indicator in Ninjatrader.

This is how I did it

MIN(Swing(BarsArray[1], 1).SwingLow, X)[0];

MAX(Swing(BarsArray[1], 1).SwingHigh, X)[0];

For some reason it does seem to be working. My impression is these functions find the highest swing high of the the last X days and not the highest of the last X swing highs (which may be useful too but it is not what I am looking for).

I have been told that I need to use ArrayLists but I have not idea how to go about it; it goes beyond my programming skills and I found nothing on Ninjascript. Can anybody help please?

Reply With Quote

Journal Challenge February 2021 results (so far):
Competing for $1500 in prizes from Topstep
looks_oneSBtrader82 's Trading Journalby SBtrader82
(154 thanks from 29 posts)
looks_twoJust BEING a Trader: Letting Go!!by iqgod
(111 thanks from 32 posts)
looks_3Wisdom is Emptinessby Mtype
(68 thanks from 25 posts)
looks_4Deetee’s DAX Trading Journal (time based)by Deetee
(31 thanks from 16 posts)
looks_5Journal for peanuts1956by peanuts1956
(23 thanks from 13 posts)
 
 
(login for full post details)
  #3 (permalink)
Atkinson, NH USA
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,965 since Dec 2010
Thanks: 3,035 given, 2,377 received



luitom View Post
I am trying to write a code that will able to find the lowest of the last X swing lows and the highest of the X swing lows by using the Swing indicator in Ninjatrader.

This is how I did it

MIN(Swing(BarsArray[1], 1).SwingLow, X)[0];

MAX(Swing(BarsArray[1], 1).SwingHigh, X)[0];

For some reason it does seem to be working. My impression is these functions find the highest swing high of the the last X days and not the highest of the last X swing highs (which may be useful too but it is not what I am looking for).

I have been told that I need to use ArrayLists but I have not idea how to go about it; it goes beyond my programming skills and I found nothing on Ninjascript. Can anybody help please?

Hi,

My quick impression, if the approach is valid (didn't spend the time), is the problem might be the BarsArray[1]. Try BarsArray[0] here to see if it does what you expect. I think you need to have a multi-series strategy/indicator to us [1].

Hope that helps.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #4 (permalink)
Firenze, Italy
 
 
Posts: 4 since Mar 2011
Thanks: 0 given, 0 received

Sorry I did not explain why I have BarsArray[1] in the indicator. The reason is just that I am working on multi time frame and I created a BarsArray of daily bars in Initialize section

Add(PeriodType.Day,1);

That has nothing to do with what I am looking for; the code could easily be

MIN(Swing(1).SwingLow, X)[0];

MAX(Swing(1).SwingHigh, X)[0];


Sorry about the confusion




Reply With Quote
 
(login for full post details)
  #5 (permalink)
Atkinson, NH USA
 
Experience: Intermediate
Platform: NinjaTrader 8/TensorFlow
Broker: NinjaTrader Brokerage
Trading: Futures, CL, ES, ZB
 
NJAMC's Avatar
 
Posts: 1,965 since Dec 2010
Thanks: 3,035 given, 2,377 received

Okay,

I think Swing might have "missing values". I don't know if MIN/MAX ignore these values. YOu might need to scan the array yourself with a for/next loop and ignore missing values.

Nil per os
-NJAMC [Generic Programmer]

LOM WIKI: NT-Local-Order-Manager-LOM-Guide
Artificial Bee Colony Optimization
Visit my futures io Trade Journal Reply With Quote


futures io Trading Community Platforms and Indicators NinjaTrader > Highest or lowest swings


Last Updated on January 27, 2012


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

Journal Challenge w/$1500 prizes from Topstep!

February
 

Identifying Setups & Targets Using Profile Charts w/Trevor & Tradovate

Feb 25
 

Battlestations! Show us your trading desk - $1,500 in prizes!

March
     



Copyright © 2021 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