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

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.


    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 yertle, Today, 08:38 AM
          6 responses
          25 views
          0 likes
          Last Post ryjoga
          by ryjoga
           
          Started by algospoke, Yesterday, 06:40 PM
          2 responses
          24 views
          0 likes
          Last Post algospoke  
          Started by ghoul, Today, 06:02 PM
          3 responses
          16 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Started by jeronymite, 04-12-2024, 04:26 PM
          3 responses
          46 views
          0 likes
          Last Post jeronymite  
          Started by Barry Milan, Yesterday, 10:35 PM
          7 responses
          23 views
          0 likes
          Last Post NinjaTrader_Manfred  
          Working...
          X