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

Entry and Exit arrows after a trade has been executed

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

    Entry and Exit arrows after a trade has been executed

    Is it possible to increase the size of the arrows that show the executions of a trade once it has been executed I need to decrease
    my screen resolution to see them and then increase the resolution in settings to see the whole chart properly again it's rather annoying.
    If it is possible where could I find the script in ninjascript editor to do this?
    or could ninjatrader increase the number in the code, even maybe add a parameter for this in the data series, we can adjust the colour
    of the arrows but not the size.

    Thank you in advance

    Christopher

    #2
    Hello Christopher Leggit,

    Thanks for your post.

    Executions markers are not Drawing Objects, so we could not edit a DrawingTool to modify the size of Execution Markers. This is some thing we have received feedback on, and I have added a vote to our feature request on your behalf. The ticket ID is SFT-2174. This is an internal number, but for anyone else wishing to have their interest tracked, please let our support staff know that you would like a vote added for this request.

    Feature Request Disclaimer

    We receive many requests and cannot reasonably implement all requested features or changes. Interest is tracked internally and if enough interest is tracked, it would be weighed against how feasible it would be to make those changes to consider implementing. As such we cannot offer an ETA or promise of fulfillment.

    When new features are implemented, they will be listed in the Release Notes page of the Help Guide. The ID number will be different than the internal feature request tracking ID, but the description of the feature will let you know if that feature has been implemented.

    Release Notes - https://ninjatrader.com/support/help...ease_notes.htm


    Something that you could consider in the meantime would be to create an indicator that loops through an account's Executions collection, and then draws a marker of your own at the desired bar. You could use Execution.Price to place the marker at your desired price, and CurrentBar - Bars.GetBar(Execution.Time) to be able to get a BarsAgo index to plot that marker. (Note that this would only work for daily executions that would be seen in the Control Center. reading all executions requires reading the database file, which is unsupported.)

    Account object - https://ninjatrader.com/support/help...ount_class.htm

    Account.Executions - https://ninjatrader.com/support/help...executions.htm

    Execution - https://ninjatrader.com/support/help.../execution.htm

    My colleague Paul has a customized version of ChartMarkers so you could draw markers with larger size.

    Chart Markers Plus (publicly available) - https://ninjatraderecosystem.com/use...rtmarkersplus/

    The NinjaTrader Ecosystem website is for educational and informational purposes only and should not be considered a solicitation to buy or sell a futures contract or make any other type of investment decision. The add-ons listed on this website are not to be considered a recommendation and it is the reader's responsibility to evaluate any product, service, or company. NinjaTrader Ecosystem LLC is not responsible for the accuracy or content of any product, service or company linked to on this website.

    We look forward to assiting.
    JimNinjaTrader Customer Service

    Comment


      #3
      Christopher

      Here is some simple code that draws lines where my order, PT and SL are placed (I am using managed orders). See the attached pic. Adjust the line thickness, color and type to suit your display. This is also helpful to see unfilled orders. Property Prop000002StrategyOptimize is toggled to suppress these lines for optimization performance.

      Code:
      #region Entry/PTSL Price Plots
      
      // Entry Price, Stop Loss and Profit Target Y coordinate variables are set in OnOrderUpdate when a long or short order is submitted (thus this code will show the lines even when the order is unfilled)
      // The Stop Loss and Profit Target Y coordinates are again set below to ensure that the coordinates are updated if the Stop Loss and/or Profit Target is subsequently adjusted
      // Also in OnOrderUpdate, OrderLBar/OrderSBar (for the X coordinate calculation) is set to CurrentBar when the long or short order is submitted
      
      if (Prop000002StrategyOptimize.Equals(CustomEnumNamespace.StrategyOptimize.No))
      {
      
      // Set the PT/SL Y coordinates ([U]similar[/U] code is needed in OnOrderUpdate to set the coordinates before the StopLossOrder and ProfitTargetOrder objects exist)
      
      if (StopLossOrder != null)
      {
      OrderLSLCoord = StopLossOrder.StopPrice;
      OrderSPTCoord = StopLossOrder.StopPrice;
      }
      if (ProfitTargetOrder != null)
      {
      OrderLPTCoord = ProfitTargetOrder.LimitPrice;
      OrderSSLCoord = ProfitTargetOrder.LimitPrice;
      }
      
      // Prevent the Entry line from overwriting Stop Loss or Profit Target lines in case either is subsequently adjusted to the breakeven (TrigEntry) price
      
      if (OrderLSLCoord == TrigEntry || OrderSPTCoord == TrigEntry || OrderLPTCoord == TrigEntry || OrderSSLCoord == TrigEntry)
      OrderPlotHide = true;
      else
      OrderPlotHide = false;
      
      // Draw the Lines
      
      if (OrderL != null)
      {
      Draw.Line(this, "LPT-"+CurrentBar, true, CurrentBar - OrderLBar, OrderLPTCoord, 0, OrderLPTCoord, Brushes.Green, DashStyleHelper.Solid, 3);
      Draw.Line(this, "LSL-"+CurrentBar, true, CurrentBar - OrderLBar, OrderLSLCoord, 0, OrderLSLCoord, Brushes.Green, DashStyleHelper.Solid, 3);
      Draw.Line(this, "LENTRY-"+CurrentBar, true, CurrentBar - OrderLBar, TrigEntry, 0, TrigEntry, (!OrderPlotHide ? Brushes.Orange : Brushes.Transparent), DashStyleHelper.Dash, 3);
      }
      
      if (OrderS != null)
      {
      Draw.Line(this, "SPT-"+CurrentBar, true, CurrentBar - OrderSBar, OrderSSLCoord, 0, OrderSSLCoord, Brushes.Red, DashStyleHelper.Solid, 3);
      Draw.Line(this, "SSL-"+CurrentBar, true, CurrentBar - OrderSBar, OrderSPTCoord, 0, OrderSPTCoord, Brushes.Red, DashStyleHelper.Solid, 3);
      Draw.Line(this, "SENTRY-"+CurrentBar, true, CurrentBar - OrderSBar, TrigEntry, 0, TrigEntry, (!OrderPlotHide ? Brushes.Orange : Brushes.Transparent), DashStyleHelper.Dash, 3);
      }
      
      }
      
      #endregion
      Hope this can help you.
      Cheers!
      Click image for larger version

