Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Indicator Plot

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

  • s.kinra
    replied
    Hello Chelsea,
    Thanks for clarifying this.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello s.kinra,

    Calling AddPlot() does not call the Order Flow. Instead this adds a plot to the indicator.

    State.SetDefaults is fine. (State.Configure is also fine)

    Leave a comment:


  • s.kinra
    replied
    Hello Chelsea,
    Normally AddPlot(...) is called in State.SetDefaults, is there a specific exception for Order Flow ?

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello sdauteuil,

    To define a public series:

    In State.SetDefaults:
    AddPlot(new Stroke(Brushes.Orange, 2), PlotStyle.Bar, "CumulativeDeltaPlot");

    In #region Properties:
    [Browsable(false)]
    [XmlIgnore]
    public Series<double> CumulativeDeltaPlot
    {
    get { return Values[0]; }
    }

    In OnBarUpdate():
    CumulativeDeltaPlot = SUM(cumulativeDelta.DeltaClose, 3)[0];
    Last edited by NinjaTrader_ChelseaB; 11-22-2020, 10:06 PM.

    Leave a comment:


  • sdauteuil
    replied
    Thanks Robotman for that information

    Leave a comment:


  • sdauteuil
    replied
    Thank you that worked

    In the first one the indicator wizard didn't add the State == State.DataLoaded
    apparently I added that incorrectly.

    In the second one the print function was working but no property area was create to define the series/variable
    I wasn't sure how to create the series for the plot.

    Leave a comment:


  • NinjaTrader_ChelseaB
    replied
    Hello sdauteuil,

    In the file you posted in Post #1 I am able to import this, and there is no compile error.
    However, there is logic run-time error.

    You have 'if (State == State.DataLoaded)' nested within the action block for 'else if (State == State.Configure).

    If the State is State.Configure then it cannot also be State.DataLoaded at the same time.
    The condition on line 58 will never be true, and the cumulativeDelta will never have an indicator instance assigned.

    Change this to 'else if (State == State.DataLoaded)' and move this below the action block for State.Configure, currently on line 65.


    In the file you have posted in Post #11, I am not seeing any issue. This runs and I am seeing prints appearing in the output window. Let me know if you need a video of the script being tested and showing prints in the output window.

    Leave a comment:


  • Robotman
    replied
    Originally posted by sdauteuil View Post
    I am trying to create a simple indicator that sums 3 periods of the cumulative delta.

    I cannot figure out how to get the addplot() to work.
    Hi sdauteuil

    I have created several indicators based on CD and found a good example by NinjaTrader_PaulH located here:

    https://ninjatraderecosystem.com/use...d/ofcdkeltner/

    It is a good reference for a starting point.

    Robotman
    OFCDKeltner uses the Order Flow Cumulative Delta indicator as the input to draw the standard Keltner Channel. To use, please follow this process: 1) Add Order Flow Cumulative Delta to your chart. 2) Add the indicator OFCDKeltner and ensure before applying that you have selected the same parameters that the Order Flow Cumulative Delta indicator […]

    Leave a comment:


  • sdauteuil
    replied
    I found this in a previous post... not sure if this has anything to do with it

    The secondary series is synced with the primary series

    However there is no property region to define variables


    protected override void OnBarUpdate()
    {
    if (BarsInProgress == 0)
    {
    // Print the close of the cumulative delta bar with a delta type of Bid Ask and with a Session period
    Print("Delta Close: " + cumulativeDelta.DeltaClose[0]);
    }
    else if (BarsInProgress == 1)
    {
    // We have to update the secondary series of the hosted indicator to make sure the values we get in BarsInProgress == 0 are in sync
    cumulativeDelta.Update(cumulativeDelta.BarsArray[1].Count - 1, 1);
    }
    Attached Files

    Leave a comment:


  • sdauteuil
    replied
    I also tried adding

    if ((CurrentBars[0] < 20)
    || (CurrentBars[1] < 20))
    return;

    In case the secondary series was the problem

    Leave a comment:


  • sdauteuil
    replied
    I had tried adding that

    if (BarsInProgress != 0)
    return;

    if (CurrentBars[0] < 20)
    return;

    whatever number I put in the CurrentBars statement comes up in the error log.
    11/22/2020 9:15:56 AM Default Indicator 'TestCumulativeDeltaSum': Error on calling 'OnBarUpdate' method on bar 20: Object reference not set to an instance of an object.
    I have tried adding Print() statements to debug it, none of the statements print in the output window only the error.
    I thought maybe there was a spelling or upper / lower case error but haven't found any.

    The latest version is attached
    Attached Files

    Leave a comment:


  • s.kinra
    replied
    OK great, it means no issues with plot. Order Flow might be unable to process on first bar, so you can exclude it.
    You need to add this :-
    Code:
    protected override void OnBarUpdate()
    {
    if(CurrentBar < 3)
    return;
    ... // rest of code }
    You can adjust it later.

    Leave a comment:


  • sdauteuil
    replied
    Log error
    11/22/2020 12:28:19 AM Default Indicator 'TestCumulativeDeltaSum': Error on calling 'OnBarUpdate' method on bar 0: Object reference not set to an instance of an object.

    Leave a comment:


  • sdauteuil
    replied
    That was able to compile

    I changed PlotStyle to Line and added IsAutoScale = true;

    However the indicator panel is still empty

    Leave a comment:


  • s.kinra
    replied
    Let me also ask if you're getting any errors in Control Center Log tab ?

    Leave a comment:

Latest Posts

Collapse

Topics Statistics Last Post
Started by wooofad, Today, 05:38 PM
0 responses
6 views
0 likes
Last Post wooofad
by wooofad
 
Started by caacapital, Today, 10:10 AM
2 responses
17 views
0 likes
Last Post caacapital  
Started by DiverG20, Today, 10:23 AM
0 responses
22 views
0 likes
Last Post DiverG20  
Started by SuneSorgenfrei, Today, 09:29 AM
0 responses
22 views
0 likes
Last Post SuneSorgenfrei  
Started by dodoei, Today, 07:24 AM
0 responses
14 views
0 likes
Last Post dodoei
by dodoei
 
Working...
X