Welcome to NexusFi: the best trading community on the planet, with over 150,000 members Sign Up Now for Free
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 for basic access, or support us by becoming an Elite Member -- see if you qualify for a discount below.
-- Big Mike, Site Administrator
(If you already have an account, login at the top of the page)
I am working on an order entry strategy that Draws Line in the override void Plot method. I am a beginner programmer and have figured out how to DrawLines under this method but need help with a few loose ends. I am drawing custom entry, stop loss and take profit line that are being updated tick by tick in OnBarUpdate. If I manually close the trade I am trying to figure out how I can remove the draw object created in this method. Here is where I am stuck:
1. How can I add a string tag so when I use graphics.DrawLine I can identify the lines based on a specific entry order.
2. If I close the trade out how can I remove or clear the DrawLine's based on this string tag.
With Ninja theres the RemoveDrawObject but since I am overriding the method I'm not sure how to achieve removing a specific "tagged" DrawLine.
Do I create a custom method to do this or create an additional overload for DrawLine method so I can add in string tag as a reference.
Then how do I clear or dispose the specific line.
I need to be able to do this with the following draws within Graphics(IE add a specific string tag and be able to clear/dispose/erase)
1. graphics.DrawLine
2. graphics.FillRectangle
3. graphics.DrawString
Thanks for any help that can be provided.
Can you help answer these questions from other members on NexusFi?
The direct graphics methods are used whenever Plot is called to redraw the whole area, so you don't so much remove anything as just not draw it. Just trigger a ChartControl.Refresh() if it's really needed (shouldn't be, normally this will happen whenever the price needs updating on-screen anyway so is usually only needed for more special cases like user region moves or bitmap redirection).
See the standard Ninja VolumeProfiles indicator for example.
Do you know if you can call C# Graphics within a strategy. I know in an indicator you can override the Plot method. What if you wanted to use NT drawing method somethimes and custom C# drawings other times. I am trying to draw a custom line in a strategy with the below. It complies but does not draw anything. Can you point me in the right direction with what I am doing wrong.
Can't override the Plot method in a strategy as far as my test shows, and that's where you would want to put any direct draw graphics, not in the main body, so it's an X (no) from me. Maybe one of the longer standing forum whizzes knows a better/correct route, otherwise back to indicator and strategy drawing board, they can be linked via globals if that is really needed.
(Direct draw graphics have to be re-drawn on any refresh, i.e. N times/sec or window change events, not just when you think they need to be, there is no persistence, unlike the illusion created by drawing object graphics).
I wanted to post back an indicator/strategy developed with the Ninja support. What it does is create a synced List between a strategy and indicator. You can dump all your data from within the strategy and it will sync up from within the indicator. You can modify the List from either side indicator or strategy. With this you can loop through the List from within the override Plot method of the indicator to "achieve" a work around override Plot of the strategy. I have uploaded the zip file to the below link.
SORRY EVERYONE, the first file I uploaded was incorrect. Please find correct file now.
This was created with the help of Ninja support. What it was created for was to be able to create a List and is synced between a strategy and indicator. The original …