Creating a Rectangle with an anchor - futures io
futures io futures trading



Creating a Rectangle with an anchor


Discussion in NinjaTrader

Updated
      Top Posters
    1. looks_one zeller4 with 2 posts (1 thanks)
    2. looks_two Big Mike with 1 posts (0 thanks)
    3. looks_3 bukkan with 1 posts (2 thanks)
    4. looks_4 Quick Summary with 1 posts (0 thanks)
    1. trending_up 4,417 views
    2. thumb_up 3 thanks given
    3. group 1 followers
    1. forum 4 posts
    2. attach_file 2 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
 

Creating a Rectangle with an anchor

(login for full post details)
  #1 (permalink)
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received

Hey all,
I'm trying to create a rectangle that shows the current bid/ask while anchoring the current bid low and current ask high for that candle creation.

So far, I have:
 
Code

double maxBidAsk = GetCurrentBid();
maxBidAsk = Math.Max(GetCurrentAsk(),maxBidAsk);
if (GetCurrentAsk() > maxBidAsk) maxBidAsk = GetCurrentAsk();
double minBidAsk = GetCurrentAsk();
minBidAsk = Math.Min(GetCurrentBid(),minBidAsk);
if (GetCurrentBid() < minBidAsk) minBidAsk = GetCurrentBid();
DrawRectangle("RecL"+CurrentBar,1,GetCurrentBid(),0,maxBidAsk,Color.Black,Color.Blue,5);
 

I also tried

 
Code
DrawRectangle("RecL"+CurrentBar,1,minBidAsk,0,maxBidAsk,Color.Black,Color.Blue,5);
 
So far, I only get the small rectangle moving up an down with the CurrentBid or CurrentAsk.

I appreciate your help.
Kirk

Started this thread Reply With Quote

Can you help answer these questions
from other members on futures io?
What blockvolume is visible? - order processing
NinjaTrader
Indicators for pair trading MES and M2K
Platforms and Indicators
Short Interest Ratio indicator?
ThinkOrSwim
COTbase for quant trading?
Elite Algorithmic NinjaTrader Trading
Help Needed: TOS Options Chain IV & IMPL MOVE Calcul …
ThinkOrSwim
 
Best Threads (Most Thanked)
in the last 7 days on futures io
Battlestations: Show us your trading desks!
137 thanks
Big Mike in Ecuador
34 thanks
Want your NinjaTrader indicator created, free?
32 thanks
Saturday Morning Market Replay!
20 thanks
Selling Options on Futures?
19 thanks
 
(login for full post details)
  #3 (permalink)
Site Administrator
Swing Trader
Data Scientist & DevOps
Manta, Ecuador
 
Experience: Advanced
Platform: My own custom solution
Trading: Emini Futures
 
Big Mike's Avatar
 
Posts: 49,790 since Jun 2009
Thanks: 32,314 given, 97,610 received


If you are still having this problem, can you post a screen shot?

Mike

We're here to help -- just ask

For the best trading education, watch our webinars
Searching for trading reviews? Review this list

Follow us on Twitter, YouTube, and Facebook

Support our community as an Elite Member:
https://futures.io/elite/
Follow me on Twitter Visit my futures io Trade Journal Reply With Quote
 
(login for full post details)
  #4 (permalink)
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
 
Posts: 278 since Jun 2009
Thanks: 161 given, 269 received


zeller4 View Post
Hey all,
I'm trying to create a rectangle that shows the current bid/ask while anchoring the current bid low and current ask high for that candle creation.

So far, I have:
 
Code

double maxBidAsk = GetCurrentBid();
maxBidAsk = Math.Max(GetCurrentAsk(),maxBidAsk);
if (GetCurrentAsk() > maxBidAsk) maxBidAsk = GetCurrentAsk();
double minBidAsk = GetCurrentAsk();
minBidAsk = Math.Min(GetCurrentBid(),minBidAsk);
if (GetCurrentBid() < minBidAsk) minBidAsk = GetCurrentBid();
DrawRectangle("RecL"+CurrentBar,1,GetCurrentBid(),0,maxBidAsk,Color.Black,Color.Blue,5);
 
I also tried

 
Code
DrawRectangle("RecL"+CurrentBar,1,minBidAsk,0,maxBidAsk,Color.Black,Color.Blue,5);
 
So far, I only get the small rectangle moving up an down with the CurrentBid or CurrentAsk.

I appreciate your help.
Kirk


not sure exactly what your requirements are as it is not clear, but place the maxmin bid/ask declaration in the variable. you are resetting the values everytime making them of little use for the Math.Max Math.Min functins.


 
Code
#region variables
double maxbidask = 0;
double minbidask = double.MaxValue;
end region

onbarupdate

 
Code
maxbidask = Math.Max(maxbidask,GetCurrentAsk());
minbidask = Math.Min(minbidask,GetCurrentBid());

base.DrawRectangle("tag",false,1,maxbidask,0,minbidask,Color.Transparent,Color.Blue,3);

Reply With Quote
The following 2 users say Thank You to bukkan for this post:
 
(login for full post details)
  #5 (permalink)
Florida
 
Experience: Intermediate
Platform: NT7
Trading: CL, NQ, NG
 
Posts: 469 since Jun 2009
Thanks: 1,401 given, 402 received

Well,

Here's the latest - not quite working so I'm not sure what to add to make this show the current bar's highest Ask and lowestBid.

any thoughts?

Kirk

Attached Thumbnails
Click image for larger version

Name:	6E 06-10  3_11_2010 (150 Tick).jpg
Views:	139
Size:	61.5 KB
ID:	9619  
Attached Files
Register to download File Type: cs EMA_hash.cs (9.3 KB, 29 views)
Started this thread Reply With Quote
The following user says Thank You to zeller4 for this post:


futures io Trading Community Platforms and Indicators NinjaTrader > Creating a Rectangle with an anchor


Last Updated on March 12, 2010


Upcoming Webinars and Events
 

NinjaTrader Indicator Challenge!

Ongoing
 

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

March
 

Importance of Finding Your Own Way w/Adam Grimes

Elite only
 

Journal Challenge w/Jigsaw

April
     



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