Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Variable contract when executing automated trading.

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

    Variable contract when executing automated trading.

    Dear Sir,

    Greetings to you from Malaysia. I need a little help with my automated trading system. Currently I am Buying/Selling 1 contract.

    I need to vary the contract size. Each time I lose I need to double my contract size. However when I win the contract size should be returned to 1.

    Request your goodself to help me with the codes. Thanks

    Kumar

    #2
    Kumar,

    You can check to see if you made a winning or losing trade by checking the Trade class for performance. If it is a winner you can set your quantity to 1, else increment it up for your next trade.

    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Variable contract size

      Hello Josh,

      Greetings from Malaysia. I need to add the variable contract logic into the program, and am not sure on the syntax.

      The logic is very simple: Each time I lose I need to double the contract size, however when I win I need to make the contract size back to 1.

      I understand you said about checking the TRADE CLASS for Perfomance but since I am not very familiar with the syntax i am not able to include it in the program.

      Request your assistance to write the codes for me so I can then embed them in the program and recompile it. Regards

      Kumar.

      Comment


        #4
        Kumar,

        Create your own variable for quantity. Start off at whatever you want it to start off as. Check if your last trade was a winner or loser and then make the appropriate changes to your quantity variable. Then submit new orders.

        Please look at any of the already installed indicators you have in NinjaTrader to see how to use variables.
        Josh P.NinjaTrader Customer Service

        Comment


          #5
          Originally posted by NinjaTrader_Josh View Post
          Kumar,

          You can check to see if you made a winning or losing trade by checking the Trade class for performance. If it is a winner you can set your quantity to 1, else increment it up for your next trade.

          http://www.ninjatrader-support.com/H...radeClass.html
          Could you please show me an example. Cheersmate.

          Comment


            #6
            Unfortunately we're not aware of a specific sample for your situation, but for a general idea you can check out this one - http://www.ninjatrader-support2.com/...ead.php?t=4084

            And this thread - http://www.ninjatrader-support2.com/...ad.php?t=11614
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Originally posted by kumarkar88 View Post
              Hello Josh,

              Greetings from Malaysia. I need to add the variable contract logic into the program, and am not sure on the syntax.

              The logic is very simple: Each time I lose I need to double the contract size, however when I win I need to make the contract size back to 1.

              I understand you said about checking the TRADE CLASS for Perfomance but since I am not very familiar with the syntax i am not able to include it in the program.

              Request your assistance to write the codes for me so I can then embed them in the program and recompile it. Regards

              Kumar.

              Dear Sir,

              Greetings to you sir from Malaysia. I have a small logic and need to translate it into C#


              If my previous trade is successful
              Then DEFAULT-QTY = 1
              else
              DEFAULT-QTY = DEFAULT-QTY x 2.


              I was told that I should check the TRADE CLASS to ascertain if my earlier trade was successful. Would appreciated your guidance as it would take me about 20flying hours for me to get to your office.

              Cheersmate.
              Kumar
              Tel: 60196644285

              Comment


                #8
                Kumar,

                If you wish for custom programming services please consider one of the 3rd party NinjaScript Consultants here: http://www.ninjatrader.com/webnew/pa...injaScript.htm

                Unfortunately we do not offer this service directly. For Trade class, you would want to take a look at the Help Guide articles on it for how to use it in your code: http://www.ninjatrader-support.com/H...radeClass.html
                Please look at the example in the article. All you need to do is look at that variable for lastProfit. If its positive then the trade was a winner, otherwise its a loser.

                There is a reference sample demonstrating the concept here: http://www.ninjatrader-support2.com/...ead.php?t=4084
                Josh P.NinjaTrader Customer Service

                Comment

                Latest Posts

                Collapse

                Topics Statistics Last Post
                Started by helpwanted, Today, 03:06 AM
                1 response
                10 views
                0 likes
                Last Post sarafuenonly123  
                Started by Brevo, Today, 01:45 AM
                0 responses
                9 views
                0 likes
                Last Post Brevo
                by Brevo
                 
                Started by aussugardefender, Today, 01:07 AM
                0 responses
                5 views
                0 likes
                Last Post aussugardefender  
                Started by pvincent, 06-23-2022, 12:53 PM
                14 responses
                242 views
                0 likes
                Last Post Nyman
                by Nyman
                 
                Started by TraderG23, 12-08-2023, 07:56 AM
                9 responses
                387 views
                1 like
                Last Post Gavini
                by Gavini
                 
                Working...
                X