Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

oco order submission thru oif

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

    oco order submission thru oif

    If I want to go long and set a stop loss and target to go with it - how do I do that in writing an oif?
    Obviously I want to use an oco but if I write multiple lines I get no order submission.

    Code:
    string stoporder = "PLACE;SIM101;FDAX 12-09;SELL;2;LIMIT;5640;0;DAY;OCOID1;IDNAME2;;";
    edit - my mistake - I had made an error in the path file name - on the second string it read***.oif.txt.oif.txt
    Last edited by Mindset; 09-28-2009, 07:41 AM.

    #2
    You need 3 separate OIF files. 1 for your entry. After you are done with your entry than you submit the two others for your stop and target. For those two just place in the same OCO ID for them and they will be paired together.
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Check text

      I want to check the information file to see if I am filled.
      I see the info is in a file in the outgoing file folder eg
      FDAX 12-09Eurex_Sim101_position.txt

      but how do I assess that the word filled is there please?

      Comment


        #4
        Mindset,

        Unfortunately I would not be able to assist you in this regard. You would need to open up the file and parse the text in your external application. How to do that is dependent on what you are using to program the external app.

        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Parse string

          Could you give me syntax for parsing in NT?

          Comment


            #6
            Mindset,

            Suggest you check out this reference sample: http://www.ninjatrader-support2.com/...ead.php?t=3476
            Josh P.NinjaTrader Customer Service

            Comment


              #7
              Thanks Josh

              I am creeping toward my goal v slowly... next item

              I am now trying to assemble my filepath which requires a bit of string manipulation.

              the filepath I want is Cbi.Core.UserDataDir.ToString() + "/outgoing/" which I set as a default and then add
              +InstrumentName,Exchange,AccountID,"_Position";


              In trying to sort this out I have 2 issues

              1. how do I retrieve a symbols exchange name programmatically?
              2. in printing the file path I get added "\" after the userdatadir??
              eg ...NinjaTrader 6.5\/outgoing/ ... so I am unsure if there is an error in my path or if this is a wee bug in NT?
              I should add I get the same 'error" in my incoming.oif path (NinjaTrader 6.5\/incoming/oif) - however that filepath works so I am a little confused.

              Comment


                #8
                1. What is available is in the Instrument class. You will just need to know what the exchange is based on the instrument name. http://www.ninjatrader-support.com/H...mentClass.html

                2. Not sure I follow. You should be using \ slashes not /.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Slashes

                  variables = private string incomingpath = Cbi.Core.UserDataDir.ToString() + "/incomingpath.oif";

                  Print (incomingpath);

                  produces this strange \/ output - see attached

                  if I use +"\incomingpath" - I get an error message about an unrecognized escape sequence.
                  Attached Files
                  Last edited by Mindset; 09-28-2009, 12:33 PM.

                  Comment


                    #10
                    Do this for the escape character:
                    +"\\incomingpath"
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      that doesn't seem to work

                      using "\\" solves the unrecognized escape seq error but Prints "\\" in the Print output.
                      Seems to return the correct string though

                      I am now 90% there with this.
                      Is it possible to call IPosition from within an indicator?
                      if so how do you do it?

                      Comment


                        #12
                        No you cannot call IPosition in an indicator.

                        If you are getting double slashes, just remove it from your string altogether. If the Cbi.directory returns a slash at the end thendon'tadd a second one with your own + "\\...".
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          try this on your machine

                          Code:
                          string outgoingpath = Cbi.Core.UserDataDir.ToString() + "\\outgoing\\"
                          + Instrument.FullName+" Eurex_" + "Sim101_position.txt";
                          
                          if(File.Exists(outgoingpath))
                          	
                          {
                          Print ("File exists");
                          }
                          else
                          {
                          Print("No such file");
                          }
                          if I have any thing other than the above ie double slashes - code does not recognize the file name - how is that for weird?

                          Comment


                            #14
                            Mindset,

                            Whatever gets the job done I suppose.
                            Josh P.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by geotrades1, Today, 10:02 AM
                            1 response
                            4 views
                            0 likes
                            Last Post NinjaTrader_BrandonH  
                            Started by ender_wiggum, Today, 09:50 AM
                            1 response
                            5 views
                            0 likes
                            Last Post NinjaTrader_Gaby  
                            Started by rajendrasubedi2023, Today, 09:50 AM
                            1 response
                            12 views
                            0 likes
                            Last Post NinjaTrader_BrandonH  
                            Started by bmartz, Today, 09:30 AM
                            1 response
                            9 views
                            0 likes
                            Last Post NinjaTrader_Erick  
                            Started by geddyisodin, Today, 05:20 AM
                            3 responses
                            26 views
                            0 likes
                            Last Post NinjaTrader_Gaby  
                            Working...
                            X