Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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?
    BertrandNinjaTrader Customer Service

    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.
            BertrandNinjaTrader Customer Service

            Comment

            Latest Posts

            Collapse

            Topics Statistics Last Post
            Started by algospoke, 04-17-2024, 06:40 PM
            6 responses
            49 views
            0 likes
            Last Post algospoke  
            Started by arvidvanstaey, Today, 02:19 PM
            4 responses
            11 views
            0 likes
            Last Post arvidvanstaey  
            Started by samish18, 04-17-2024, 08:57 AM
            16 responses
            61 views
            0 likes
            Last Post samish18  
            Started by jordanq2, Today, 03:10 PM
            2 responses
            9 views
            0 likes
            Last Post jordanq2  
            Started by traderqz, Today, 12:06 AM
            10 responses
            21 views
            0 likes
            Last Post traderqz  
            Working...
            X