Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

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 rdtdale, Today, 01:02 PM
    0 responses
    1 view
    0 likes
    Last Post rdtdale
    by rdtdale
     
    Started by alifarahani, Today, 09:40 AM
    3 responses
    15 views
    0 likes
    Last Post NinjaTrader_Jesse  
    Started by RookieTrader, Today, 09:37 AM
    4 responses
    18 views
    0 likes
    Last Post RookieTrader  
    Started by PaulMohn, Today, 12:36 PM
    0 responses
    5 views
    0 likes
    Last Post PaulMohn  
    Started by love2code2trade, 04-17-2024, 01:45 PM
    4 responses
    40 views
    0 likes
    Last Post love2code2trade  
    Working...
    X