• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Default Quantity Bitcoin Strategy

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

    Default Quantity Bitcoin Strategy

    Entry orders require a default quantity which is an integer. That makes sense for non-crypto assets. How do I create a buy order using fiat amount such as $100 instead of 1 which is 1 Bitcoin.

    Thanks

    #2
    Hello Mike,

    Thanks for your post.

    You can calculate quantity for the order submission to take the price you want to pay and divide it by the price of the asset. This will give you the quantity that you could purchase for that asset. I would then suggest to use Math.Floor to ensure that you are never buying more than intended.

    For example:
    Code:
            protected override void OnBarUpdate()
            {            
                double amt = 100 / Close[0];
                int qty = (int)Math.Floor(amt);
    
                EnterLong(qty);
            }
    Since order methods only take an integer for quantity, there would not be a way to provide a fractional value for quantity.

    Please let us know if we can be of further assistance
    JimNinjaTrader Customer Service

    Comment


      #3
      Thanks.
      I follow you but don't see how that does the job. EnterLong requires and integer type for quantity. Let's say Bitcoin is at 10,000. So, using your method, 100/10000 =.01 which is a double. Then use the floor(.01) = 0. Convert 0 to int and your left with 0 for qty. What am I missing?

      By the way, I tried your code but it produced the same result as using 1.
      Last edited by Mike Winfrey; 07-23-2019, 01:18 PM.

      Comment


        #4
        For Crytocurrency trading it would be nice is the default quantity could be set to be satoshi as opposed to 1 coin. I don't know anyone who trades based on the number of coins. its almost always a fraction of a coin even for those coins valued less than $1. Bottom line is default quantity needs to be a double instead on int. That solves the problem.

        Comment


          #5
          Hello Mike,

          There currently is not a way to submit order quantities with a fractional value. Support for this is being considered with the ticket ID SFT-1422. I have submitted a vote on your behalf. We cannot offer an ETA or promise of fulfillment, but this would be a requirement for full CryptoCurrency support in the future, which is not available at this time.

          Numbers for ticket ID's will be noted in the Release Notes page of the Help Guide when implemented.

          Release Notes - https://ninjatrader.com/support/help...ease_notes.htm

          When I test this snippet, I always get 0 for qty, and no order is submitted. I may suggest recompiling to ensure changes are applied and maybe also to add prints to confirm what is being sent for the order method's quantity.

          Let me know if you have any additional questions.
          JimNinjaTrader Customer Service

          Comment


            #6
            Exactly, 0 is what I get as well.

            Big shucks that I have to trade cryptocurrency with by the coin. LOL Seems that wasn't thought through very well. Really, for anyone trading cryptocurrency that's an obvious requirement. Regardless, i look forward to that being included. Will I be notified directly or just need to keep checking and how do i do that?

            Thanks

            Comment


              #7
              Hello Mike,

              Numbers for ticket ID's will be listed under release notes, but as this would be an integral part of Crypto Currency trading, there will likely be large announcements made when more support is added and partial quantities are supported too.

              You could subscribe to the News and Announcements forum and keep an eye out for information there, but again, I could not say anything regarding ETA's or any progress behind this.

              If there is anything else we can do to help, please let us know.
              JimNinjaTrader Customer Service

              Comment

              Latest Posts

              Collapse

              Topics Statistics Last Post
              Started by stefanjagger, Today, 07:47 AM
              1 response
              9 views
              0 likes
              Last Post stefanjagger  
              Started by tonynt, Today, 07:07 AM
              1 response
              7 views
              0 likes
              Last Post tonynt
              by tonynt
               
              Started by Marklhc1988, Today, 06:53 AM
              3 responses
              10 views
              0 likes
              Last Post NinjaTrader_PatrickG  
              Started by ntbone, Today, 12:05 AM
              0 responses
              10 views
              0 likes
              Last Post ntbone
              by ntbone
               
              Started by cutzpr, Yesterday, 09:33 PM
              1 response
              13 views
              0 likes
              Last Post NinjaTrader_ChelseaB  
              Working...
              X