Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Strategy is showing print during historical but not in live

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

    Strategy is showing print during historical but not in live

    The particular "print"statement is showing up during historical but not during live.

    CBOC is set to false. What is wrong with the code?

    if(
    (
    (Math.Abs(latestTickTBC4LongSignal - latestTickBV3DownExhaustion) <= tickTBBVLEDVicinity &&
    Math.Max(latestTickTBC4LongSignal,latestTickBV3Dow nExhaustion) == (CurrentBars[0]-stratTBBVLEDEnterBar) &&
    latestTickTBC4LongSignal > latestTickBV3DownExhaustion) ||
    (Math.Abs(latestTickTBC4LongSignal - latestTickBV3LongSignal) <= tickTBBVLEDVicinity &&
    Math.Max(latestTickTBC4LongSignal,latestTickBV3Lon gSignal) == (CurrentBars[0]-stratTBBVLEDEnterBar) &&
    latestTickTBC4LongSignal > latestTickBV3LongSignal)
    )
    &&
    stratBiasSetting > -1 &&
    lastBVLEDLongSignal !=CurrentBars[0]-stratTBBVLEDEnterBar
    )
    {
    int i = CurrentBars[0] - latestTickBV3DownExhaustion;
    int j = CurrentBars[0] - latestTickTBC4LongSignal;
    string timestamp1 = Convert.ToString(Times[0][i]);
    string timestamp2 = Convert.ToString(Times[0][j]);
    double pricestamp = Closes[0][0];
    int trendAge = tB.IndTBTrendDuration[0];
    double currentLowOfDay = CurrentDayOHL().CurrentLow[0];
    Print("BIPLongBV3 "+timestamp1+" LED "+timestamp2+" Price "+pricestamp+" trendAge "+trendAge+" CurrentDLow "+currentLowOfDay);
    stratBVLEDInternalBias = 1;
    lastBVLEDLongSignal = CurrentBars[0]-stratTBBVLEDEnterBar;
    }

    #2
    Hello wwteo,

    Thank you for your post.

    What is the primary bar series the indicator or strategy is applied to? When applying the indicator or strategy to a chart, what period type and interval is selected for the chart? Example: 1 Minute.

    Do any of the "latestTick" values rely on FirstTickOfBar or a bar series for tick data? Is the strategy or indicator ran with the property CalculateOnBarClose set to True or False?

    I look forward to your response.

    Comment


      #3
      Originally posted by NinjaTrader_PatrickH View Post
      Hello wwteo,

      Thank you for your post.

      What is the primary bar series the indicator or strategy is applied to? When applying the indicator or strategy to a chart, what period type and interval is selected for the chart? Example: 1 Minute.

      Do any of the "latestTick" values rely on FirstTickOfBar or a bar series for tick data? Is the strategy or indicator ran with the property CalculateOnBarClose set to True or False?

      I look forward to your response.
      Primary bar series is a 400 tick chart. The function is already contained in a
      "if (BarsInProgress == 0)"
      there is a FirstTickOfBar and BarsInProgress == 0 with .Update() functions for various indicators. This is the only way to keep the indicators up to date and functioning correctly.

      As said before it is run with COBC set to false. Like I said, it works perfectly during initialize with the historical bars and backtesting etc... Are my CurrentBars correct or?

      Comment


        #4
        Hello wwteo,

        Thank you for your response.

        Your calls to CurrentBars[0] are correct in order to call the CurrentBar of the primary bar series. However, is this a multi-instrument script? Do you add other bar series to the script?

        Do you see any errors in the log tab of the NinjaTrader Control Center when applying the code to a real-time chart?

        I look forward to your response.

        Comment


          #5
          Originally posted by NinjaTrader_PatrickH View Post
          Hello wwteo,

          Thank you for your response.

          Your calls to CurrentBars[0] are correct in order to call the CurrentBar of the primary bar series. However, is this a multi-instrument script? Do you add other bar series to the script?

          Do you see any errors in the log tab of the NinjaTrader Control Center when applying the code to a real-time chart?

          I look forward to your response.
          Nothing out of the ordinary in logs unless except for the usual "enabling" and "disabling"... The other barseries is a 30 minute barseries. It is working perfectly throwing out the correct prints. I have another "print" on BarsInProgress 0 also throwing out prints and orders correctly but it uses CurrentBars[0] alone without any Math or addition or subtraction stuff. it looks at the same indicators.

          I have tried 3 barseries' with this and somehow it works without the math functions but having 2 tick barseries makes ninjatrader freeze too often so we are all waiting for you to release a proper multithreaded application

          Comment


            #6
            Hello wwteo,

            Thank you for your response.

            Do you see the print when the bars close in real-time with CalculateOnBarClose = False? Do you see the prints if you use CalculateOnBarClose = True when the bars close?

            Do you have a simplified script that reproduces this behavior that I may test on my end?

            I look forward to your response.

            Comment


              #7
              Originally posted by NinjaTrader_PatrickH View Post
              Hello wwteo,

              Thank you for your response.

              Do you see the print when the bars close in real-time with CalculateOnBarClose = False? Do you see the prints if you use CalculateOnBarClose = True when the bars close?

              Do you have a simplified script that reproduces this behavior that I may test on my end?

              I look forward to your response.
              Not really... its using a few custom indicators. I found an old code in one of my custom indicators that has

              " if(CalculateOnBarClose == true){firstbarofchart = 0;secondbarofchart = 1;thirdbarofchart = 2;}
              else{firstbarofchart = 1;secondbarofchart = 2;thirdbarofchart = 3;}
              "
              It kept crashing before this statement was added.

              It is working with COBC = true

              PS I just changed it to "firstbarofchart = 0;secondbarofchart = 1;thirdbarofchart = 2;"
              Nope. Still not working on COBC false
              Last edited by wwteo; 11-26-2013, 12:03 PM.

              Comment


                #8
                Hello wwteo,

                Thank you for your response.

                Unfortunately, I do not follow. Can you provide a simplified version of your code that is isolated to this item?

                I look forward to your response.

                Comment


                  #9
                  Originally posted by NinjaTrader_PatrickH View Post
                  Hello wwteo,

                  Thank you for your response.

                  Unfortunately, I do not follow. Can you provide a simplified version of your code that is isolated to this item?

                  I look forward to your response.
                  COBC true works
                  COBC false doesnt work.

                  Comment


                    #10
                    Hello wwteo,

                    Thank you for your response.

                    Can you provide a simplified version of your code that is isolated to this item?

                    I look forward to your response.

                    Comment


                      #11
                      Originally posted by NinjaTrader_PatrickH View Post
                      Hello wwteo,

                      Thank you for your response.

                      Can you provide a simplified version of your code that is isolated to this item?

                      I look forward to your response.
                      It turns out to be one of the indicators that had a code that reset during COBC.
                      Item fixed.Might have to look up the Swing indicator fix as well.

                      Thanks for the help

                      Comment

                      Latest Posts

                      Collapse

                      Topics Statistics Last Post
                      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
                      0 responses
                      668 views
                      0 likes
                      Last Post Geovanny Suaza  
                      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
                      0 responses
                      377 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by Mindset, 02-09-2026, 11:44 AM
                      0 responses
                      110 views
                      0 likes
                      Last Post Mindset
                      by Mindset
                       
                      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
                      0 responses
                      575 views
                      1 like
                      Last Post Geovanny Suaza  
                      Started by RFrosty, 01-28-2026, 06:49 PM
                      0 responses
                      580 views
                      1 like
                      Last Post RFrosty
                      by RFrosty
                       
                      Working...
                      X