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 dward123, 01-02-2024, 09:59 PM
            4 responses
            174 views
            0 likes
            Last Post Lancer
            by Lancer
             
            Started by ETFVoyageur, Today, 04:00 PM
            2 responses
            19 views
            0 likes
            Last Post ETFVoyageur  
            Started by AaronKTradingForum, Today, 03:44 PM
            1 response
            8 views
            0 likes
            Last Post AaronKTradingForum  
            Started by Felix Reichert, 04-26-2024, 02:12 PM
            11 responses
            80 views
            0 likes
            Last Post Felix Reichert  
            Started by junkone, 04-28-2024, 02:19 PM
            7 responses
            83 views
            1 like
            Last Post junkone
            by junkone
             
            Working...
            X