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

Several questions on indicator-indicator, and indicator-chart interactions

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

  • xxzbill
    replied
    Originally posted by NicholasJoannette View Post

    It is possible to read a manual drawing. Check out this guide: https://ninjatrader.com/support/help...rawobjects.htm. On that page there is an example called "Finding the draw object of a specific tag"
    Hopefully someone from NinjaTrader might have more info as well.
    I got it based on the reading you suggested. Thank you very much!

    Leave a comment:


  • NicholasJoannette
    replied
    Originally posted by xxzbill View Post
    Thank you again. Q1 solution works great.

    For Q3, I want to draw a horizontal line on chart, call it key_Reversal, and make my script read that price value.

    Your solution makes sense if the line is drawn by the same script, as shown on its property "is attached to" the script name.

    But manually drawn objects are attached to something identified by instrument + chart type, such as "ES 9-20 2000 tick"

    I am trying to find for a way for the script to read a manual drawing, if that's possible.
    It is possible to read a manual drawing. Check out this guide: https://ninjatrader.com/support/help...rawobjects.htm. On that page there is an example called "Finding the draw object of a specific tag"
    Hopefully someone from NinjaTrader might have more info as well.

    Leave a comment:


  • xxzbill
    replied
    Thank you again. Q1 solution works great.

    For Q3, I want to draw a horizontal line on chart, call it key_Reversal, and make my script read that price value.

    Your solution makes sense if the line is drawn by the same script, as shown on its property "is attached to" the script name.

    But manually drawn objects are attached to something identified by instrument + chart type, such as "ES 9-20 2000 tick"

    I am trying to find for a way for the script to read a manual drawing, if that's possible.

    Leave a comment:


  • NicholasJoannette
    replied
    Q1: You can use Draw.TextFixed() to at least get it in the corner of the chart, or make some custom code in OnRender for extra precise positioning directly beside the indicator name if necessary, but that will take more work and cause complications as other indicators get added to the chart. Example:
    Code:
    SimpleFont simpleFont = new SimpleFont("Arial",14);
    Draw.TextFixed(this,"Variable 1", Variable1.ToString(), TextPosition.TopLeft, Brushes.White, simpleFont, Brushes.White, Brushes.Black, 0);
    Q2: I don't know how to do this so I won't try to answer.

    Q3: Not sure if I understand your question correctly, but you can do something like this:
    Code:
    HorizontalLine horizontalLine = Draw.HorizontalLine(this,"HorizontalLine",700,Brushes.Red);
    double LineValue = horizontalLine.Anchors.ElementAt(0).Price;
    Although there is probably a simpler way.

    EDIT: I misunderstood your question for Q3. I think you meant using a line that you MANUALLY drew on the chart - in which case, you can loop through the DrawingObjects on the chart and find a particular line. Check out this guide: https://ninjatrader.com/support/help...rawobjects.htm
    Last edited by NicholasJoannette; 08-05-2021, 09:27 PM.

    Leave a comment:


  • Several questions on indicator-indicator, and indicator-chart interactions

    Q1.display input parameters on chart

    I set up an input with:

    [Display(ResourceType = typeof(double), Name = "day Max Loss", GroupName = "NinjaScriptParameters", Order = 6)] public double input_dayMaxLoss { get; set; }

    Is there away for the input value to show on the top left of the chart, where the indicator name is?


    Q2.access script 1 input from script 2

    With the same input as above, is there away to access it from another script?

    For example, I have 2 scripts, one long one short. Now I need to put in max loss value for them individually. Is it possible for them to follow a single input of the dayMaxLoss variable?

    Q3.make script read drawings on chart

    After I draw a horizontal line on the chart, is it possible to make the script read that vertical value, for purposes such as setting a stop loss at that location?

    Thanks a bunch!
    Last edited by xxzbill; 08-05-2021, 11:22 PM. Reason: Q3 and Q4 are combined and resolved

Latest Posts

Collapse

Topics Statistics Last Post
Started by andrewtrades, Today, 04:57 PM
1 response
9 views
0 likes
Last Post NinjaTrader_Manfred  
Started by chbruno, Today, 04:10 PM
0 responses
6 views
0 likes
Last Post chbruno
by chbruno
 
Started by josh18955, 03-25-2023, 11:16 AM
6 responses
436 views
0 likes
Last Post Delerium  
Started by FAQtrader, Today, 03:35 PM
0 responses
8 views
0 likes
Last Post FAQtrader  
Started by rocketman7, Today, 09:41 AM
5 responses
19 views
0 likes
Last Post NinjaTrader_Jesse  
Working...
X