Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Pointer to DataSeries Object

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

    Pointer to DataSeries Object

    Hi,

    I'm using DrawRegion() but the dataseries that I want to shade between depend on input parameters, and they are moving averages.

    Is there a way that I could create a dataseries pointer, set it to point the EMA series that I need during intialization(), then use the pointer in DrawRegion()?

    so something like this...

    DataSeries MyDataseries1, MyDataSeries2;

    Initialize() {
    MyDataseries1 = EMA(21); // this doesnt compile
    MyDataseries2 = WMA(12); // this doesnt compile
    }

    OnBarUpdate()
    {
    DrawRegion("tag"+CurrentBar.ToString(), 1, 0, MyDataSeries1, MyDataSeries2, colour, colour, opacity);
    }

    Thanks,
    will.

    #2
    Hi Will, to compile that snippet please try making the series IDataSeries, so

    IDataSeries MyDataseries1, MyDataseries2;

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by CarlTrading, 03-31-2026, 09:41 PM
    1 response
    132 views
    1 like
    Last Post NinjaTrader_ChelseaB  
    Started by CarlTrading, 04-01-2026, 02:41 AM
    0 responses
    74 views
    1 like
    Last Post CarlTrading  
    Started by CaptainJack, 03-31-2026, 11:44 PM
    0 responses
    117 views
    2 likes
    Last Post CaptainJack  
    Started by CarlTrading, 03-30-2026, 11:51 AM
    0 responses
    112 views
    1 like
    Last Post CarlTrading  
    Started by CarlTrading, 03-30-2026, 11:48 AM
    0 responses
    89 views
    0 likes
    Last Post CarlTrading  
    Working...
    X