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 Orion815, 05-02-2024, 08:39 AM
      3 responses
      20 views
      0 likes
      Last Post NinjaTrader_Gaby  
      Started by frenkmly, Today, 04:49 AM
      0 responses
      5 views
      0 likes
      Last Post frenkmly  
      Started by ETFVoyageur, Yesterday, 07:05 PM
      2 responses
      19 views
      0 likes
      Last Post bltdavid  
      Started by MGHORBEL, 05-06-2024, 06:41 AM
      4 responses
      23 views
      0 likes
      Last Post MGHORBEL  
      Started by ChastiJose, Today, 03:37 AM
      0 responses
      7 views
      0 likes
      Last Post ChastiJose  
      Working...
      X