Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Possible to define properties from a text file?

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

    Possible to define properties from a text file?

    Hello,

    I am very new to C#, so I am hoping you can help me with some patience.

    I currently have a working strategy that has user defined properties via the strategy UI that define price levels for support and resistance, and will take trades from those levels when certain conditions exist.

    I am looking to update this strategy in a way that would allow me to reference an external text file. During market replay, I am hoping I can define these price levels (properties?) from the external file, grabbing price levels associated with a given date, and then testing with those defined price levels. Ideally then I can avoid having to manually enter these price levels on the UI, select a date, and then run the market replay before getting results during my testing.

    Example: I choose market replay start and end date, as the replay moves along and the dates change, the strategy is able to read and use the correct levels for a given date.

    Is this possible? Can you direct me to where I can read more about how to do this?

    Kind regards,

    Andy

    #2
    Hello,

    Thank you for your post.

    Yes, you can read from a text file from your strategy script. Below is a sample script that demonstrates reading from a text file using StreamReader.



    Please let us know if you have any further questions.
    Gaby V.NinjaTrader Customer Service

    Comment


      #3
      Awesome! That worked. Now, how can I refer to "today's date" within market replay?

      Comment


        #4
        Do you mean the date in reference to the candles? Using Time[0] will get you the Date and time of the current candle. If you are looking for the current day you would use DateTime.Now.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by rubiijonson, Today, 01:02 AM
        0 responses
        4 views
        0 likes
        Last Post rubiijonson  
        Started by fkronloff, Today, 12:25 AM
        0 responses
        3 views
        0 likes
        Last Post fkronloff  
        Started by Zadomani, Yesterday, 11:39 PM
        0 responses
        11 views
        0 likes
        Last Post Zadomani  
        Started by ToNovy, 01-27-2025, 11:22 PM
        20 responses
        197 views
        0 likes
        Last Post ToNovy
        by ToNovy
         
        Started by hypercube, 03-07-2025, 12:22 AM
        2 responses
        38 views
        0 likes
        Last Post hypercube  
        Working...
        X