NexusFi: Find Your Edge


Home Menu

 





Accessing Rectangle Bounds within a strategy


Discussion in NinjaTrader

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




 
Search this Thread

Accessing Rectangle Bounds within a strategy

  #1 (permalink)
 
Xav1029's Avatar
 Xav1029 
Tampa, FL
 
Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker: Mirus Futures/Zen-Fire
Trading: 6E, M6E, 6J
Posts: 1,375 since Dec 2011
Thanks Given: 1,452
Thanks Received: 3,377

Got a couple minutes after lunch, so I'll post this question here:

How can I access the chart rectangle bounds from within a strategy? I have fixed text drawn negative bars ago, but it is not visible if you set the margin to 100, only if you scroll. In an indicator, I could easily override the Plot(), but not so much in a strategy.

Edit: I would also need to know how to duplicate the Plot() method ie how to change the position of the string I draw, but delete the previously drawn string.
Thanks in advance

London Calling
Visit my NexusFi Trade Journal Started this thread Reply With Quote

Can you help answer these questions
from other members on NexusFi?
Trade idea based off three indicators.
Traders Hideout
What broker to use for trading palladium futures
Commodities
Cheap historycal L1 data for stocks
Stocks and ETFs
Quant vue
Trading Reviews and Vendors
Pivot Indicator like the old SwingTemp by Big Mike
NinjaTrader
 
  #3 (permalink)
 
vvhg's Avatar
 vvhg 
Northern Germany
 
Experience: Intermediate
Platform: NT
Trading: FDAX, CL
Posts: 1,583 since Mar 2011
Thanks Given: 1,016
Thanks Received: 2,824



Xav1029 View Post
Got a couple minutes after lunch, so I'll post this question here:

How can I access the chart rectangle bounds from within a strategy? I have fixed text drawn negative bars ago, but it is not visible if you set the margin to 100, only if you scroll. In an indicator, I could easily override the Plot(), but not so much in a strategy.

Edit: I would also need to know how to duplicate the Plot() method ie how to change the position of the string I draw, but delete the previously drawn string.
Thanks in advance

Is ChartControl not accessible in a strategy? I'm really not very knowledgeable when it comes to strategies.
If things get complicated inside the strategy, why not instantiate an indicator and call its methods from within the strategy? Cross communication should be no problem at all...

Edit: I'd try this.FindForm().ChartControl
And if you can't override the Plot() method there might still be an eventhandler OnPlot or so...just an idea
Vvhg

Hic Rhodos, hic salta.
Reply With Quote
Thanked by:
  #4 (permalink)
 
Xav1029's Avatar
 Xav1029 
Tampa, FL
 
Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker: Mirus Futures/Zen-Fire
Trading: 6E, M6E, 6J
Posts: 1,375 since Dec 2011
Thanks Given: 1,452
Thanks Received: 3,377


vvhg View Post
Is ChartControl not accessible in a strateg?, I'm really not very knowledgeable when it comes to strategies.
If things get complicated inside the strategy, why not instantiate an indicator and call its methods from within the strategy? Cross communication should be no problem at all...

Vvhg

@vvhg ChartControl is, but Plot() is not. I need to plot labels for lines (working on my advanced ATM system still ), which is simple overriding the Plot() in indicators, but not in strategies. Right now I have it set up using DrawText, but I am kinda picky and hate the fact that I have to manually scroll my chart to see the text drawn "in the future". I want the label to be visible no matter where I am on the chart. Simple enough overriding Plot() in an indy, but without that tool I am stuck in a strategy with DrawText.

London Calling
Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #5 (permalink)
 
vvhg's Avatar
 vvhg 
Northern Germany
 
Experience: Intermediate
Platform: NT
Trading: FDAX, CL
Posts: 1,583 since Mar 2011
Thanks Given: 1,016
Thanks Received: 2,824


Xav1029 View Post
@vvhg ChartControl is, but Plot() is not. I need to plot labels for lines (working on my advanced ATM system still ), which is simple overriding the Plot() in indicators, but not in strategies. Right now I have it set up using DrawText, but I am kinda picky and hate the fact that I have to manually scroll my chart to see the text drawn "in the future". I want the label to be visible no matter where I am on the chart. Simple enough overriding Plot() in an indy, but without that tool I am stuck in a strategy with DrawText.

In that case it might be easiest to call an indicator doing the plot stuff. Either instantiate it or just call individual methods (maybe with the help of an eventhandler?)

If you instantiate the indicator with a pointer to the strategy ("this", as I have done with the vvfutures.io (formerly BMT)AutoPost) you can access all public variables from within the indicator.


Vvhg

Hic Rhodos, hic salta.
Reply With Quote
  #6 (permalink)
 
Xav1029's Avatar
 Xav1029 
Tampa, FL
 
Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker: Mirus Futures/Zen-Fire
Trading: 6E, M6E, 6J
Posts: 1,375 since Dec 2011
Thanks Given: 1,452
Thanks Received: 3,377


vvhg View Post
In that case it might be easiest to call an indicator doing the plot stuff. Either instantiate it or just call individual methods (maybe with the help of an eventhandler?)


Vvhg

@vvhg How do I instantiate a dummy indicator so I can override Plot(), and then how would I access Plot()? I will be plotting on price panel if that helps. I've instantiated indicator before, but the Plot() event doesn't get triggered, so I'm kind of lost on what to do.

London Calling
Visit my NexusFi Trade Journal Started this thread Reply With Quote
  #7 (permalink)
 
vvhg's Avatar
 vvhg 
Northern Germany
 
Experience: Intermediate
Platform: NT
Trading: FDAX, CL
Posts: 1,583 since Mar 2011
Thanks Given: 1,016
Thanks Received: 2,824


Xav1029 View Post
@vvhg How do I instantiate a dummy indicator so I can override Plot(), and then how would I access Plot()? I will be plotting on price panel if that helps. I've instantiated indicator before, but the Plot() event doesn't get triggered, so I'm kind of lost on what to do.

I'm not at my computer, so all from the top of my head and partially untested...

Not entirely sure how to instantiate, but I think you would have to use the Add() method in either initialize or onstartup, helpfile should clarify that. Then Plot() should get called just fine. If that works you could access all relevant variables from within indicator Plot() via public strategy variables and forwarding a pointer to the strategy, in that case as a parameter I should think...

Vvhg

Hic Rhodos, hic salta.
Reply With Quote
Thanked by:
  #8 (permalink)
 
Xav1029's Avatar
 Xav1029 
Tampa, FL
 
Experience: Beginner
Platform: NinjaTrader, Sierra Chart
Broker: Mirus Futures/Zen-Fire
Trading: 6E, M6E, 6J
Posts: 1,375 since Dec 2011
Thanks Given: 1,452
Thanks Received: 3,377


vvhg View Post
I'm not at my computer, so all from the top of my head and partially untested...

Not entirely sure how to instantiate, but I think you would have to use the Add() method in either initialize or onstartup, helpfile should clarify that. Then Plot() should get called just fine. If that works you could access all relevant variables from within indicator Plot() via public strategy variables and forwarding a pointer to the strategy, in that case as a parameter I should think...

Vvhg

Thanks buddy I think you are right. Found this on the NT forums, and looks like all you have to do is Add() in Initialize().

Strategy: Plotting from within a NinjaScript Strategy - [AUTOLINK]NinjaTrader[/AUTOLINK] Support Forum

London Calling
Visit my NexusFi Trade Journal Started this thread Reply With Quote
Thanked by:




Last Updated on January 18, 2013


© 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