Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator Plots only Once

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

    Indicator Plots only Once

    Hello!
    Need some help with developing an Indicator.
    Having trouble that indicator plots only last conditions and once, and doesn't plot any lines (i'm using vertical lines with two colors) on history (except two last lines).
    I want to see all lines that I have. In Output window I see that values are calulating good and returns the right value, but on chart I see only two vertical lines.

    Here is the code I'm using for plot lines:
    Code:
    if(mcSum > 2)
    			{
    				Print("Can take long trades");
    				DrawVerticalLine("Long Enable", 0, upColor);
    			}
    			if(mcSum < -2)
    			{
    				Print("Can take short trades");
    				DrawVerticalLine("Short Enable", 0, downColor);
    			}
    upColor setted to green and downColor for red in Variables.

    What I need to do to get all this Lines?
    In Output window I see all Prints "Can take long/short trades".
    Thanks!

    update: i found that lines are refreshing and plots me only last values. I'm using this code in OnBarUpdate method.
    But I want next thing: as my condition applies - plot vertical line and don't remove it or refresh. Want to stay that line on chart.
    Last edited by YevhenShynkarenko; 11-15-2015, 07:24 AM.

    #2
    Originally posted by YevhenShynkarenko View Post
    Hello!
    Need some help with developing an Indicator.
    Having trouble that indicator plots only last conditions and once, and doesn't plot any lines (i'm using vertical lines with two colors) on history (except two last lines).
    I want to see all lines that I have. In Output window I see that values are calulating good and returns the right value, but on chart I see only two vertical lines.

    Here is the code I'm using for plot lines:
    Code:
    if(mcSum > 2)
    			{
    				Print("Can take long trades");
    				DrawVerticalLine("Long Enable", 0, upColor);
    			}
    			if(mcSum < -2)
    			{
    				Print("Can take short trades");
    				DrawVerticalLine("Short Enable", 0, downColor);
    			}
    upColor setted to green and downColor for red in Variables.

    What I need to do to get all this Lines?
    In Output window I see all Prints "Can take long/short trades".
    Thanks!

    update: i found that lines are refreshing and plots me only last values. I'm using this code in OnBarUpdate method.
    But I want next thing: as my condition applies - plot vertical line and don't remove it or refresh. Want to stay that line on chart.

    https://ninjatrader.com/support/help...rticalline.htm

    Code:
    Parameters
    tag
    A user defined unique id used to reference the draw object. 
    For example, if you pass in a value of "myTag", each time 
    this tag is used, the same draw object is modified.
     If unique tags are used each time, 
    a new draw object will be created each time.

    Comment


      #3
      Originally posted by YevhenShynkarenko View Post
      Hello!
      Need some help with developing an Indicator.
      Having trouble that indicator plots only last conditions and once, and doesn't plot any lines (i'm using vertical lines with two colors) on history (except two last lines).
      I want to see all lines that I have. In Output window I see that values are calulating good and returns the right value, but on chart I see only two vertical lines.

      Here is the code I'm using for plot lines:
      Code:
      if(mcSum > 2)
      			{
      				Print("Can take long trades");
      				DrawVerticalLine("Long Enable", 0, upColor);
      			}
      			if(mcSum < -2)
      			{
      				Print("Can take short trades");
      				DrawVerticalLine("Short Enable", 0, downColor);
      			}
      upColor setted to green and downColor for red in Variables.

      What I need to do to get all this Lines?
      In Output window I see all Prints "Can take long/short trades".
      Thanks!

      update: i found that lines are refreshing and plots me only last values. I'm using this code in OnBarUpdate method.
      But I want next thing: as my condition applies - plot vertical line and don't remove it or refresh. Want to stay that line on chart.
      Your Lines have the same tag, so the last one will overwrite any others. Make your tags unique.

      The syntax in the NTHelp states this rather clearly.

      Last edited by koganam; 11-15-2015, 05:22 PM.

      Comment


        #4
        Hello YevhenShynkarenko,

        I believe koganam and sledge have provided the necessary information to resolve your inquiry. If you continue to experience difficulties, please let us know so we can assist.

        Basically you would want your code to look like this for all the lines to appear:
        Code:
        if(mcSum > 2)
        			{
        				Print("Can take long trades");
        				DrawVerticalLine("Long Enable" + CurrentBar.ToString(), 0, upColor);
        			}
        			if(mcSum < -2)
        			{
        				Print("Can take short trades");
        				DrawVerticalLine("Short Enable" + CurrentBar.ToString(), 0, downColor);
        			}
        Thank you in advance!
        Michael M.NinjaTrader Quality Assurance

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Renejm, Today, 06:17 AM
        0 responses
        4 views
        0 likes
        Last Post Renejm
        by Renejm
         
        Started by kazisl, Yesterday, 06:41 PM
        2 responses
        10 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by impactX, 05-04-2021, 01:07 AM
        2 responses
        11 views
        0 likes
        Last Post NinjaTrader_Melissa  
        Started by op1031, Yesterday, 05:51 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by aaadetos, 05-04-2021, 09:28 AM
        3 responses
        14 views
        0 likes
        Last Post NinjaTrader_Heath  
        Working...
        X