Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Switching between long & short positions with X number of counter-tendency bars

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

    Switching between long & short positions with X number of counter-tendency bars

    Good day, great people!

    I'm looking to backtest a strategy that I'm not being able to actually program. I'm using Strategy Builder on a demo account for now, and I would prefer not to unlock code (except if it's needed for what I want to accomplish).

    I would love to have some guidance to make the program enter a short position (closing all the current long orders) if X number of bearish candles appear, and entering in a long position (closing all the current short orders) if X number of bullish candles appear. And it's very important that the configuration adapts to my own chart settings (I clarify this in case this is not done by default: I think it should do that, but I'm not absolutely sure about it).

    I'll look forward to any tips. Thank you so much in advance for your time and effort!

    #2
    Hello Yasharandom,

    Thank you for your inquiry.

    You could create a custom series to use as an event counter. The event in this case would be detecting a bullish (or bearish) candle. You may need two custom series to count these two separate events.

    The forum post linked below has an example script demonstrating using a series to count an event. The event counted is when a fast moving average crosses above a slow.

    Is there a way to increment an int in the strategy builder? When I go to set an int equal to itself there's no way to add 1 to it as well. Just wondering if this is possible in the wizard.


    Please let us know if you have any further questions.

    Comment


      #3
      Hello, Gaby.

      Alright, I'll do so if I need further help. Thanks!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by NullPointStrategies, Yesterday, 05:17 AM
      0 responses
      55 views
      0 likes
      Last Post NullPointStrategies  
      Started by argusthome, 03-08-2026, 10:06 AM
      0 responses
      132 views
      0 likes
      Last Post argusthome  
      Started by NabilKhattabi, 03-06-2026, 11:18 AM
      0 responses
      73 views
      0 likes
      Last Post NabilKhattabi  
      Started by Deep42, 03-06-2026, 12:28 AM
      0 responses
      45 views
      0 likes
      Last Post Deep42
      by Deep42
       
      Started by TheRealMorford, 03-05-2026, 06:15 PM
      0 responses
      49 views
      0 likes
      Last Post TheRealMorford  
      Working...
      X