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 NullPointStrategies, Yesterday, 05:17 AM
    0 responses
    62 views
    0 likes
    Last Post NullPointStrategies  
    Started by argusthome, 03-08-2026, 10:06 AM
    0 responses
    134 views
    0 likes
    Last Post argusthome  
    Started by NabilKhattabi, 03-06-2026, 11:18 AM
    0 responses
    75 views
    0 likes
    Last Post NabilKhattabi  
    Started by Deep42, 03-06-2026, 12:28 AM
    0 responses
    45 views
    0 likes
    Last Post Deep42
    by Deep42
     
    Started by TheRealMorford, 03-05-2026, 06:15 PM
    0 responses
    50 views
    0 likes
    Last Post TheRealMorford  
    Working...
    X