Name:	ptsl.JPG
Views:	730
Size:	22.6 KB
ID:	1183980

      Comment


        #4
        Hi Zigfried​! Thank you for providing the simple code for drawing the execution lines. I am not savvy in coding so would you be able to provide me the whole script that I can import into NT8? Thank you again!

        Comment


          #5
          Originally posted by AceHorse View Post
          Hi Zigfried​! Thank you for providing the simple code for drawing the execution lines. I am not savvy in coding so would you be able to provide me the whole script that I can import into NT8? Thank you again!
          Hello AceHorse​. This code was copied from my own 9000+ line custom control strategy. Sorry but it is not suitable to be made into a standalone script. It must be integrated into your own custom strategy considering whatever Order Management techniques you have chosen to use in your code.

          Comment

          Latest Posts

          Collapse

          Topics Statistics Last Post
          Started by lucyb, 06-23-2024, 08:33 AM
          11 responses
          37 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by affilife, 02-17-2024, 09:53 AM
          7 responses
          127 views
          0 likes
          Last Post NinjaTrader_Jesse  
          Started by gabrielrodrigues, 06-21-2024, 07:38 AM
          11 responses
          56 views
          0 likes
          Last Post NinjaTrader_Gaby  
          Started by Dan_TUK, Today, 08:59 AM
          6 responses
          20 views
          0 likes
          Last Post Dan_TUK
          by Dan_TUK
           
          Started by RISKYBUSINEZZ, Today, 10:43 AM
          3 responses
          13 views
          0 likes
          Last Post NinjaTrader_ChristopherJ  
          Working...
          X