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

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


                #8
                Thanks for this information. I wanted to transfer funds to https://changehero.io/ exchange platform to buy more crypto. More support for cryptocurrency trading is required.

                Comment


                  #9
                  Thank you guys for this help. I wanted to transfer funds, too, just like incircles said after I've finished understanding the tips on the https://cryptoinformator.com/ webpage that were essential to me. I needed them to gain confidence in these coins, and now I'm ready to proceed. In fact, rn I don't joke with any information concerning crypto or trading, just trying to get as much knowledge of it as possible. I even went ahead to bookmark the News and Announcements forum and keep an eye out for knowledgeable info on there. I'm going to try to use this help now and see if it works; fine, if not, I might then start another thread. You'll see my feedback tho.
                  Last edited by adamspike; 05-12-2021, 01:38 AM.

                  Comment


                    #10
                    Please submit a vote for ticket ID SFT-1422 on my behalf as well. I've run into the issue where its impossible to scale position size due to 1 btc being the minimum qty. Thanks

                    Comment


                      #11
                      Hello cbhayes01,

                      Your vote has been added. I have also tracked votes to our main "full support for crypto currencies" feature request SFT-2334 for those that have wrote in here.
                      JimNinjaTrader Customer Service

                      Comment


                        #12
                        Hi,

                        Is this still an open point? Please submit another vote to ticket ID SFT-1422 on my behalf.

                        Cheers,

                        Comment


                          #13
                          Hello Gorka,

                          I have added votes on your behalf.
                          JimNinjaTrader Customer Service

                          Comment


                            #14
                            Nice, thank you very much

                            Comment


                              #15
                              so which votes are there adding on peoples behalf? what's it all about gees

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by rocketman7, Today, 02:12 AM
                              7 responses
                              28 views
                              0 likes
                              Last Post NinjaTrader_ChelseaB  
                              Started by guillembm, Yesterday, 11:25 AM
                              3 responses
                              16 views
                              0 likes
                              Last Post NinjaTrader_Jesse  
                              Started by junkone, 04-21-2024, 07:17 AM
                              10 responses
                              148 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Started by tsantospinto, 04-12-2024, 07:04 PM
                              6 responses
                              101 views
                              0 likes
                              Last Post tsantospinto  
                              Started by trilliantrader, 04-18-2024, 08:16 AM
                              7 responses
                              28 views
                              0 likes
                              Last Post NinjaTrader_BrandonH  
                              Working...
                              X