NexusFi: Find Your Edge


Home Menu

 





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 5,146 views
    2. thumb_up 3 thanks given
    3. group 1 followers
    1. forum 4 posts
    2. attach_file 2 attachments




 
Search this Thread

Creating a Rectangle with an anchor

  #1 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404

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 NexusFi?
My NT8 Volume Profile Split by Asian/Euro/Open
NinjaTrader
ZombieSqueeze
Platforms and Indicators
Request for MACD with option to use different MAs for fa …
NinjaTrader
NexusFi Journal Challenge - April 2024
Feedback and Announcements
 
Best Threads (Most Thanked)
in the last 7 days on NexusFi
Retail Trading As An Industry
58 thanks
Battlestations: Show us your trading desks!
48 thanks
NexusFi site changelog and issues/problem reporting
47 thanks
GFIs1 1 DAX trade per day journal
32 thanks
What percentage per day is possible? [Poll]
31 thanks

  #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,322 since Jun 2009
Thanks Given: 33,143
Thanks Received: 101,476


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

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 Twitter Visit my NexusFi Trade Journal Reply With Quote
  #4 (permalink)
 bukkan 
Calcutta, India
 
Experience: Intermediate
Platform: ArthaChitra
Posts: 278 since Jun 2009
Thanks Given: 161
Thanks Received: 271


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:
  #5 (permalink)
 zeller4 
Orlando Florida
 
Experience: Intermediate
Platform: NT8
Trading: CL, NQ, ES, RTY
Posts: 477 since Jun 2009
Thanks Given: 1,416
Thanks Received: 404

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:	204
Size:	61.5 KB
ID:	9619  
Attached Files
Elite Membership required to download: EMA_hash.cs
Started this thread Reply With Quote
The following user says Thank You to zeller4 for this post:





Last Updated on March 12, 2010


© 2024 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 - Privacy Policy - Downloads - Top
no new posts