Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy Time Not Working

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

    Strategy Time Not Working

    Hello

    I created a strategy using Strategy Builder and it is OK but I wanted to add a time line so it only trades after or before time, when I add this, the strategy stops working. Could you please let me know if I'm doing this right? in the conditions, I selected the following: time > Time series > grater > Time > time series > time 7:30AM (I want to start trading after 7:30 until 1:00PM) to end it I select all the same as before except that I add LESS and the time 1:00PM.

    Is this correct? am I missing anything? the strategy doesn't work with when I add this.

    Thanks for your help

    Mathias

    #2
    Sorry... I mean Time Value when I add the time, so it will be like this "Time > Time series > grater > Time > time value > time 7:30AM and Time > Time series > less> Time > time value > time 1:00PM"

    Comment


      #4
      ​I looked at your stuff and what you have is exactly what I did (Time Value when I add the time, so it will be like this "Time > Time series > grater > Time > time value > time 7:30AM and Time > Time series > less> Time > time value > time 1:00PM")
      do you know what could be happening that the strategy wouldn't work? When I take the time our of it, the strategy works just fine

      Comment


        #5
        Hello Mathias79,

        Because I don't know exactly what you put in the script, I wouldn't be able to provide any direction.
        Imagine a mechanic attempting to provide advice on fixing a car without seeing the car or being provided any details about specifically what configuration is producing unexpected behavior.
        The user is saying the car doesn't work, but isn't saying what isn't working. The mechanic can't really provide any direction without investigating why the unexpected behavior is occuring.


        Are you finding the examples I've provided are not performing as described?
        Have you started with a working example and made modifications to it?


        If the expected trade(s) are not appearing, this would indicate that the condition to place the order is not evaluating as true and the order is not being submitted, or the order is being ignored for other reasons, or the order is being cancelled or rejected.

        To understand why the script is behaving as it is, such as placing orders or not placing orders or drawing objects when expected, it is necessary to add prints to the script that print the values used for the logic of the script to understand how the script is evaluating.

        In the strategy add prints (outside of any conditions) that print the date time of the bar and all values compared in every condition that triggers the action.
        The prints should include the time of the bar and should print all values from all variables and all hard coded values in all conditions that must evaluate as true for this action to be triggered. It is very important to include a text label for each value and for each comparison operator in the print to understand what is being compared in the condition sets.
        The debugging print output should clearly show what the condition is, what time the conditions are being compared, all values being compared, and how they are being compared.

        Prints will appear in the NinjaScript Output window (New > NinjaScript Output window).

        Further, enable TraceOrders which will let us know if any orders are being ignored and not being submitted when the condition to place the orders is evaluating as true.
        After enabling TraceOrders remove the instance of the strategy from the Configured list in the Strategies window and add a new instance of the strategy from the Available list.
        Last, print the order.ToString() at the top of the OnOrderUpdate() override, as this will show us when orders become working and are being filled, and print the GetCurrentAsk() and GetCurrentBid() in OnOrderUpdate() as well so we can see what the market price is at the time of a fill.

        I am happy to assist you with analyzing the output from the output window.

        Run or backtest the script and when the output from the output window appears save this by right-clicking the output window and selecting Save As... -> give the output file a name and save -> then attach the output text file to your reply.

        Below is a link to a support article that demonstrates using informative prints to understand behavior and includes a link to a video recorded using the Strategy Builder to add prints.


        Let me know the date and time the behavior occurred or when you are expecting the behavior to occur.

        Please let me know if I may further assist with analyzing the output or if you need any assistance creating a print or enabling TraceOrders.​
        Chelsea B.NinjaTrader Customer Service

        Comment


          #6
          thank you for your response, I understand that is hard to help without details of what I'm doing. I will do everything you tell me... what I think is odd is that the strategy works very well until I just add this "Time Value when I add the time, so it will be like this "Time > Time series > grater > Time > time value > time 7:30AM and Time > Time series > less> Time > time value > time 1:00PM"

          I was hoping you could tell that maybe I was missing something else to make the time condition work. I read something saying that I needed to add State = State.Realtime, that didn't work.

          Comment


            #7
            Hello Mathias79,

            The State wouldn't be involved with a time condition.

            Time greater than 7:30 AM and less than 1:00 PM would evaluate as true for any bars with the time greater than 7:30 AM and less than 1:00 PM.

            If those are the only two conditions in the condition set, I would expect that they were not properly implemented.

            However, it would just be guessing if you don't provide the debugging print output. Without the debugging print output there would not be a way to confirm the behavior.
            Chelsea B.NinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by ybforex, 03-11-2025, 05:30 PM
            12 responses
            101 views
            0 likes
            Last Post rockmanx00  
            Started by forgebench, Today, 02:22 PM
            2 responses
            9 views
            0 likes
            Last Post forgebench  
            Started by MamaKB, 02-14-2025, 03:38 PM
            10 responses
            84 views
            0 likes
            Last Post Fertryd2  
            Started by Irukandji, Today, 03:46 PM
            0 responses
            7 views
            0 likes
            Last Post Irukandji  
            Started by HappyTrader76, Yesterday, 04:14 PM
            8 responses
            48 views
            0 likes
            Last Post HappyTrader76  
            Working...
            X