• 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

Attach Order to Ray NT 8

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

    Attach Order to Ray NT 8

    I'd like to attach an order to a ray that I've drawn on a chart, but I can't since it isn't an indicator. NT 8

    Can a line, ray or a proxy be coded so that it's treated as an indicator, and has a values at its anchor points as well as each bar in between?

    Thank you...

    #2
    Hello,

    Thank you for the question.

    I wanted to check, are you trying to do this with NinjaScript specifically or just in general? If you are just speaking in general, would using an Alert work for you? Alerts allow you to submit orders using Drawing tools.

    Please try clicking on the Ray -> Right click -> Alert..

    You can configure this as a CrossAbove or CrossBelow for the current price so if the price crosses the ray it would trigger the alert.

    For the alerts action you could submit an order.
    http://ninjatrader.com/support/helpG...-us/alerts.htm

    For a script, generally a strategy would be used in this case to look for X price and submit an order, likely this could be accomplished though NinjaScript as well as a strategy.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      I was hoping to use rays that I've drawn on charts, but I have two concerns:

      1. Rays disappear when I change contract expiries every rollover - not convenient to redraw them all. Is there a way to keep a ray on a chart when I change the instrument (same master instrument, e.g. ES 12-15 to ES 03-16)?

      2. Is there a way to engage Chart Trader (ATM, OCO, etc.) on orders placed by an alert on a ray?

      If either of these are no, or not reasonably feasible, I'll resort to coding an indicator.

      The indicator will probably try to plot values (underlying/transparent) for each ray I draw on a chart so that I have a value for today to attach Chart Trader orders to. Does that sound doable?

      Comment


        #4
        Hello,

        Thank you for the questions.

        1). This would be expected as each contract month is essentially its own instrument. Each contract month shares a common MasterInstrument such as ES but would be a unique instrument its self so the objects could not be carried over. The only way around this would be to use the continuous contract ES ##-##.

        2). There is no built in method for this, I have seen ways to expand the chart trader from NinjaScript but in this I also had noticed calling that code does not actually enable the chart trader. In this case I would not be certain this would even be completely possible using code.

        Regarding your idea, that seems completely possible. There are ways to access the ChartObjects or drawing tools from NinjaScript to loop throgh them so you could potentially look for new objects and store the object last drawn to know when a new object is added.

        I dont currently have any samples on this specifcially but you could start looking through the following code as a starting point if you choose to go the indicator route.

        Code:
        foreach (IChartObject chartObject in ChartControl.ChartObjects)
        {
        	if (chartObject.GetType() == typeof (Ray))
        	{
        	       Ray myRay = chartObject as Ray;
        	       if (myRay != null)
        	       {
        	
        	        }
        	}
        }

        I look forward to being of further assistance.
        JesseNinjaTrader Customer Service

        Comment


          #5
          @stephensams, did you ever get this code to work?

          I'm looking to do the same thing myself and would be very happy to collaborate.

          Been playing with the NT 8 attach to indicator feature. One idea we can try is to have an indicator that scrolls through all drawn objects, comes up with a price value at bar[0] for each one which intersects current price, and exposes a value labelled as the drawn object.

          Theoretically, this will allow us to use the "attach to indicator" functionality after entering the ATM order on the chart. Once the order is filled, we can repeat the process with each stop and target for other drawn objects. Very manual process, but at least it'd be a start.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by brian meade, Today, 01:39 PM
          1 response
          4 views
          0 likes
          Last Post NinjaTrader_PaulH  
          Started by Johnny Santiago, Today, 12:20 PM
          1 response
          5 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Started by NinjaTrader_Brandon, Today, 10:24 AM
          0 responses
          47 views
          0 likes
          Last Post NinjaTrader_Brandon  
          Started by ptertich, Today, 07:56 AM
          2 responses
          15 views
          0 likes
          Last Post Johnny Santiago  
          Started by aslane, Today, 08:24 AM
          1 response
          14 views
          0 likes
          Last Post NinjaTrader_ChrisL  
          Working...
          X