• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ghosting in Draw.TextFixed

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • NinjaCustomer
    started a topic Ghosting in Draw.TextFixed

    Ghosting in Draw.TextFixed

    I use Draw.TextFixed to draw in the bottom left of the chart using my strategy. I also change the colors sometimes when I updated it.

    I'm running 2 strategies on different symbols in 2 different chart tabs of the same window.

    One of my strategies, in this text fixed area - I can see the background in another color, text is being overwritten. What I mean is the foreground text I can read completely. But behind it is some other text. I have opacity @ 50.

    But I wonder where this text comes from? it is the type of text generated by the strategy, I can see parts of it that give it away like '[' that I use

    But I'm wondering is this just from the strategy running in that chart? or from the strategy running (same strategy .cs) in the other tab?

    I have never noticed this before running only one instance of the strategy at a time.

    Also, that tab with the problem was mostly in the background most of the time.


  • NinjaTrader_PaulH
    replied
    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.

    Leave a comment:


  • NinjaCustomer
    replied
    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:


  • NinjaTrader_PaulH
    replied
    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:


  • NinjaCustomer
    replied
    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:


  • NinjaTrader_PaulH
    replied
    Hello NinjaCustomer,

    Thanks for your replies.

    Once a strategy is disabled/stopped, it would automatically remove any drawn objects it created.

    Leave a comment:


  • NinjaCustomer
    replied
    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:


  • NinjaCustomer
    replied
    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:


  • NinjaTrader_PaulH
    replied
    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:


  • NinjaCustomer
    replied
    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:


  • NinjaTrader_PaulH
    replied
    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:


  • NinjaCustomer
    replied
    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:


  • NinjaTrader_PaulH
    replied
    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:


  • NinjaCustomer
    replied
    it uses this call - owner is this (the Strategy)Click image for larger version  Name:	2019-04-18_20-39-42-772.png Views:	1 Size:	6.1 KB ID:	1054723

    Leave a comment:


  • NinjaCustomer
    replied
    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:

Latest Posts

Collapse

Topics Statistics Last Post
Started by StevenNelson, Today, 12:29 PM
1 response
5 views
0 likes
Last Post NinjaTrader_Kate  
Started by anupsoni, Today, 12:23 PM
1 response
3 views
0 likes
Last Post NinjaTrader_Kate  
Started by aligator, Yesterday, 12:15 PM
7 responses
61 views
0 likes
Last Post aligator  
Started by frankduc, Today, 11:22 AM
3 responses
8 views
0 likes
Last Post NinjaTrader_Jesse  
Started by aslane, Today, 10:53 AM
1 response
8 views
0 likes
Last Post NinjaTrader_Jesse  
Working...
X