• 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

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
    Patrick H.NinjaTrader Customer Service

    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.
        Patrick H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Leope, Today, 03:15 AM
        0 responses
        6 views
        0 likes
        Last Post Leope
        by Leope
         
        Started by Frook1951, Today, 03:09 AM
        0 responses
        5 views
        0 likes
        Last Post Frook1951  
        Started by unlobotrader, Today, 02:46 AM
        0 responses
        4 views
        0 likes
        Last Post unlobotrader  
        Started by greg6622, Today, 01:26 AM
        0 responses
        3 views
        0 likes
        Last Post greg6622  
        Started by Splex, Today, 12:04 AM
        0 responses
        4 views
        0 likes
        Last Post Splex
        by Splex
         
        Working...
        X