Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

transfer indicator drawn lines/values from one chart to another of same symbol

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

    #16
    Hello,

    Can you share the full output? Save the output from the output window to a text file and provide this with your reply.

    Please also provide a test version of the script so I can test it out on my end, if possible.

    Comment


      #17
      output window 1 keeps going blanc, ,that's why i usually print to putput window 22. what i copied above is all i could see. window 1 would only give me the out of range bars error i post before and would then go blanc soon after.

      Leet me see about a test script.

      any ideas though? it's deffo the draw.line using the 0 series though isn't it?

      Comment


        #18
        jjust restarted NT8 and similar results:

        window 1
        IError on calling 'OnBarUpdate' method on bar 10: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.
        Error on calling 'OnBarUpdate' method on bar 11: You are accessing an index with a value that is invalid since it is out-of-range. I.E. accessing a series [barsAgo] with a value of 5 when there are only 4 bars on the chart.


        window 2
        D -- theBar = 2245
        D -- CurrentBars[1]-theBar = 10
        before line D
        after line D
        D -- theBar = 2245
        D -- CurrentBars[1]-theBar = 11
        before line D
        U -- theBar = 1222
        U -- CurrentBars[0] = 11
        U -- CurrentBars[1] = 1232
        U -- CurrentBars[1]-theBar = 10
        U -- theBar = 1222
        U -- CurrentBars[0] = 11
        U -- CurrentBars[1] = 1233
        U -- CurrentBars[1]-theBar = 11
        U -- theBar = 1222
        U -- CurrentBars[0] = 11
        U -- CurrentBars[1] = 1234
        U -- CurrentBars[1]-theBar = 12
        D -- theBar = 2245
        D -- CurrentBars[1]-theBar = 10
        before line D
        after line D
        D -- theBar = 2245
        D -- CurrentBars[1]-theBar = 11
        before line D
        U -- theBar = 1222
        U -- CurrentBars[0] = 11
        U -- CurrentBars[1] = 1232
        U -- CurrentBars[1]-theBar = 10
        U -- theBar = 1222
        U -- CurrentBars[0] = 11
        U -- CurrentBars[1] = 1233
        U -- CurrentBars[1]-theBar = 11
        U -- theBar = 1222
        U -- CurrentBars[0] = 11
        U -- CurrentBars[1] = 1234
        U -- CurrentBars[1]-theBar = 12​​

        Comment


          #19
          U and D are lines on way up and lines on way down, same concept though. first time it printed some Ds though after this restart

          Comment


            #20
            Hello,

            Thank you for your response.

            My apologies as I would like to correct something I said earlier; drawing objects are drawn in the chart bars only (primary series) and therefore any barsAgo value we're referencing would be in reference to the primary series the script is applied to. I apologize for the confusion!

            U -- CurrentBars[0] = 11
            U -- CurrentBars[1] = 1234
            U -- CurrentBars[1]-theBar = 12​​​

            It looks like your startBarsAgo value for the line is 12, however, the primary series (CurrentBars[0]) only has 11 bars loaded.

            I recommend changing your CurrentBars check so that the primary and secondary series both at least the same number of bars loaded before beginning processing.

            For example,

            if (CurrentBars[0] < 1000 || CurrentBars[1] < 1000)
            return;​​

            Comment


              #21
              since we're talking about a 1 Ticck chart, it'll go out of syncc eventually so i don't think this is the best solutiopn. i was thinking about rounding thebars from series 1 so that they'd be drawn on the correct bar on series 0, ,i.e. using a 100 tick chart would mean (currentbars[1]-theBar)/100... what do you think? any better suggestions? it would mean that i can't really use 1min bars but it would be sufficient to provide better overview on the 100 tick bar than on the 1 tick bar at least

              Comment


                #22
                Hello,

                Could you please explain what you mean by 'out of sync'?

                The CurrentBar check would just ensure each Data Series your script references has processed enough bars, it doesn't cause any sync issues to occur and it's directly affecting the data.

                Comment


                  #23
                  Sorry, I meant that the 1 tick dataseries will keep calculating a further away line starting point which will eventually become bigger than the 0 series starting point and run into the same issue. also means having to load a lot more candles if my starting point is 1000 candles on a higher timeframe:P

                  I will try the tick division sticking to 100 tick charts for now and will see how that goes. but please let me know if you have a better idea! thank you for your help though Gaby, much appreciated!!!

                  Comment


                    #24
                    Ok,, i got it to work with my workaround division solution. For anyone else who may come across this and needs a solution, here we go (I know it's not particularly beautiful but it works. let me know if anyone finds a better solution. and apologies for the double typing,, i need a new keyboard

                    int roundBar;//int that goes into the draw.line
                    double rounded=(CurrentBars[1]-theBar)/100;//taking the latest tick (from series 1) and subtracting the bar stored in my list from where the line is supposed to start (again series 1, 1 tick chart)
                    if(rounded<1){roundBar=1;}else{roundBar=(int)(Math .Round(rounded));}//if the desired bar in the 1 tick chart equals less than 1 bar on the 100 tick chart, then round to 1, this way i will see every line on the chart even though it'll stick out a bit

                    Draw.Line(this, myIdent+"abcd", false, roundBar, thePrice, 0, thePrice, Brushes.Lime, DashStyleHelper.Solid, 1);.//draw line from saved bar / 100 to bar 0 on the chart's timeframe​

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                    0 responses
                    600 views
                    0 likes
                    Last Post Geovanny Suaza  
                    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                    0 responses
                    347 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by Mindset, 02-09-2026, 11:44 AM
                    0 responses
                    103 views
                    0 likes
                    Last Post Mindset
                    by Mindset
                     
                    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                    0 responses
                    558 views
                    1 like
                    Last Post Geovanny Suaza  
                    Started by RFrosty, 01-28-2026, 06:49 PM
                    0 responses
                    558 views
                    1 like
                    Last Post RFrosty
                    by RFrosty
                     
                    Working...
                    X