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!
See more
See less

Partner 728x90

Collapse

Custom drawing from indicator

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

    Custom drawing from indicator

    Hello all,
    I would like to ask you for any help. I use NT7. I need to draw a ray on chart within indicator.
    I have toolstripbutton and if I press it I want to draw the ray.
    I tried to use DrawRay method, it works well. But if I press F5 (reload script) my ray disappers - I dont need it.
    So I tried to use other way - code below (item is a my class reference with all values for the ray):

    Gui.Chart.ChartRay _chartray = new Gui.Chart.ChartRay();

    _chartray.Anchor1Time = item.StartPointTime;
    _chartray.Anchor1Y = item.StartPointY;
    _chartray.Anchor2Time = item.EndPointTime;
    _chartray.Anchor2Y = item.EndPointY;
    _chartray.Locked = false;
    _chartray.Tag = item.Tag;
    _chartray.Selectable = true;
    _chartray.VisibleOnInstrument = Instrument.FullName;

    ChartControl.ChartObjects.Add(_chartray);

    It works perfect and the ray is on the same place after reload. But it is not possible to move it manually from chart. It is not locked, but it behaves like it is. If I open contextmenu and Properties... and then pres OK, ray movements are possible.
    I know this is out of your support, but PLEASE help me somehow. It must be some trick to do that.

    #2
    Hello Alexik30,

    Thank you for your post.

    There is an example of using a custom toolstrip's buttons to draw items at the following link: http://ninjatrader.com/support/forum...d=6&linkid=530

    Comment


      #3
      Hello Patrick, thank you veru much for your reply. I know this code, but I dont need to use shortcut for drawing. I need to draw a ray according to values let's say from extrenal data file. That's why Im finding the way how to draw it by script with manuall adjustments possibility. I need to draw the ray (or whatever) to be on the chart and save it to the workspace..the same way as I drown it by hand.
      I can use the code I posted before, but I need to know just the trick how allow changing anchor1 and anchor2 points in the chart manually which seems to be "locked".

      Bets regards,
      Alex

      Comment


        #4
        Hello Alexik30,

        Thank you for your response.

        You would use custom plotting instead in order to draw the values you wish. Take a look at the example under Tools > Edit NinjaScript > Indicator > CustomPlotSample.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Sparkyboy, Today, 10:57 AM
        1 response
        5 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by swestendorf, Today, 11:14 AM
        1 response
        3 views
        0 likes
        Last Post swestendorf  
        Started by TheMarlin801, 10-13-2020, 01:40 AM
        21 responses
        3,917 views
        0 likes
        Last Post Bidder
        by Bidder
         
        Started by timmbbo, 07-05-2023, 10:21 PM
        3 responses
        156 views
        0 likes
        Last Post grayfrog  
        Started by Lumbeezl, 01-11-2022, 06:50 PM
        30 responses
        812 views
        1 like
        Last Post grayfrog  
        Working...
        X