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

Add custom lines for breakout

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

    Add custom lines for breakout

    Hello Ninjatraders ,

    I would like to understand that , if i can add to my strategy several custom lines ( ex. on each 5 USD or points ) and to use them for breakouts .
    please see attached screenshot ;

    the logic is to open a long after the price breakes up 3 consecutive lines which i defined before , or 3 down for short trades .
    probably i need to define a reference or starting point before to count 3 lines , like EMA cross or similar . . please see attached screenshot with my marks


    any chance to do it via strategy builder ? if not , could you pelase support me about codes ?


    many thanks


    #2
    Hello envyizmir,

    Using the strategy builder to create the lines in the image would be difficult unless the lines have fixed price values. You would be able to draw lines using the horizontal line tool however you need to supply a price. If the prices are fixed you could make a set which has a lot of horizontal lines with set prices. That would only cover a range of prices and would not be dynamic.

    If the prices need to be calculated or you wanted this to be dynamic for any range of prices then you would need to manually code this. It would be much more efficient in manual coding as you could avoid using draw objects which take resources.

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

    Comment


      #3
      Hello Jesse ,

      Could you please let me about both ways ;
      • if the prices are fix , how to create a set in builder ?
      • if the prices are going to be dynamic in a range , how can I code it
      many thanks


      Comment


        #4
        Hello envyizmir,

        If you wanted to use the builder you would need to add an Action for each object you wanted. In any set, one without any conditions you can use the action of drawing -> horizontal line. You would then type in the values where you want the lines.



        If you were going to manually code this it would be easiest to use drawing objects and specify prices. That would require using C# loops and logic, that is not necessarily something I can make a sample of but we could walk through what would be required if you wanted to manually code it instead.

        I look forward to being of further assistance.

        JesseNinjaTrader Customer Service

        Comment


          #5
          Hello Jesse ,


          If i create the lines with ``action of drawing -> horizontal line. `` , can the builder use like breaking point ( for long and short ) ?

          or in another way without lines ;

          how can I do it in builder ; Open long position if the price is increased 30 points or ticks after 14 EMA breakout

          many thanks

          Comment


            #6
            Hello envyizmir,

            The builder won't be able to use the object directly for any conditions, that is mainly just a visual for the value you typed in. Because you just typed in a value you could make a condition with that value as part of the condition.

            If you wanted to check if the price is greater than X amount from an indicator or based on a condition you could use a User Variable for that purpose. There is a sample that uses variables to control a stop order/break even which would basically be the same concept in regard to setting the variable to have a specific price based on conditions. After setting the calculated price to the variable that could be used in any of your Sets to check if the Close price crosses the variable price.



            JesseNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by lightsun47, Today, 03:51 PM
            0 responses
            2 views
            0 likes
            Last Post lightsun47  
            Started by 00nevest, Today, 02:27 PM
            1 response
            8 views
            0 likes
            Last Post 00nevest  
            Started by futtrader, 04-21-2024, 01:50 AM
            4 responses
            41 views
            0 likes
            Last Post futtrader  
            Started by Option Whisperer, Today, 09:55 AM
            1 response
            13 views
            0 likes
            Last Post bltdavid  
            Started by port119, Today, 02:43 PM
            0 responses
            8 views
            0 likes
            Last Post port119
            by port119
             
            Working...
            X