Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Don't plot on chart - Need help

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

    Don't plot on chart - Need help

    Hi, my name is Wiktor and I come from Poland ) my grammar english is not really impressive. i'm begginer trader and i try write my first indicator.

    When i write :

    protected override void Initialize()
    {

    Add(new Plot(Color.FromKnownColor(KnownColor.Orange), PlotStyle.Line, "Plot0"));
    CalculateOnBarClose = false;
    Overlay = true;
    PriceTypeSupported = true;
    }

    /// <summary>
    /// Called on each bar update event (incoming tick)
    /// </summary>
    protected override void OnBarUpdate()
    {

    // Condition set 1 kupuj
    if ( Close[0] > MAX(High, 2)[0] )

    {
    DrawArrowUp("My up arrow" + CurrentBar, 0, Low[0] +- 5 * TickSize, Color.Blue);
    DrawLine("My line" + CurrentBar, 0, Low[0],35, Low[0], Color.Blue);
    }



    I would like trade Long when price breakout MAX from 2 bars, but that indicator don't plot on chart, where is bug ?? What I write wrong ?? Help me

    #2
    Yek shamash! (my spelling is probably bad as well but hopefully you know what I mean)

    The problem is with your logic. Your condition will !never be true since the close will !never be greater than the highest highest high of the last two bars. At best, it may equal. What you likely want to check for is if the current bar close is greater than the highest high of the past two bars excluding the current bar.

    if (Close[0] > MAX(High, 2)[1])
    // Do something

    is what you want. You will also want to add a check like this before hand.

    if (CurrentBar < 1)
    return;

    See this link for more info - http://www.ninjatrader-support.com/v...ead.php?t=3170
    RayNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    152 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    87 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    131 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    127 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    106 views
    0 likes
    Last Post CarlTrading  
    Working...
    X