Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 chbruno, Today, 04:10 PM
    0 responses
    1 view
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by josh18955, 03-25-2023, 11:16 AM
    6 responses
    436 views
    0 likes
    Last Post Delerium  
    Started by FAQtrader, Today, 03:35 PM
    0 responses
    6 views
    0 likes
    Last Post FAQtrader  
    Started by rocketman7, Today, 09:41 AM
    5 responses
    19 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by frslvr, 04-11-2024, 07:26 AM
    9 responses
    127 views
    1 like
    Last Post caryc123  
    Working...
    X