• 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

Entry/Exit condition using PnF bar type

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

    Entry/Exit condition using PnF bar type

    I want to write a script that allows me to enter after the close of the next PnF box after a certain price level (created by a proprietary indicator) has been breached/touched. The price level is created through the mid point of a PnF box (1) by an indicator for which I do not have access to the code. Lets say price is moving up and a new price level is created by the indicator. If price continues to move up, the next box (2) is created that is fully above the price line (open and close are both above the price line). I want to enter right after this box has been created (on the open of box 3).

    Not to make this more confusing, but a PnF box is defined as one bar in the indicator (which however are stacked above each other like the boxes in PnF charts).

    I am new to programming and have searched the web, but cannot find anything that resembles this scenario. Any pointers in the right direction would be much appreciated.

    Thank you!

    #2
    Hello chris07,

    Thank you for the post.

    This is very likely something you can ask the vendor of that item if it is possible to be used as a signal in this way or not. This would really be the quickest way to an answer however you can try to use the indicator in the Strategy Builder to see if what you are asking is possible to do.

    Depending on how the indicator was coded, you may or may not be able to use it from within NinjaScript so this will be the first item to check.

    If the price level you referred to is a plot, you may be able to use it. The easiest way to check is if you open a new strategy builder and go to the Conditions and Actions screen. In the conditions and actions screen, click Add to create a new condition. In the left column choose Indicators and locate the indicator to see if it has any Plots listed in the Plots area. If so, pick a plot and you can continue creating a condition to test it.

    The builder will generate the necessary syntax if the indicator can be used to give you an example of how to call it in the builder or otherwise in manual coding.

    I look forward to being of further assistance.

    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi Jesse,

      according to the vendor, the entry can actually be taken through referencing an object that is drawn when above condition is met. It is just that I did not look yet into how I can reference the object from the builder. I did not find anything there which allows me to call up the object. Any pointers on how to do that would be welcome.

      The second part is how to manage the trade, which is the inverse of the scenario I had outlined above: a full box/bar close below the entry line (which is not a plot, relating to your suggestion). I had thought if I can write a strategy for the entry, I also would be able to do so for the exit. The vendor suggested to use alerts, but I am not sure if this is the best way to go since they cannot be properly backtested. Also I am not sure how to call up the alert with the exit condition once I am in the trade through an automated strategy.

      Comment


        #4
        Hello chris07,

        If the vendor meant a Plot, yes that would be correct and you would just reference the Plot in the builder. If they instead meant a drawing object, while that is technically possible to locate it is not always accurate and may not always work. It would also be very unlikely to work in backtesting if you need to search for custom drawn objects specifically, however, this could be used in realtime.

        If you do want to look into finding objects you could review the following sample which loops over drawing objects to locate them: https://ninjatrader.com/support/helpGuides/nt8/en-us/drawingtools_drawobjects.htm?zoom_highlightsub=dra wing+object

        As far as the rest of your goal is concerned, this would depend on how you wanted to approach that task. The platform does not have anything specific in place for the specific goal you outlined so this is something you would need to form with logic. For example, to enter after the close of the next PnF box after a certain price level (created by a proprietary indicator) has been breached/touched would require using a variable and some logic to check if that happened. A first event would need to save the price and a second event would check that price against the current price to know if it was touched to drive logic further.

        I look forward to being of further assistance.
        Last edited by NinjaTrader_Jesse; 04-02-2019, 03:23 PM.
        JesseNinjaTrader Customer Service

        Comment


          #5
          Jesse,

          thank you very much for your quick reply. I will look into the issues you have suggested.

          I want to point out one mistake I made in my post: after the entry, the vendor suggested to use ATM strategy monitoring, not alerts as I had stated. This is probably more for the record, but thought I should correct that statement.

          Comment


            #6
            How can I create an alert based on a Drawing Object that is not present under "Alerts > Conditions > Drawing Objects", but is shown in the chart? The object is an up arrow, which is listed under "Properties" when I mark and right click the object on the chart.

            Is there a way to add this to the list of drawing objects?
            Last edited by chris07; 04-03-2019, 03:19 PM.

            Comment


              #7
              Hello chris07 ,

              Some objects cannot be used for alerts such as the up or down arrow, the markers specifically are just markers and not full drawing objects. This is a property of a drawing object if it can or cannot be used in alerts.

              If the item you are using is drawing arrows specifically, you would need it to draw something else such as an arrow line or an ellipse.

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

              Comment


                #8
                Would it be possible to reference markers, such as the arrows, in a strategy instead? Thanks

                Comment


                  #9
                  Hello chris07 ,

                  Yes the information in post 4 links to an example of looping over the drawing object collection, however as noted this would not be a good way to get signals. It sounds like the item being used needs to be updated to expose a signal directly as it currently uses drawing objects which are not intended to be directly used as strategy signals.


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

                  Comment

                  Latest Posts

                  Collapse

                  Topics Statistics Last Post
                  Started by Mike Winfrey, Today, 11:27 AM
                  0 responses
                  6 views
                  0 likes
                  Last Post Mike Winfrey  
                  Started by swcooke, Yesterday, 07:35 PM
                  3 responses
                  23 views
                  0 likes
                  Last Post NinjaTrader_Jesse  
                  Started by brownsfan019, Today, 10:45 AM
                  1 response
                  8 views
                  0 likes
                  Last Post NinjaTrader_ChrisL  
                  Started by brownsfan019, Today, 10:41 AM
                  1 response
                  6 views
                  0 likes
                  Last Post NinjaTrader_ChrisL  
                  Started by bchip, Today, 09:25 AM
                  1 response
                  17 views
                  0 likes
                  Last Post NinjaTrader_ChelseaB  
                  Working...
                  X