fxDreema

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

    Automatic string building for a comment

    Questions & Answers
    2
    3
    924
    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.
    • J
      josecortesllobat last edited by

      Hello

      Please I would need some help to figure out what I would like to build.

      Thanks to @roar I have been able to open several trades using his loop logic suggestion. Thanks to @miro1360 I could add the group number for each trade created by the loop into the "comment" field.

      Then, the logic to open the trades is as follows:

      n_Trades = 10 (loop Will pass 10 times)
      Loop -> Trade1 (Id =1), Trade2 (Id = 2), …, Trade10 (Id = 10)

      n_Trades = n (loop Will pass n times)
      Loop -> Trade1 (Id =1), Trade2 (Id = 2), …, Trade(n-1) (Id = n-1), Trade(n) (Id = n)

      What I would like to have is a block placed in the loop's logic that automatically creates a string that includes all the opened Id trades from the first one to the last one. Something like

      AllOpenIds = (string)Id1","+(string)Id2","+ … +(string)Id(n-1)","+(string)Id(n);

      0_1535615222978_09247e08-bae0-4912-9ed0-8ac5afed0cfb-image.png

      Because the number of trades to be opened is a variable, the string content will also be variable depending on how many trades the loop opens.

      Any help Will be very welcome.

      Thanks

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

        Do you want to append data to commentM3? Because now the value of commentM3 will be whatever the value is set in the last iteration of the loop.

        1 Reply Last reply Reply Quote 0
        • J
          josecortesllobat last edited by

          Hi @fxDreema

          Thanks for your support.

          What I would like to have is a way to automatically create a string to manage the opened trades in blocks like "For each trade".

          As an example. My Project opens (n) trades when the condition to enter at market is met. The loop creates (n) trades labelling each trade with a unique group number using a variable that is modified each time that loop passes:

          0_1535657320695_24fc31a7-4e6d-4d23-9cd4-4493c6ba25c9-image.png

          0_1535657354196_60914612-1b98-42e0-bf04-f4a5a19bd0a9-image.png

          Then, if n = 6 & positionIdBuy = 0, it is opened 6 trades with group numbers: 1,2,3,4,5,6.

          I have created a string for using it in the "Filter by group" field available in blocks like the pink ones to do something depending on the conditions of the trade with the last group number. Like as follows

          0_1535657678837_28e02a0b-33b2-4dac-9b78-4f8797cdaf62-image.png

          0_1535657732401_ff96f6e3-8468-4eeb-afe2-be230db1edf5-image.png

          So, if (n) = 6, "LastTradeNumberBuysM3 = 6". But if the project's logic decides to open 10 trades (n = 10), the variable "LastTradeNumberBuysM3" Will be modified automatically to 10.

          What I would like is to know if it is posible to create automatically a string that includes the group number of all the trades opened by the loop as the loop is ran. Like

          loop pass = 1 -> TradesOpened=(string)positionId1;
          loop pass = 2 -> TradesOpened=(string)positionId1+","+(string)positionId2;
          loop pass = 3 -> TradesOpened=(string)positionId1+","+(string)positionId2+","+(string)positionId3;
          .
          .
          .
          loop pass = (n) -> TradesOpened=(string)positionId1+","+(string)positionId2+","+(string)positionId3+","+…+(string)positionId(n);

          Then, the result string Will be:

          loop pass = 1 -> TradesOpened=1
          loop pass = 2 -> TradesOpened=1,2
          loop pass = 3 -> TradesOpened=1,2,3
          .
          .
          .
          loop pass = (n) -> TradesOpened=1,2,3,...,(n)

          Any suggestion or idea Will be very welcome.

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

          Online Users

          E
          H
          R
          A

          11
          Online

          146.7k
          Users

          22.4k
          Topics

          122.6k
          Posts

          Powered by NodeBB Forums | Contributors