Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Latest bar low stop loss

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

    Latest bar low stop loss

    Hi,
    I want to test my strategy with builder using dynamically defined stop loss and take profit and market conditions change, when i enter long position I want to set a stop loss on the bottom of the low price of the latest 10 bars (example), in the builder I defined two variable, the first one is to get which bar have the lowest low in the last 10 bars, for that, I use builder's lowest Bar function, it gives me the right information ie. the the bar that have the lowest low wick

    Then i want to use the bar number to get the low price to set the stop loss, the issue is if I use the low function, the parameter bar ago (to add the previous information) is static only and cannot accept variable

    So in this case how I can set the stop loss/take profit dynamically when I enter the trade with builder only ?

    Thanks



    #2
    Hello bourasrafik,

    Thank you for your post.

    In the Strategy Builder, the Stops and Targets found in the Stops and Targets screen cannot be set dynamically - this is a limitation of the Strategy Builder. Instead, you would need to use Exit orders in sets in the Conditions and Actions screen.

    I've attached some examples of submitting stops dynamically using Exit orders in the Strategy Builder - these also demonstrate modifying those stops to either create a trailing or breakeven functionality as well as demonstrate keeping those orders alive.

    Please let us know if we may be of further assistance to you.
    Attached Files

    Comment


      #3
      Hi Kate,
      Thanks for the answer,
      I checked the examples but it does not fit into my need, as explained, When I decide to enter into position I need to loolback 10 bars before and get the low price at this bar, I can get in the builder using the ​lowestbar function but I need to get the price of this previous bar using the getLow function.

      the NT example show how to do it :

      protectedoverridevoidOnRender(ChartControlchartControl,ChartScalechartS cale)
      {
      base.OnRender(chartControl,chartScale);
      // loop through only the rendered bars on the chart
      for(intbarIndex=ChartBars.FromIndex;barIndex<=ChartBars.T oIndex;barIndex++)
      {
      // get the low price at the selected bar index value
      doublelowPrice=Bars.GetLow(barIndex); <---------------------------------------------HERE
      Print("Bar #"+barIndex+" low price is "+lowPrice);
      }
      }

      The issue that I do not find this function in the builder and only Low function exists and it only accepts a numeral value as parameters and not a variable (see attached picture)

      How can I workaround this limitation without falling to the dark side and start to code directly ?

      Thanks

      Comment


        #4
        Hello bourasrafik,

        Thank you for your reply.

        Not really possible with the Strategy Builder, unfortunately. While you can get the bars ago that the lowest bar is, you can't save that to a variable and use that as BarsAgo to get the low because you can't use a variable for the BarsAgo value for Low. You would have to unlock your code and manually add logic to get the low:



        Please let us know if we may be of further assistance to you.

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by NullPointStrategies, Today, 05:17 AM
        0 responses
        50 views
        0 likes
        Last Post NullPointStrategies  
        Started by argusthome, 03-08-2026, 10:06 AM
        0 responses
        126 views
        0 likes
        Last Post argusthome  
        Started by NabilKhattabi, 03-06-2026, 11:18 AM
        0 responses
        69 views
        0 likes
        Last Post NabilKhattabi  
        Started by Deep42, 03-06-2026, 12:28 AM
        0 responses
        42 views
        0 likes
        Last Post Deep42
        by Deep42
         
        Started by TheRealMorford, 03-05-2026, 06:15 PM
        0 responses
        46 views
        0 likes
        Last Post TheRealMorford  
        Working...
        X