fxDreema

    • Register
    • Login
    • Search
    • Back to the main page
    • Categories
    • Recent
    • Tags
    • Popular
    • Search

    Help please. Double lots every time account grows by...

    Questions & Answers
    2
    7
    211
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • N
      nwvw28 last edited by

      Does anyone know how to do this: I need Every time my account balance increases by 'X' amount then multiply the lots by an 'X' amount.
      Thank you for your help. @l-andorrĂ  if you can help I'd greatly appreciate it.

      1 Reply Last reply Reply Quote 0
      • TipsyWisdom
        TipsyWisdom last edited by TipsyWisdom

        you would need to do a variable modification first based on balance.

        Now create a constant, for what X will be.

        formula, balancevariable + constant = targetvariable

        now check condition, if balance = targetvariable
        (see below)
        modify variable of lot size to be multiplied here now.

        also create a variable for lot size and youll want to x2 it in the same manner as prescribed above.

        surely theres a much better way some genius has around here, but thats how I logically accomplish things

        N 1 Reply Last reply Reply Quote 0
        • N
          nwvw28 last edited by nwvw28

          Chat GPT gives me this information when I asked how to increase lots by X when account balance increases by X amount... Question is how do I create a node 'code' via FXdreema. I've managed to build various bots and I am getting better with using this tool but I have never attempted something like this... How would you accomplish this using FXDreema?

          // Define the initial account balance and lot size
          double initialBalance = AccountBalance();
          double initialLotSize = 0.01; // Modify this value to your desired starting lot size

          // Define the balance increment threshold
          double balanceIncrement = 3000.0;

          //+------------------------------------------------------------------+
          //| |
          //+------------------------------------------------------------------+
          void OnTick()
          {
          double currentBalance = AccountBalance();

          // Check if the balance increased by the threshold amount
          if (currentBalance >= initialBalance + balanceIncrement)
          {
              int lotDigits = MarketInfo(Symbol(), MODE_DIGITS);
              double currentLotSize = NormalizeDouble(initialLotSize * 2.0, lotDigits);
          
              // Modify the lot size with the increased value
              OrderModify(OrderTicket(), OrderOpenPrice(), currentLotSize, OrderTakeProfit(), 0, clrNONE);
              
              // Update the initial balance to the current balance
              initialBalance = currentBalance;
              
              Print("Lot size increased to ", currentLotSize);
          }
          

          }

          1 Reply Last reply Reply Quote 0
          • N
            nwvw28 @TipsyWisdom last edited by nwvw28

            @TipsyWisdom Thanks for your response... Here's what I have built based on how I interpreted what you described. How far off am I? Also see the Chat GPT comment I made below. c8df1380-12da-41f0-bf7b-f8b47349ca8e-image.png fca3cee6-b6a6-4164-a22f-903d3db67410-image.png

            1 Reply Last reply Reply Quote 0
            • TipsyWisdom
              TipsyWisdom last edited by

              looks like youve got the idea man!

              I think the best approach would be a scaled percentage based growth? if you are seeking a target % then your lot sizes could scale at the same % to keep the math simple and reuse the variable

              N 1 Reply Last reply Reply Quote 0
              • TipsyWisdom
                TipsyWisdom last edited by TipsyWisdom

                also, you cant use the orange blocks like that in adjust. You must manually type it. because you can do math in the block using it that way.

                to multiply using balance increment, it'll be "*balanceIncrement" with out the ""

                1 Reply Last reply Reply Quote 0
                • N
                  nwvw28 @TipsyWisdom last edited by

                  @TipsyWisdom I think for now I'll keep it as multiply lots by 'X' if account balance increases by 'X', this just makes more sense to me at the moment. Thanks for pointing out the Orange block in the adjust is not good. So far everything I have tried has not worked, but I'll keep at it. I may continue to ask questions if that's okay.

                  1 Reply Last reply Reply Quote 0
                  • 1 / 1
                  • First post
                    Last post

                  Online Users

                  C
                  S
                  S
                  S
                  A

                  14
                  Online

                  146.7k
                  Users

                  22.4k
                  Topics

                  122.6k
                  Posts

                  Powered by NodeBB Forums | Contributors