Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawTextFixed doesn't update?

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

    DrawTextFixed doesn't update?

    Hi, I am trying to use DrawTextFixed simply just to show blue text if ema8 above 20 and red text if otherwise.

    But, it doesn't seem to update when new bar starts.

    How can I make it update? Here is the snippet

    str = "";
    str =
    "\n\nEMA8 above EMA20 = " + " #######";
    if( EMA(Close,8)[0] >= EMA(Close,20)[0] ) note3Color = Color.Blue;
    else note3Color = Color.Red;
    DrawTextFixed(
    "BottomLeft", str, note3Location, note3Color, note3Font, Color.Transparent, Color.Transparent, 0);

    #2
    ssg10, seems to work in my quick test here on the ES 09-11 10 second chart - what COBC setting do you use with the indicator?

    Comment


      #3
      What is COBC?

      Comment


        #4
        Another funny thing is I just print something simple, like close[0], but the log is wrong:

        Output:

        slopeEMA20=0.0476
        slopeEMA50=0.0196
        stoch=77.7778
        close =1165.5 ====> this should be 1175 on the chart (10sec, ES)


        Code:

        protected override void OnBarUpdate() {

        if ( CurrentBar > 1 ) return;

        string str=""; int i = 0;

        double slopeEMA20 = Slope(EMA(20), 1, 0);
        double slopeEMA50 = Slope(EMA(50), 1, 0);
        Print("slopeEMA20=" +slopeEMA20.ToString("N4"));
        Print("slopeEMA50=" + slopeEMA50.ToString("N4"));
        Print("stoch=" + Stochastics(3,14,3).K[0].ToString("N4"));
        Print("close ="+Close[0]);

        Comment


          #5
          Alright, I found the problem. I am using existing indicator to add my own stuff.. and this line prevents the code flow:

          if ( CurrentBar > 1 ) return;

          Got it. Thanks!

          Comment


            #6
            COBC would be short for the CalculateOnBarClose setting - glad to hear you could resolve your issue.

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by CarlTrading, 03-31-2026, 09:41 PM
            1 response
            134 views
            1 like
            Last Post NinjaTrader_ChelseaB  
            Started by CarlTrading, 04-01-2026, 02:41 AM
            0 responses
            75 views
            1 like
            Last Post CarlTrading  
            Started by CaptainJack, 03-31-2026, 11:44 PM
            0 responses
            119 views
            2 likes
            Last Post CaptainJack  
            Started by CarlTrading, 03-30-2026, 11:51 AM
            0 responses
            114 views
            1 like
            Last Post CarlTrading  
            Started by CarlTrading, 03-30-2026, 11:48 AM
            0 responses
            92 views
            0 likes
            Last Post CarlTrading  
            Working...
            X