Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Streamreader

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

    Streamreader

    Hi,

    I am importing a txt file for a strategy I want to prove over the next few months, so as the txt file is created daily for import I have adapted streamreader to read the txt file

    How do I get the data from the print command into a format that will go into an indicator, lets say an SMA

    Code:
                                    else if (splitCounter == 6)    
                                    {
                                    currentVolume = double.Parse(s);
                                    Print("Current Day OHLC: " + date +  " " + currentOpen + " " + currentHigh + " " + currentLow + " " + currentClose + " " + currentVolume);                                
                                    }
    The above statement prints correctly

    but I need to get there into a SMA, can I create a dataseries from there and then add in the SMA? is that the easiest way?

    Or use an SMA template and add in the streamreader code?

    Whats best?

    Thanks

    Tinkerz

    #2
    Tinkerz,

    You would want to use a "DataSeries" if you are trying to pass the read-in data to a indicator.



    Say you create a "myDataSeries" to store all the read-in data.

    Then you can call SMA like :

    MyDataSeries.Set(readInValue); //readInvalue is whatever value you have read in from the text file
    double output = SMA(myDataSeries,Period)[0]; // for example

    This will use the data your have read into the MyDataSeries series as input for the SMA.
    Adam P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

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