Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Eixt on MultiTimeFrame

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

    Eixt on MultiTimeFrame

    Hi,
    I try to exit an automated strategy after a certain percentage of profit on a smaller time frame than the strategy trading logic. It works in backtesting, but not in market replay.
    Could you give me an idea what's wrong with the code?
    Thanks
    Attached Files

    #2
    Hello moon_121,

    Thank you for your post.

    I have tested your strategy in Market Replay and it appears to be running correctly. Can you provide additional details on what is occurring on your end?

    Are there errors on the Log tab of the Control Center? If so, what do these errors report?

    I look forward to your response.

    Comment


      #3
      Hi Patrick,
      the strategy disables itself in market replay just after i enabled it. The output window shows, that the strategy confuses the historical trades with the real ones and assumes, that the strategy was already profitable.
      I already changed "Performance.AllTrades". to "Performance.RealtimeTrades." but the result is the same.

      Comment


        #4
        Hello moon_121,

        Thank you for your response.

        Please add a Historical check in your code at the beginning of the OnBarUpdate() method and advise if this resolves the matter.
        Code:
        protected override void OnBarUpdate()
        {
        if(Historical)
        return;

        Comment


          #5
          All clear

          OK, that seems to work fine. Thanks for the help!
          If you find the time: Could you tell me please why one needs the historical data exclusion in this strategy and not on every strategy? Is there something odd with the code?

          Comment


            #6
            Hello moon_121,

            Thank you for your response.

            The reason in this case we do not want to calculate on historical data is so that historical trades are not placed.

            if (Historical) return; can be used to ensure your calculations do not place historical trades.

            Please let me know if you have any questions.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            23 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            20 views
            0 likes
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            14 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Started by TheRealMorford, 03-05-2026, 06:15 PM
            0 responses
            10 views
            0 likes
            Last Post TheRealMorford  
            Started by Mindset, 02-28-2026, 06:16 AM
            0 responses
            41 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Working...
            X