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

Help with congestion area

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

    Help with congestion area

    hI. I want to develp a congestion area where price is stuck between the levels, in this case price is stuck within MIN MAX last 5 bars. I am doing something wrong but i cant fiture out. lines get drawn not exactly on the price levels tha it needs.

    double lowest5 = MIN(Low, 5)[1];
    double highest5 = MIN(High, 5)[1];

    if (Close[1] > lowest5 && Close[2] > lowest5 && Close[3] > lowest5 && Close[4] > lowest5
    && Open[1] < highest5 && Open[2] < highest5 && Open[3] < highest5 && Open[4] < highest5)

    {
    Draw.TriangleUp(this, "arrowUp"+CurrentBar,false,1,Low[1]-2*TickSize,Brushes.White);
    Draw.Line(this, "HighestCong"+Bars.Count.ToString(), false, 5, MAX(High,4)[0], 1, MAX(High,4)[0], "Cong Values");
    Draw.Line(this, "LowestCong"+Bars.Count.ToString(), false, 5, MIN(Low,4)[0], 1, MIN(Low,4)[0], "Conge values");
    }​​

    Click image for larger version

Name:	image.png
Views:	75
Size:	656.8 KB
ID:	1255181​​
    Attached Files

    #2
    Hello tkaboris,

    The code you provided is essentially what you described. You are checking the MIN/MAX of the last 5 bars. You get the MIN/MAX of 1 BarsAgo and assign that to a variable. Those variables are used to check if the open and close are within those values.

    To know why that is not working as expected you will need to use a Print and find out what the values are.

    You can print the Time object to know what a value is for each bar:

    Code:
    double lowest5 = MIN(Low, 5)[1];
    double highest5 = MIN(High, 5)[1];​
    Print(Time[0] + " " lowest5 + " " + highest5);
    That would give you the two MIN/MAX values for each bar with a timestamp. You could then use the databox to compare the specific instances on the chart.
    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Tim-c, Today, 02:10 PM
    1 response
    7 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by Taddypole, Today, 02:47 PM
    0 responses
    2 views
    0 likes
    Last Post Taddypole  
    Started by chbruno, 04-24-2024, 04:10 PM
    4 responses
    50 views
    0 likes
    Last Post chbruno
    by chbruno
     
    Started by TraderG23, 12-08-2023, 07:56 AM
    10 responses
    399 views
    1 like
    Last Post beobast
    by beobast
     
    Started by lorem, Yesterday, 09:18 AM
    5 responses
    25 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Working...
    X