Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Timefilter

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

    Timefilter

    i can not manage it to limit a time filter. I can set a starting point but the end point is not respected. Like in this basic expression:

    // Set 1
    if ((Times[0][0].TimeOfDay > new TimeSpan(17, 1, 0))
    && (GetCurrentAsk(0) > EMA1[0])
    && (Times[0][0].TimeOfDay < new TimeSpan(20, 0, 0)))
    {
    EnterLong(Convert.ToInt32(DefaultQuantity), "");
    }


    what am i doing wrong?

    #2
    Hello smk200, thanks for your note.

    I made a clone script that works. Please see attached. Could you test this on your end and compare it with your custom script?

    I look forward to assisting.
    Attached Files

    Comment


      #3
      Hi,

      thank you for answer. i have tested your file but the end is not respected as well. i would be verry happy if you could if you find a solution.

      Comment


        #4
        Hello, thanks for your reply.

        Could you let me know what instrument, bar type, and bar period you are using to test?

        I look forward to hearing from you.

        Comment


          #5
          i tested several futures in various periods. bar type is probably candlestick

          Comment


            #6
            Hello smk200, thanks for your reply.

            I am testing on a 1 minute ES 03-21 chart. Please add a Print statement to your script for debugging purposes. Printing the Times[0][0] value in your entry condition to print the time when the condition is true:

            if ((Times[0][0].TimeOfDay > new TimeSpan(17, 1, 0))
            && (GetCurrentAsk(0) > EMA1[0])
            && (Times[0][0].TimeOfDay < new TimeSpan(20, 0, 0)))
            {
            Print(Times[0][0]);
            EnterLong(Convert.ToInt32(DefaultQuantity), "");
            }

            The Print method can be found in the Misc folder in the actions. If you are seeing a time outside of the conditions printing I could take a look at your script if you Export it and post it here.

            Another good addition to the condition will be a check for Position.MarketPosition = MarketPosition.Flat so the strategy is not entering when already long e.g.



            I look forward to assisting.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by Mindset, 04-21-2026, 06:46 AM
            0 responses
            89 views
            0 likes
            Last Post Mindset
            by Mindset
             
            Started by M4ndoo, 04-20-2026, 05:21 PM
            0 responses
            135 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by M4ndoo, 04-19-2026, 05:54 PM
            0 responses
            68 views
            0 likes
            Last Post M4ndoo
            by M4ndoo
             
            Started by cmoran13, 04-16-2026, 01:02 PM
            0 responses
            119 views
            0 likes
            Last Post cmoran13  
            Started by PaulMohn, 04-10-2026, 11:11 AM
            0 responses
            69 views
            0 likes
            Last Post PaulMohn  
            Working...
            X