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 sjsj2732, Yesterday, 04:31 AM
            0 responses
            32 views
            0 likes
            Last Post sjsj2732  
            Started by NullPointStrategies, 03-13-2026, 05:17 AM
            0 responses
            286 views
            0 likes
            Last Post NullPointStrategies  
            Started by argusthome, 03-08-2026, 10:06 AM
            0 responses
            283 views
            0 likes
            Last Post argusthome  
            Started by NabilKhattabi, 03-06-2026, 11:18 AM
            0 responses
            133 views
            1 like
            Last Post NabilKhattabi  
            Started by Deep42, 03-06-2026, 12:28 AM
            0 responses
            91 views
            0 likes
            Last Post Deep42
            by Deep42
             
            Working...
            X