Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Barnumber

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

    Barnumber

    Hello,

    After working through the helpguide and forum I know how to draw a line working with currentbar, startbarsago, starttime, barssincopen, ...

    but I can´t find out how to have eg a line from a low of a bar where occurred a conditon to the high of a bar where occurred another condition. I can not use for this startbarsago nor starttime.

    How can I have for Drawline the startpoint and the endpoint for the line by conditions please? (eg starting the bar where is the Bollinger-Low and ending at high of the bar where a cross SMA with upper Bollinger occurs)

    Thank you
    Tony
    Last edited by tonynt; 03-24-2016, 04:55 AM. Reason: Clearifying

    #2
    Hello tonynt,

    Thanks for your post.

    In general terms what you would do is to save the bar number of the bar when/where the low occurred and save the bar number of when/where the high occurred. You would save the bar numbers into integer variables. You can then use these variables to set the start and end barsago requirement of the DrawLine() method. You would do this by subtracting the low bar number from the CurrentBar and subtract the high bar number also from CurrentBar.
    Paul H.NinjaTrader Customer Service

    Comment


      #3
      Hello Paul,

      thank you for your reply. This is exactly what I intend to do and found out in the forum. But there is one stept I can not do and this is "save the bar number of when/where the high occurred".

      Can you post me this one line please?

      Thank you
      Tony

      Comment


        #4
        Hi tonynt,

        Thanks for your reply.

        In general it would be something like:

        if (your condition for low bar)
        {
        lowBar = CurrentBar; // save current bar into the integer variable lowBar
        }

        if (your condition for high bar)
        {
        highBar = CurrentBar; // save current bar into the integer variable highBar
        }

        You would declare the integer variables lowBar and highBar in the variable declaring section.
        Paul H.NinjaTrader Customer Service

        Comment


          #5
          Hello,

          thank you for your reply. I could do this workaround but I have a problem with my
          DrawLine("up", false,CurrentBar-lowBar, Low[CurrentBar-lowBar],CurrentBar-highBar,High[CurrentBar-highBar], Color.Green,DashStyle.Dash,3);

          It occurred that the line started where condtion is true first time (days ago) and not in current session when the condition is true. And also it occurred that the line was moving with every new bar(?). What do I have to change please so that the line starts with the bar of most recent condition true and the line ends with the bar of most recent condition and the line is fixed there untill I remove it in the script with new condition true.


          Thank you
          Tony
          Last edited by tonynt; 03-24-2016, 03:58 PM. Reason: translation error

          Comment


            #6
            Hi Tony,

            Thanks for your reply.

            With the tag name of "up", there will only be one line shown and it would be the latest drawn. From your description that would suggest that your code is not correctly detecting the conditions you are looking for. I suggest that you add print statements into your conditional statements to understand where lowBar and highBar are being set.
            Paul H.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by mjairg, 07-20-2023, 11:57 PM
            3 responses
            213 views
            1 like
            Last Post PaulMohn  
            Started by TheWhiteDragon, 01-21-2019, 12:44 PM
            4 responses
            544 views
            0 likes
            Last Post PaulMohn  
            Started by GLFX005, Today, 03:23 AM
            0 responses
            3 views
            0 likes
            Last Post GLFX005
            by GLFX005
             
            Started by XXtrader, Yesterday, 11:30 PM
            2 responses
            12 views
            0 likes
            Last Post XXtrader  
            Started by Waxavi, Today, 02:10 AM
            0 responses
            7 views
            0 likes
            Last Post Waxavi
            by Waxavi
             
            Working...
            X