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

DrawText But only Once

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

    DrawText But only Once

    Hello,
    I developed a little strategy to tell me whether it is overbought or oversold and when triggered to draw a up/down arrow and to have the text "Overbought" or "Oversold".

    The Arrows come up every time the indicator trigger but the text only happens in the last trigger but not any of the times it happened before.

    How can I correct this issue to where every time the Arrow appears, so does the Text?

    This is the code below:
    // Condition set 1 - Overbought Short
    if (CCI(CCIFast)[0] > 150
    && CCI(CCISlow)[0] > 150)
    {
    BackColorAll = Color.Pink;
    DrawArrowDown("MyTag"+ CurrentBar, true, 0, High[0] + TickSize, ArrowsDownColor);
    DrawText("Mytag","Overbought", 0, High[0] + TickSize*16, Color.Red);

    Thanks

    NickF

    #2
    Originally posted by NickF View Post
    Hello,
    I developed a little strategy to tell me whether it is overbought or oversold and when triggered to draw a up/down arrow and to have the text "Overbought" or "Oversold".

    The Arrows come up every time the indicator trigger but the text only happens in the last trigger but not any of the times it happened before.

    How can I correct this issue to where every time the Arrow appears, so does the Text?

    This is the code below:
    // Condition set 1 - Overbought Short
    if (CCI(CCIFast)[0] > 150
    && CCI(CCISlow)[0] > 150)
    {
    BackColorAll = Color.Pink;
    DrawArrowDown("MyTag", true, 0, High[0] + TickSize, ArrowsDownColor);
    DrawText("Mytag","Overbought", 0, High[0] + TickSize*16, Color.Red);

    Thanks

    NickF
    Remove currentbar. That is making it unique and therefore drawing on every bar.

    Comment


      #3
      Originally posted by NickF View Post
      Hello,
      I developed a little strategy to tell me whether it is overbought or oversold and when triggered to draw a up/down arrow and to have the text "Overbought" or "Oversold".

      The Arrows come up every time the indicator trigger but the text only happens in the last trigger but not any of the times it happened before.

      How can I correct this issue to where every time the Arrow appears, so does the Text?

      This is the code below:
      // Condition set 1 - Overbought Short
      if (CCI(CCIFast)[0] > 150
      && CCI(CCISlow)[0] > 150)
      {
      BackColorAll = Color.Pink;
      DrawArrowDown("MyTag"+ CurrentBar, true, 0, High[0] + TickSize, ArrowsDownColor);
      DrawText("Mytag","Overbought", 0, High[0] + TickSize*16, Color.Red);

      Thanks

      NickF
      Correct the tag for DrawText() to make it unique in the same manner that you have for DrawArrowDown(). Your current code is using the same tag, so your text will appear only once on the chart, as that tag will always be the only tag.

      Comment


        #4
        Originally posted by koganam View Post
        Correct the tag for DrawText() to make it unique in the same manner that you have for DrawArrowDown(). Your current code is using the same tag, so your text will appear only once on the chart, as that tag will always be the only tag.

        Oops, I had that backwards

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by ETFVoyageur, 05-07-2024, 07:05 PM
        6 responses
        50 views
        0 likes
        Last Post ETFVoyageur  
        Started by Klaus Hengher, Yesterday, 03:13 AM
        2 responses
        15 views
        0 likes
        Last Post Klaus Hengher  
        Started by Sebastian - TwinPeaks, Yesterday, 01:31 PM
        2 responses
        13 views
        0 likes
        Last Post Sebastian - TwinPeaks  
        Started by wbennettjr, 07-15-2017, 05:07 PM
        16 responses
        2,533 views
        1 like
        Last Post eladlevi  
        Started by Human#102, Yesterday, 09:54 AM
        2 responses
        8 views
        0 likes
        Last Post Human#102  
        Working...
        X