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.
    Kate W.NinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by toughiee, Today, 12:04 AM
    0 responses
    2 views
    0 likes
    Last Post toughiee  
    Started by vdoan20, Yesterday, 08:30 PM
    0 responses
    6 views
    0 likes
    Last Post vdoan20
    by vdoan20
     
    Started by gupagoer, Yesterday, 07:42 PM
    0 responses
    9 views
    0 likes
    Last Post gupagoer  
    Started by Holligoly, Yesterday, 05:13 PM
    2 responses
    11 views
    0 likes
    Last Post Holligoly  
    Started by Raginpower, Yesterday, 01:53 PM
    0 responses
    14 views
    0 likes
    Last Post Raginpower  
    Working...
    X