• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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.
    http://www.ninjatrader-support.com/v...ead.php?t=3418

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

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by chafan11, 04-04-2020, 09:28 PM
    2 responses
    18 views
    0 likes
    Last Post bltdavid  
    Started by RumHam, 04-04-2020, 10:03 AM
    1 response
    8 views
    0 likes
    Last Post NinjaTrader_Marco  
    Started by olivares_alfre, Yesterday, 02:19 PM
    2 responses
    13 views
    0 likes
    Last Post NinjaTrader_Marco  
    Started by hiikila, Today, 02:40 AM
    0 responses
    5 views
    0 likes
    Last Post hiikila
    by hiikila
     
    Started by Beauregard, Yesterday, 11:50 PM
    0 responses
    15 views
    0 likes
    Last Post Beauregard  
    Working...
    X