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

Plot Dot into indicator window

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

    Plot Dot into indicator window

    hi,
    i'd like to plot a dot into the indicator window.

    for example: if close [0] > open [0] -> plot a dot on position +1 [0]

    compared to the tutorial:
    Plot0.Set (Close [0] > Open [0] ? 1:0)
    i receive the result either on 1 or on 0

    so, what can i do to receive the dot for the given condition only on position +1 [0]?

    thx for your assistance!!

    #2
    Hello Tradexxx,
    Thanks for posting today.

    Plot0.Set (Close [0] > Open [0] ? 1:0)
    i receive the result either on 1 or on 0
    This statement is functioning as written. The condition Close [0] > Open[0] will return a true or false result which will then return a 1 on when true and a 0 when false. Then this will set the Plot0 to 1 or 0.

    I am a little confused on what you are trying to accomplish with

    position +1 [0]

    Are you referencing a position in a strategy? (long or short)
    A position in the plot? (Next bar?)
    Are you are referring to the current Price?

    If you could provide a little more information I can better assist you.
    Alex G.NinjaTrader Customer Service

    Comment


      #3
      Hi AlexG,
      thx for the response!


      Are you referencing a position in a strategy? (long or short)
      no, not in the first step. (but therefore i thought i have to use the plot mechanism to be able to use the indicator later in another indicator - hopefully i'm not wrong?)

      i'll try to explain:
      - i'd like to plot a dot in the indicator window
      - the dot can have the figures "+1" or "0" or "-1", depending on the result of the if-condition
      - hopefully working like a small oscialltor
      - if the condition is fullfilled on bar [0], the dot has to be on position [0] - displaying "+1" or "0" or "-1"
      - back to the example from the beginning: if Close[0] > Open[0] -> plot a dot on y-axis = "+1" and x-axis [0] in the indicator window
      - using the described formula from the tutorial i'll reveive something like either "+1" or "0", but i can't met my other conditions, or?
      if there's any other easier solution, i'll be happy to use.
      thx !
      Last edited by Tradexxx; 04-07-2015, 11:14 AM.

      Comment


        #4
        Hello,
        Thanks for the clarification.

        From what you describe it seems you need three different return conditions, +1, 0, -1.

        An if statement can only have two return conditions(true or false). To accomplish the third condition it would depend on what you want to trigger the third response.

        Here is an example of code that would check if a close[0] is above, equal, or below a variable num.

        Code:
        if (Close[0] > num)
        {[INDENT]return 1;[/INDENT]
        }
        
        else if (Close[0] <1)
        {[INDENT]return -1;[/INDENT]
        }
        
        else
        {[INDENT]return 0;[/INDENT]
        }
        To add text to your dot you can use the DrawText() method using the same barsAgo parameter settings as you did with your DrawDot().

        Here is a link to the help guide documentation on the DrawText() and DrawDot() method.
        http://www.ninjatrader.com/support/h...l?drawtext.htm
        http://www.ninjatrader.com/support/h...ml?drawdot.htm

        Please let us know if we may be of further assistance for anything NinjaTrader.
        Alex G.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by adeelshahzad, Today, 03:54 AM
        5 responses
        32 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by stafe, 04-15-2024, 08:34 PM
        7 responses
        32 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by merzo, 06-25-2023, 02:19 AM
        10 responses
        823 views
        1 like
        Last Post NinjaTrader_ChristopherJ  
        Started by frankthearm, Today, 09:08 AM
        5 responses
        21 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by jeronymite, 04-12-2024, 04:26 PM
        3 responses
        43 views
        0 likes
        Last Post jeronymite  
        Working...
        X