Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

drawing updating from input file

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

    drawing updating from input file

    Hello,

    I draw horizontal lines in my chart and calculate in my script with values from a csv file. All works fine but I have the problem that when the csv files calculates new levels (from excel) then I have to refresh in NinjaTrader with F5 so that the values are to use in the script.

    I tried to do this automatically in onbarupdate with

    if(readlevels == 0 && ToTime(Time[0]) > 93100)
    {foreach(LineInfo item in _filevalues)
    {readlevels = 1; // set int for no more reading
    if(item.LevelText == "L1" && item.LevelValue > 0)
    {L1L = item.LevelValue;}
    f(item.LevelText == "L2" && item.LevelValue > 0t)
    {L2L = item.LevelValue;}
    ......
    ......

    if(item.LevelText == "L1" && item.LevelValue > 0) {DrawHorizontalLine("L1L", false, item.LevelValue, Color.Peru, DashStyle.Dash,1);}
    if(item.LevelText == "L2" && item.LevelValue > 0) {DrawHorizontalLine("L2L", false, item.LevelValue, Color.Peru, DashStyle.Dash,1);}
    }

    but it doesn´t draw the new levels at that time. I have to press F5. How can I have the updated values working in the script without pressing F5? What I´m doing wrong?

    Thank you
    Tony

    #2
    Hello tonynt,

    Thank you for your note.

    If OnBarUpdate() is not seeing the new values you may need to force a new "read" of the file. Do you have an example script and file we could test your logic in?

    Comment


      #3
      Have you tried refreshing the chart?
      Code:
              // send repaint message to chart window
              protected void RefreshChartWindow()
              {
                  if (ChartControl != null)
                      ChartControl.Invalidate(true);
              }
      Look in @BarTimer.cs and @Pivots.cs for examples.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      110 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      59 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      37 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      41 views
      0 likes
      Last Post TheRealMorford  
      Started by Mindset, 02-28-2026, 06:16 AM
      0 responses
      78 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Working...
      X