Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

startegy do not like live data

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

    startegy do not like live data

    Hi,

    here whats going on:
    this simple strategy crerated in Wizard works in Strategy Analyzer, there is no problem, everything is ok. However, when I want to use it with live data - it just refuses to do anything.
    In a Log tab there is nothing about this startegy.
    Any idea why its happening?

    Regards


    protectedoverridevoid Initialize()
    {
    SetProfitTarget(
    "", CalculationMode.Ticks, 20);
    SetStopLoss(
    "", CalculationMode.Ticks, 20, false);
    TraceOrders =
    true;
    CalculateOnBarClose =
    false;
    }
    protectedoverridevoid OnBarUpdate()
    {
    if (ToTime(Time[0]) >= 94500 && ToTime(Time[0]) <= 160000)

    {
    if (CrossAbove(CyberCycle(0.07).CyclePlot, CyberCycle(0.07).TriggerPlot, 1))
    {
    EnterLong(
    1, "");
    }
    if (CrossBelow(CyberCycle(0.07).CyclePlot, CyberCycle(0.07).TriggerPlot, 1))
    {
    EnterShort(
    1, "");
    }}}

    P.S. In case you want to check it on your end I attach zip file.
    Attached Files

    #2
    When you run it in realtime it won't do anything until your strategy conditions are true. It needs to evaluate those conditions or else it won't do anything. If you want to see what it is doing you will just need to debug it.

    Please see these tips: http://www.ninjatrader-support2.com/...ead.php?t=3418
    Josh P.NinjaTrader Customer Service

    Comment


      #3
      Hi,

      I use this strategy on 1 min time period, so my conditions are met at least once every 15 minutes. As you can see on a code I post below, I use traceorder and it does not print anything in output window.

      Regards

      Comment


        #4
        Hi Kowal,

        Please see this link - http://www.ninjatrader-support.com/H...eV6/Print.html

        Then incorporate Print() statements into your strategy, to see if your conditions trigger realtime, also consider changing your CalculateOnBarClose setting, which you set to False in your Initialize().
        BertrandNinjaTrader Customer Service

        Comment


          #5
          Hi,

          I did as You suggested - set CalculateOnBarClose on true instead false and strategy started to work. Thanks.
          Now question is: how to make it run with both settings?

          Regards

          Comment


            #6
            Hi Kowal,

            You will need to debug with Print() statements and the TraceOrders what your strategy is doing differently then.

            What do you hope to achieve with CalculateOnBarClose = False?

            For more granular intrabar testing, please see this link - http://www.ninjatrader-support2.com/...ead.php?t=6652
            BertrandNinjaTrader Customer Service

            Comment


              #7
              Hi Bertrand,

              I am trying to achieve my strategy working. It really bothers me when sth is wrong and I have no clue whats going on, so I apreciate your help.
              I use TraceOrders and Print commands. With "false" setting output window does not show anything. There is a big nothing. Like I wrote before, with "true" setting everything is tip-top.

              Regards

              Comment


                #8
                If it works with it on false, but does not work with it true it is some runtime error you are experiencing. You will need to find the source of this or figure out the behavior. Look in the Control Center logs for errors. Also, just add a Print() at the top of your OnBarUpdate(). This will let you know it is processing. If you know it is processing then you just need to slowly step through your strategy and find where it is getting caught up in.
                Josh P.NinjaTrader Customer Service

                Comment


                  #9
                  Thanks for your quick reply.
                  I add Print () on top of OnBarUpdate() as you suggested and now I can see "Bar update" from top to bottom in my output window - sign its proccesing.
                  ;-)
                  There is no any errors in Logs.
                  Code is very short and simple so I do not know how to look at it any closer.

                  protectedoverridevoid Initialize()
                  {SetProfitTarget(
                  "", CalculationMode.Ticks, 20);
                  SetStopLoss(
                  "", CalculationMode.Ticks, 20, false);
                  TraceOrders =
                  true;
                  CalculateOnBarClose =
                  false;
                  Add(TRIX2(
                  3, 4.5, 3.75));}
                  protectedoverridevoid OnBarUpdate()
                  {
                  Print(
                  "Bar update - test");

                  if (ToTime(Time[0]) >= 94500 && ToTime(Time[0]) <= 160000)
                  {
                  if (CrossAbove(TRIX2(3, 4.5, 3.75).TRIXLine1, TRIX2(3, 4.5, 3.75).SignalLine2, 1))
                  {

                  EnterLong(
                  1, "Buy");
                  Print(
                  "TrixLine1 Above");
                  }
                  }}

                  Comment


                    #10
                    And no prints of "TrixLine1 Above"? If that is the case then you need to start adding prints above your conditions to see if they are even suppose to be evaluated to true. Print out the values of your TRIX lines before the if-statement. Also print out your Time[0] values before the time if-statement.
                    Josh P.NinjaTrader Customer Service

                    Comment


                      #11
                      Hi,

                      we have a progress!
                      I added Print "values of Trix2" the before if - statement and it gives me a round zero. Two zeros for both: TrixLine1 and SignalLine2.
                      This happens with CalculateOnBarClose = "false", with "true" works great (checked).
                      Great, great, now I know where the problem is but...I have to admit I have no clue how to fix it and make it work.
                      Thanks for advices! and for your patience too.

                      Comment


                        #12
                        Please go to your indicator and check if you have a CalculateOnBarClose line in your Initialize() method. If you do remove that line and try again. This is a known bug.
                        Josh P.NinjaTrader Customer Service

                        Comment


                          #13
                          hmm,

                          I removed this line from indicator. Now outputs are:
                          TrixLine1 = -10
                          SignalLine2 = 0
                          and they are constant.
                          At least I dont have two zeros :-)

                          Comment


                            #14
                            Kowal,

                            You will need to debug your indicator and strategy slowly. Isolate one thing at a time. Print from the indicator and from the strategy. Find where it is getting caught up. Unfortunately I cannot debug this for you because we just do not have enough bandwidth.
                            Josh P.NinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by yertle, Yesterday, 08:38 AM
                            7 responses
                            28 views
                            0 likes
                            Last Post yertle
                            by yertle
                             
                            Started by bmartz, 03-12-2024, 06:12 AM
                            2 responses
                            20 views
                            0 likes
                            Last Post bmartz
                            by bmartz
                             
                            Started by funk10101, Today, 12:02 AM
                            0 responses
                            4 views
                            0 likes
                            Last Post funk10101  
                            Started by gravdigaz6, Yesterday, 11:40 PM
                            1 response
                            8 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Started by MarianApalaghiei, Yesterday, 10:49 PM
                            3 responses
                            10 views
                            0 likes
                            Last Post NinjaTrader_Manfred  
                            Working...
                            X