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 tradingnasdaqprueba, Today, 03:42 AM
      6 responses
      29 views
      0 likes
      Last Post tradingnasdaqprueba  
      Started by kaywai, Today, 11:59 AM
      1 response
      5 views
      0 likes
      Last Post NinjaTrader_Erick  
      Started by ETFVoyageur, 04-30-2024, 02:04 PM
      13 responses
      110 views
      0 likes
      Last Post ETFVoyageur  
      Started by Skifree, Today, 11:21 AM
      1 response
      2 views
      0 likes
      Last Post NinjaTrader_ChelseaB  
      Started by Vulgoth_t_Destroyer, 05-09-2022, 04:45 PM
      52 responses
      5,265 views
      0 likes
      Last Post olivierh  
      Working...
      X