Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How come plots disappear ?

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

    How come plots disappear ?

    1) I have this code which works fine :

    protected override void OnBarUpdate()
    {
    if (Time[0].Ticks >= startTime.Ticks && allHours > 0 && startBarIndex == 0)
    startBarIndex = CurrentBar;
    if (startBarIndex > 0 && startBarIndex == CurrentBar)
    DrawDiamond("Start Tag", 0, High[0] + TickSize, Color.Turquoise);
    AskTrades.Set((double) AskCount);
    BidTrades.Set((double) BidCount);
    if (AskTrades[0] > (BidTrades[0]*3.5) && BidTrades[1] > (AskTrades[1]*3.5))
    {
    PlaySound(@"E:\type.wav");
    Print("Ask > 3.5 Bid : " + AskTrades[0]);
    }
    else if (BidTrades[0] > (AskTrades[0]*3.5) && AskTrades[1] > (BidTrades[1]*3.5))
    {
    PlaySound(@"E:\online.wav");
    Print("Bid > 3.5 Ask : " + BidTrades[0]);
    };
    if (Close[0] > (prevBidTradePrice+0.5) && prevBidTradePrice != 0)
    {
    if (DateTime.Now.TimeOfDay.Ticks > (LastUpTime + 10000000))
    {
    Alert(DateTime.Now.Millisecond.ToString(), NinjaTrader.Cbi.Priority.Medium, "Up>0.50: " + Close[0], @"E:\Pluck2_Up.wav", 0, Color.Lime, Color.Black);
    LastUpTime = DateTime.Now.TimeOfDay.Ticks;
    }
    }
    else if (Close[0] < (prevAskTradePrice-0.5) && prevAskTradePrice != 0)
    {
    if (DateTime.Now.TimeOfDay.Ticks > (LastDnTime + 10000000))
    {
    Alert(DateTime.Now.Millisecond.ToString(), NinjaTrader.Cbi.Priority.Medium, "Dn>0.50: " + Close[0], @"E:\Pluck_Dn.wav", 0, Color.Crimson, Color.Black);
    LastDnTime = DateTime.Now.TimeOfDay.Ticks;
    }
    };
    }

    2) as soon as I add the 8 latest lines below, I no longer get both AskTrades and BidTrades plotted :

    protected override void OnBarUpdate()
    {
    if (Time[0].Ticks >= startTime.Ticks && allHours > 0 && startBarIndex == 0)
    startBarIndex = CurrentBar;
    if (startBarIndex > 0 && startBarIndex == CurrentBar)
    DrawDiamond("Start Tag", 0, High[0] + TickSize, Color.Turquoise);
    AskTrades.Set((double) AskCount);
    BidTrades.Set((double) BidCount);
    if (AskTrades[0] > (BidTrades[0]*3.5) && BidTrades[1] > (AskTrades[1]*3.5))
    {
    PlaySound(@"E:\type.wav");
    Print("Ask > 3.5 Bid : " + AskTrades[0]);
    }
    else if (BidTrades[0] > (AskTrades[0]*3.5) && AskTrades[1] > (BidTrades[1]*3.5))
    {
    PlaySound(@"E:\online.wav");
    Print("Bid > 3.5 Ask : " + BidTrades[0]);
    };
    if (Close[0] > (prevBidTradePrice+0.5) && prevBidTradePrice != 0)
    {
    if (DateTime.Now.TimeOfDay.Ticks > (LastUpTime + 10000000))
    {
    Alert(DateTime.Now.Millisecond.ToString(), NinjaTrader.Cbi.Priority.Medium, "Up>0.50: " + Close[0], @"E:\Pluck2_Up.wav", 0, Color.Lime, Color.Black);
    LastUpTime = DateTime.Now.TimeOfDay.Ticks;
    }
    }
    else if (Close[0] < (prevAskTradePrice-0.5) && prevAskTradePrice != 0)
    {
    if (DateTime.Now.TimeOfDay.Ticks > (LastDnTime + 10000000))
    {
    Alert(DateTime.Now.Millisecond.ToString(), NinjaTrader.Cbi.Priority.Medium, "Dn>0.50: " + Close[0], @"E:\Pluck_Dn.wav", 0, Color.Crimson, Color.Black);
    LastDnTime = DateTime.Now.TimeOfDay.Ticks;
    }
    };
    // est-ce le prix s'envole ?
    if (Close[0] > Close[1] && (Close[1] > Close[2] || Close[1] > Close[3]))
    {
    if (DateTime.Now.TimeOfDay.Ticks > (LastUpTime + 10000000))
    {
    Alert(DateTime.Now.Millisecond.ToString(), NinjaTrader.Cbi.Priority.Medium, "Up>>: " + Close[0], @"E:\Conn_1250.wav", 0, Color.PaleGreen, Color.Black);
    LastUpTime = DateTime.Now.TimeOfDay.Ticks;
    }
    }
    // <<<
    if (Close[0] < Close[1] && (Close[1] < Close[2] || Close[1] < Close[3]))
    {
    if (DateTime.Now.TimeOfDay.Ticks > (LastDnTime + 10000000))
    {
    Alert(DateTime.Now.Millisecond.ToString(), NinjaTrader.Cbi.Priority.Medium, "Dn<<: " + Close[0], @"E:\Conn_100.wav", 0, Color.LightPink, Color.Black);
    LastDnTime = DateTime.Now.TimeOfDay.Ticks;
    }
    };
    // >>>
    }

    #2
    You are going to have to debug your code.


    Please look for errors in your logs.
    Josh P.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    596 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    343 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    103 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    556 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    554 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X