• 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 Gav_G, Today, 02:12 PM
    0 responses
    1 view
    0 likes
    Last Post Gav_G
    by Gav_G
     
    Started by Gav_G, Today, 01:41 PM
    0 responses
    4 views
    0 likes
    Last Post Gav_G
    by Gav_G
     
    Started by kweiss, Today, 01:21 PM
    0 responses
    4 views
    0 likes
    Last Post kweiss
    by kweiss
     
    Started by digibob, Yesterday, 06:45 AM
    2 responses
    14 views
    0 likes
    Last Post NinjaTrader_ChrisL  
    Started by cutzpr, Today, 08:44 AM
    0 responses
    3 views
    0 likes
    Last Post cutzpr
    by cutzpr
     
    Working...
    X