NexusFi: Find Your Edge


Home Menu

 





DrawRegion with Swing indicator


Discussion in NinjaTrader

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




 
Search this Thread
  #1 (permalink)
 Azzzz 
Ontario
 
Experience: Intermediate
Platform: Ninja
Broker: Amp Futures/Zen-Fire
Trading: ES, currancy
Posts: 24 since Nov 2009
Thanks Given: 12
Thanks Received: 6

Put any two "Swing" indicators on a chart...

Swing(10) & Swing(50)

and you get boxes forming above and below price. The code below fills in the boxes ABOVE price...

DrawRegion("swingAbove", CurrentBar, 0,
Swing(10),
Swing(50),
Color.Empty, Color.Lime, 2);

but I can not figure out the code to fill in the boxes BELOW price...

Thanks

Allan


Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Iran War Prediction Markets: Ceasefire 16%, Ground Invas …
Prediction Markets & Event Contracts
OneChronos Launches First Combinatorial Auction FX Venue …
Currencies
GDP Day: The First Economic Reckoning -- Pahlavi at 6.55 …
Prediction Markets & Event Contracts
Trump Truth Social Fires Hormuz From 10% to 59% -- Arsen …
Prediction Markets & Event Contracts
SEC Advisory Committee Backs Tokenized Securities Exempt …
Traders Hideout
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Sober Journey With S&P
24 thanks
2026 Jlab journal
10 thanks
Trying to learn Volume and price action correlation
7 thanks
Algo automated / semi-automated trading anyone?
6 thanks
Lady Vols Primer: Trading Volatility Journal
6 thanks
  #2 (permalink)
 
Fat Tails's Avatar
 Fat Tails 
Berlin, Europe
Market Wizard
 
Experience: Advanced
Platform: NinjaTrader
Broker: Interactive Brokers
Trading: Futures & Stocks
Posts: 9,887 since Mar 2010
Thanks Given: 4,242
Thanks Received: 27,114


Azzzz View Post
Put any two "Swing" indicators on a chart...

Swing(10) & Swing(50)

and you get boxes forming above and below price. The code below fills in the boxes ABOVE price...

DrawRegion("swingAbove", CurrentBar, 0,
Swing(10),
Swing(50),
Color.Empty, Color.Lime, 2);

but I can not figure out the code to fill in the boxes BELOW price...

Thanks

Allan


The Swing indicator has two plot series. The way you wrote your code, you address the first plot series for Swing(10) and Swing(50), as you did not specify it. Instead of Swing(10) and Swing(50) use

-> Swing(10).SwingHigh and Swing(50).SwingHigh to color the region between the upper two plot series
-> Swing(10).SwingLow and Swing(50).SwingLow to color the region between the lower two plot series

To find out, which of the data series you want to address, you need to have a look at the public DataSeries objects defined in the Properties section of the Swing indicator.

This is the code you can use:

 
Code
DrawRegion("swingsAbove", CurrentBar,0, Swing(fastPeriod).SwingHigh, Swing(slowPeriod).SwingHigh, Color.Empty, Color.Lime, 5);
DrawRegion("swingsBelow", CurrentBar,0, Swing(fastPeriod).SwingLow, Swing(slowPeriod).SwingLow, Color.Empty, Color.Red, 5);


Reply With Quote
Thanked by:
  #3 (permalink)
 
Big Mike's Avatar
 Big Mike 
Manta, Ecuador
Site Administrator
Developer
Swing Trader
 
Experience: Advanced
Platform: Custom solution
Broker: IBKR
Trading: Stocks & Futures
Frequency: Every few days
Duration: Weeks
Posts: 50,669 since Jun 2009
Thanks Given: 33,669
Thanks Received: 102,557


 
Thread Moved


Moved to NinjaTrader Programming



When creating a new thread, note which subforum you are in. Here is a short list of suggestions:

- Topic: Anything to do with an Elite indicator -> Subforum: The Elite Circle
- Topic: Looking for an existing indicator, or how-to use an indicator -> Subforum: (the platform)
- Topic: Programmer needing help with non-Elite indicator -> Subforum: (the platform) - Programming
- Topic: Want an indicator created/modified -> Reply to "Want indicator created free" in Elite Circle
- Topic: Vendors (trading rooms, commercial indicators) -> Subforum: Vendors/Product Reviews
- Topic: Discussion of Forex or Currency trading -> Subforum: Forex and Currency Trading
- Topic: Journals of your trading -> Subforum: Trading Journals or Elite Trading Journals
- Topic: General trading related discussions -> Subforum: Traders Hideout
- Topic: Discussion of a trading method -> Subforum: Traders Hideout
- Topic: Automated Trading -> Subforum: Elite Automated Trading

Last, any Elite Member may create more or less any of these topics in The Elite Circle at your own discretion (your support is appreciated).

This is just a short general list and doesn't cover everything. If you are unsure where to create your new thread, just create it in Traders Hideout and a moderator will move it if necessary.

-- Big Mike Trading



Mike




We're here to help: just ask the community or contact our Help Desk

Quick Links: Change your Username or Register as a Vendor
Searching for trading reviews? Review this list
Lifetime Elite Membership: Sign-up for only $149 USD
Exclusive money saving offers from our Site Sponsors: Browse Offers
Report problems with the site: Using the NexusFi changelog thread
Follow me on X Visit my NexusFi Trade Journal Reply With Quote




Last Updated on June 7, 2011


© 2026 NexusFi®, s.a., All Rights Reserved.
Av Ricardo J. Alfaro, Century Tower, Panama City, Panama, Ph: +507 833-9432 (Panama and Intl), +1 888-312-3001 (USA and Canada)
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.
About Us - Contact Us - Site Rules, Acceptable Use, and Terms and Conditions - Downloads - Top
no new posts