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 CarlTrading, 03-31-2026, 09:41 PM
      1 response
      73 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by CarlTrading, 04-01-2026, 02:41 AM
      0 responses
      39 views
      0 likes
      Last Post CarlTrading  
      Started by CaptainJack, 03-31-2026, 11:44 PM
      0 responses
      63 views
      2 likes
      Last Post CaptainJack  
      Started by CarlTrading, 03-30-2026, 11:51 AM
      0 responses
      63 views
      0 likes
      Last Post CarlTrading  
      Started by CarlTrading, 03-30-2026, 11:48 AM
      0 responses
      53 views
      0 likes
      Last Post CarlTrading  
      Working...
      X