Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Ninjascript: changing colors of Orderflow VWAP channels? (Lifetime License)

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

    Ninjascript: changing colors of Orderflow VWAP channels? (Lifetime License)

    Hi there!

    How can I change the color used between the Orderflow VWAP bands using C# based on a condition? See the blue background channels in the screenshot.

    Thank you kindly!





    Attached Files

    #2
    Hello focus333,

    Thank you for your reply.

    Those colors are controlled by the properties BandAreaBrush, BandAreaBrush1, and BandAreaBrush2. There's not individual colors for just the upper or lower one of those, it's the same color on both sides. Here's a simple example:

    Code:
     private OrderFlowVWAP VWAP1;
    protected override void OnStateChange()
    {
    if (State == State.SetDefaults)
    {
    Description = @"Enter the description for your new custom Strategy here.";
    Name = "ExampleChangeOFVWAPBandColor";
    Calculate = Calculate.OnBarClose;
    EntriesPerDirection = 1;
    EntryHandling = EntryHandling.AllEntries;
    IsExitOnSessionCloseStrategy = true;
    ExitOnSessionCloseSeconds = 30;
    IsFillLimitOnTouch = false;
    MaximumBarsLookBack = MaximumBarsLookBack.TwoHundredFiftySix;
    OrderFillResolution = OrderFillResolution.Standard;
    Slippage = 0;
    StartBehavior = StartBehavior.WaitUntilFlat;
    TimeInForce = TimeInForce.Gtc;
    TraceOrders = false;
    RealtimeErrorHandling = RealtimeErrorHandling.StopCancelClose;
    StopTargetHandling = StopTargetHandling.PerEntryExecution;
    BarsRequiredToTrade = 20;
    // Disable this property for performance gains in Strategy Analyzer optimizations
    // See the Help Guide for additional information
    IsInstantiatedOnEachOptimizationIteration = true;
    }
    else if (State == State.Configure)
    {
    AddDataSeries(Data.BarsPeriodType.Tick, 1);
    }
    else if (State == State.DataLoaded)
    {
    VWAP1 = OrderFlowVWAP(VWAPResolution.Standard, TradingHours.String2TradingHours("CME US Index Futures RTH"), VWAPStandardDeviations.Three, 1, 2, 3);
    AddChartIndicator(VWAP1);
    }
    }
    
    protected override void OnBarUpdate()
    {
    VWAP1.BandAreaBrush = Brushes.Green;
    VWAP1.BandAreaBrush2 = Brushes.Pink;
    VWAP1.BandAreaBrush3 = Brushes.Purple;
    }
    }
    So yes, you can certainly change those based on conditions in your code, just know that changing them will change both the upper and lower band to that color.

    Please let us know if we may be of further assistance to you.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    47 views
    0 likes
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    23 views
    0 likes
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    33 views
    1 like
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    50 views
    0 likes
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    42 views
    0 likes
    Last Post CarlTrading  
    Working...
    X