• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

truble with entering at first 4 bar od session

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

    truble with entering at first 4 bar od session

    Hi,

    I'm new at the programming at nt8 and I success to built some strategies with a big help from you.
    I have a problem: I built a strategy that check the first 4 bars of session and it's need to get long.
    When I run backtest everything was fine, when I check it on real time then I got no trades (few stocks should get the trade).
    what am I doing wrong?

    I really hope you can help me, I didn't sleep for two days....

    this is a part of the code:
    **I check the open of this day and the close of last day
    **time frame is minute


    private PriorDayOHLC priorDayClose;

    //instead the default at section of
    if (State == State.SetDefaults)
    BarsRequiredToTrade = 1;

    //in the section of
    else if (State == State.DataLoaded)

    priorDayClose = PriorDayOHLC();

    //part of the logic
    if (Bars.BarsSinceNewTradingDay == 3 && (Open[3] > priorDayClose.PriorClose[0] )

    //entry
    EnterLongLimit(250,GetCurrentBid());




    #2
    Hello assik,
    Thanks for your post.

    Are there any errors on the Logs tab of your Control Center? If so, what does the error say?

    What color is the strategy on your Strategiers tab whenever you are runnng it on realtime? (ie. Green, Orange, or Black)
    https://ninjatrader.com/support/help...eStrategiesTab

    If you check the strategies historical performance when running on real-time do you see that it took any trades?
    https://ninjatrader.com/support/help...egyPerformance

    What does TraceOrders report whenever you turn it on inside State.SetDefaults?
    https://ninjatrader.com/support/help...aceorders2.htm
    JoshNinjaTrader Customer Service

    Comment


      #3
      Hi Josh,

      Logs tab - I don't have any errors at the beginning, only after 10:00 (the strategy check the first bar, 9:00).
      color - green
      historical performance - yes, I see trades
      TraceOrders - I don't understand what it means. do you want me to add it to the strategy and check it tomorrow?

      Comment


        #4
        assik,

        It sounds like logic simply isnt executing the way you expect it to. Have you added Print() statements to your strategy and also confirmed on the chart that the strategy met the conditions for your entry? Can you show me the output from your Print()?
        https://ninjatrader.com/support/help...script_cod.htm

        I do suggest turning on TraceOrders anytime you need to debug your strategies orders. TraceOrders will let us track your orders to see if they are being placed, changed, rejected, etc. More information can be found inside the help guide link from my Post #2
        JoshNinjaTrader Customer Service

        Comment


          #5
          Hi,

          I cant show you the output but I check it and the parameters works fine in the backtest.
          maybe I cant get to a position because of my order?
          can I send you my strategy?

          Comment


            #6
            assik,

            I would not be able to debug this script for you.

            A common issue that we see is that the strategy is taking some behaviors differently between historical and realtime data and all of the nuances behind strategy behaviors are not fully understood.

            If you are seeing your order submission logic being reached with your Print() statements, but it is not executing, there may be an issue where the strategy is already in a virtual position that is not allowing you to re-enter. TraceOrders can be enabled in the strategy so it prints its order feedback, and you may also observe the log tab of the Control Center for additional hints.

            Some items to check when you are taking debugging steps:
            1. Are your conditions allowing your order submission methods to be reached? You would use Print() to verify this.
            2. Is the strategy currently in a position that is preventing it from submitting another entry order?
            3. Do you see any errors in the log tab of the Control Center or does Trace Orders give you any feedback?
            I am happy to help intrepet any oputput you receive during your debugging.

            Below are links to documentation resources that further explain Discrepancies between Historical and Realtime data, Start Behaviors, and the internal rules of the Managed Approach.

            Discrepancies between historical and Realtime data - https://ninjatrader.com/support/help...ime_vs_bac.htm
            Start Behaviors - https://ninjatrader.com/support/help..._positions.htm
            Managed Approach (Internal Rules) - https://ninjatrader.com/support/help...antedPositions
            Strategy Position vs. Account Position - https://ninjatrader.com/support/help..._account_p.htm
            JoshNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by roblogic, Yesterday, 04:06 AM
            1 response
            10 views
            0 likes
            Last Post koganam
            by koganam
             
            Started by nepenthean, Today, 08:01 AM
            0 responses
            7 views
            0 likes
            Last Post nepenthean  
            Started by bxl2019, Today, 07:59 AM
            0 responses
            4 views
            0 likes
            Last Post bxl2019
            by bxl2019
             
            Started by tcfcigvo, Yesterday, 11:39 PM
            0 responses
            8 views
            0 likes
            Last Post tcfcigvo  
            Started by BobbyWan, Yesterday, 09:15 PM
            0 responses
            11 views
            0 likes
            Last Post BobbyWan  
            Working...
            X