Announcement
Collapse
Looking for a User App or Add-On built by the NinjaTrader community?
Visit NinjaTrader EcoSystem and our free User App Share!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less
Partner 728x90
Collapse
NinjaTrader
Ghosting in Draw.TextFixed
Collapse
X
-
Hello NinjaCustomer,
Thanks for your reply.
You should be able to create a chart (using an instrument that does not already have a strategy running on it) in your current workspace and apply a single strategy to it to test for the issue.
-
for the specific tag name, let's call it 'A'
it is the same call from the same strategy e.g. Draw.TextFixed(this, 'A', ...)
also, I actually have 2 calls to Draw.TextFixed... one for 'A' and one for 'B'
and both 'A' and 'B' are duplicated on the chart, so 2 'A's and 2 'B's
there is a ForceRefresh() call after each but from what I gathered here, it shouldn't have any affect.
also I have 2 instances of the Strategy on the problem chart...
also I have several tabs with 2 instances of the Strategy on each chart.. but as far as I understand NinjaTrader, this shouldn't make any difference.
sometimes there can be more than one problem chart, but most of the charts are not problem charts. problem charts being charts that have overlayed text on top of each other in the fixed area, and also have 2 copies of 'A' and 2 copies of 'B' drawing objects in the drawing objects list.
I can't really isolate right now since I need ninjatrader to run this workspace , however if you can think of any possiblities I should look at - please let me know. I do not explicitly remove any draw objects like I was thinking about earlier.
Also even though there are 2 strategies on each chart.. i only ever run 1 of them at a time per chart. They never run on the same instrument concurrently.
Leave a comment:
-
Hello NinjaCustomer,
Thanks for your reply.
Are these of the same drawing object type (Ie: are they both Draw.textFixed() drawn?).
I would suggest isolating the issue to a single chart, single strategy.
Leave a comment:
-
hmm, that is strange then - can you think if any reason a Strategy would have created 2 drawing objects with the same name? I can see them on the chart's drawing object list as having the same name.
Leave a comment:
-
Hello NinjaCustomer,
Thanks for your replies.
Once a strategy is disabled/stopped, it would automatically remove any drawn objects it created.
Leave a comment:
-
I think I figured it out - I have 2 strategies on the chart.. 2 instances of the same strategy. only one runs at a time.. but i guess I need to remove the draw object after i stop it
Leave a comment:
-
I believe the problem occurs because I have multiple draw objects ... I mean.. the strategy created them - but for some reason I have multiple draw objects on the chart with the exact same name.. so names don't need to be unique? I was thinking that by using that if I didn't change the name in the strategy call to Draw.TextFixed that it would just overwrite the old one.. but I have 2 instances of these objects on the chart.. on charts without this "ghosting", I only have one.
Leave a comment:
-
Hello NinjaCustomer,
Please consider creating a new thread when changing subjects as this is not related to ghosting in Draw.text...
For the close strategy, please review the help guide: https://ninjatrader.com/support/help...sestrategy.htm
Leave a comment:
-
thanks, I'm having some problems now with CloseStrategy() - normally it works fine for me.. but I've run into a situation where it will not disable the strategy when called.
Usually I call it from methods originating in OnBarUpdate()
but is it safe to call it from OnAccountItemUpdate () ?
Leave a comment:
-
Hello NinjaCustomer,
Thanks for your reply.
From the help guide on ForceRefresh():
ChartControl runs a timed event every 250ms to determine the chart needs to be updated. If it does, the OnRender() method is called. Under normal circumstances, the marker used to call OnRender() will be reset after the following conditions:
•OnBarUpdate() event
•OnConnectionStatusUpdate() event
•User clicks on the chart
•Drawing object(s) have been removed from the chart
•Strategy enabled/disabled on chart
•ChartTrader enabled/disabled
In most cases, the conditions listed above should be satisfactory for rendering standard and custom chart objects; however for more advance programming concepts, there may be other situations you run into which would NOT force the chart to refresh (e.g., a user interacting with a custom control ). In these special cases, you can use the ForceRefresh() method to re-queue the render event.
Reference: https://ninjatrader.com/support/help...rcerefresh.htm
Leave a comment:
-
I'm calling it because I call the screenshot code right after and want to make sure that the this status text is drawn on the chart - so that is not necessary?
ah I just re-read what you wrote.. so all Draw method calls implicitly call ForceRefresh()?
Leave a comment:
-
Hello NinjaCustomer,
Thanks for your replies.
If you are using ForceRefresh() because you are updating the draw object, it would not be needed as, "Drawing object(s) have been removed from the chart" would cause that to occur. If indeed you are using the same tag name then the drawText will be automatically removed prompting an automatic call to ForceRefresh().
Reference: https://ninjatrader.com/support/help...rcerefresh.htm
You may want to comment out your ForceRefresh() and test to see if that resolve the issue.
Leave a comment:
-
nope, the tags are static.
I have a ForceRefresh() call immediately afterwards. Could that be problematic? it's just setting a flag, right?
Leave a comment:
-
Hello NinjaCustomer,
Thanks for your post.
Please check your code for the strategy you are running on the chart.
If you are using a unique tag name in Draw.TextFixed() then this can certainly occur when you are placing the text in the same place. This is one situation where you would want to use the same tag name so that the previously written text is automatically removed. Alternatively, you can use RemoveDrawObject("tagname") before using the next occurrence of Draw.TextFixed() if you need to use unique tag names.
Leave a comment:
Latest Posts
Collapse
Topics | Statistics | Last Post | ||
---|---|---|---|---|
Started by rocketman7, Today, 02:12 AM
|
5 responses
23 views
0 likes
|
Last Post
by rocketman7
Today, 08:19 AM
|
||
Started by trilliantrader, 04-18-2024, 08:16 AM
|
7 responses
28 views
0 likes
|
Last Post Today, 07:56 AM | ||
Started by samish18, 04-17-2024, 08:57 AM
|
17 responses
66 views
0 likes
|
Last Post Today, 07:51 AM | ||
Started by briansaul, Today, 05:31 AM
|
1 response
15 views
0 likes
|
Last Post Today, 07:36 AM | ||
Started by PaulMohn, Today, 03:49 AM
|
1 response
12 views
0 likes
|
Last Post Today, 07:36 AM |
Leave a comment: