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

DrawRegion question

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

    DrawRegion question

    Hi,

    I'm trying to color a region between two MAs, lets say 10-period EMA and 25-period EMA. and I want to color the region between them in such a way that if 10-EMA is above 25-EMA its green and if its below the shaded region is red. is there a way to achieve that using DrawRegion ?

    This is how I'm trying to use it. in this case based on the most recent value the entire region changes color :

    if (ema10[0] >= ema25[0])
    {
    DrawRegion(CurrentBar.ToString()+"Shaded",CurrentB ar,0,ema10,ema25,Color.Empty,upColor,1);
    }
    else
    {
    DrawRegion(CurrentBar.ToString()+"Shaded",CurrentB ar,0,ema10,ema25,Color.Empty,dnColor,1);
    }

    thanks in advance for your help

    #2
    pls ignore this request above. I figured it out - instead of plotting it from the beginning to currentbar, I just need to plot a different region for each bar and name it accordingly, so using instead:

    rawRegion(CurrentBar.ToString()+"Shaded",1,0,ema10,ema25,Color.Empty,upColor,1);

    Comment


      #3
      Hello buylosellhi,

      Great to hear you got it figured out!

      Just let us know if we can assist you with anything else.
      DexterNinjaTrader Customer Service

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by judysamnt7, 03-13-2023, 09:11 AM
      4 responses
      53 views
      0 likes
      Last Post DynamicTest  
      Started by ScottWalsh, Today, 06:52 PM
      4 responses
      33 views
      0 likes
      Last Post ScottWalsh  
      Started by olisav57, Today, 07:39 PM
      0 responses
      5 views
      0 likes
      Last Post olisav57  
      Started by trilliantrader, Today, 03:01 PM
      2 responses
      19 views
      0 likes
      Last Post helpwanted  
      Started by cre8able, Today, 07:24 PM
      0 responses
      6 views
      0 likes
      Last Post cre8able  
      Working...
      X