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

multi instrument

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

    multi instrument

    Hallo
    this must have a quick answer

    i try to add more than one instruments and while
    Add( "YM" , PeriodType.Minute , 1 );

    works, when i use

    Add( "FDAX" , PeriodType.Minute , 1 );
    Add( "6E" , PeriodType.Minute , 1 );

    it doesn't
    i guess "FDAX" 6E" are wrong
    Where should i find the right names ?

    #2
    Hi yoyager, please add the expiry for futures contracts as well like shown here - http://www.ninjatrader-support.com/H...deV6/Add1.html

    So FDAX 12-09, 6E 12-09 or YM 12-09...with just YM I guess you grabbed a stock named this way...
    BertrandNinjaTrader Customer Service

    Comment


      #3
      Thank you Bertrand


      another quickie:
      (1,4742 - 1,4736) gives 0,000600000000000378

      how comes that ??
      Thanks

      Comment


        #4



        you may use decimal variables to reduce the error:

        By casting:

        (decimal)1.4742 - (decimal)1.4736 = 0.0006

        or

        1.4742M - 1.4736M

        or

        decimal num1 = 1.4742M;
        decimal num2 = 1.4736M;
        decimal result = num1-num2;

        ... etc

        (Calculate with decimal variables requires more resources)

        Greetings

        Comment


          #5
          thanks cls71

          Comment


            #6
            sorry but i tried the above but couldn't fix the problem

            I wonder how anyone that makes an indicator or strategy
            that works on e.g. EURUSD deal with it.

            Maby a topic should be created to illustrate the best way to design
            an indicator

            (i tried : Close[0]-entryOrder.AvgFillPrice )

            Thanks again

            Comment


              #7
              is there any way to adjust the floating point Precision to less digits once for all ???

              Comment


                #8
                voyager, I'm not sure I folow, it will depend on the type of variable you use to store your data.

                I think this tipe here deals with the issues you're running into - http://www.ninjatrader-support2.com/...ead.php?t=3929
                BertrandNinjaTrader Customer Service

                Comment


                  #9
                  when i try this:

                  Print (Close[0]-entryOrder.AvgFillPrice);

                  where Close[0] is 1.4762 and entryOrder.AvgFillPrice is 1,4757 it gives
                  -4,99999999999945 instead of -5.

                  so i guess if i had e.g. :
                  if( Close[0]-entryOrder.AvgFillPrice >= 5 ){ }

                  that would not work while it should
                  Thanks for your time

                  Comment


                    #10
                    Hi Voyager,

                    another solution for your problem is to calculate with integers:

                    int intClose = Close[0] / TickSize;
                    int intAvgFillPrice = entryOrder.AvgFillPrice / TickSize;

                    Regards
                    Ralph

                    Comment


                      #11
                      i tried it as

                      int intClose = Convert.ToInt32(1.4742 / TickSize);
                      int intAvgFillPrice = Convert.ToInt32(1.4736 / TickSize);

                      Print( intClose - intAvgFillPrice );

                      and it works

                      Thanks to all

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by kaywai, 09-01-2023, 08:44 PM
                      5 responses
                      601 views
                      0 likes
                      Last Post NinjaTrader_Jason  
                      Started by xiinteractive, 04-09-2024, 08:08 AM
                      6 responses
                      22 views
                      0 likes
                      Last Post xiinteractive  
                      Started by Pattontje, Yesterday, 02:10 PM
                      2 responses
                      16 views
                      0 likes
                      Last Post Pattontje  
                      Started by flybuzz, 04-21-2024, 04:07 PM
                      17 responses
                      230 views
                      0 likes
                      Last Post TradingLoss  
                      Started by agclub, 04-21-2024, 08:57 PM
                      3 responses
                      17 views
                      0 likes
                      Last Post TradingLoss  
                      Working...
                      X