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 Mindset, 04-21-2026, 06:46 AM
    0 responses
    88 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by M4ndoo, 04-20-2026, 05:21 PM
    0 responses
    135 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by M4ndoo, 04-19-2026, 05:54 PM
    0 responses
    68 views
    0 likes
    Last Post M4ndoo
    by M4ndoo
     
    Started by cmoran13, 04-16-2026, 01:02 PM
    0 responses
    119 views
    0 likes
    Last Post cmoran13  
    Started by PaulMohn, 04-10-2026, 11:11 AM
    0 responses
    69 views
    0 likes
    Last Post PaulMohn  
    Working...
    X