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

NT8 Modification to CurrentDayOHL to display Average Price (MidPoint)

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

    NT8 Modification to CurrentDayOHL to display Average Price (MidPoint)

    Dear Support and NT8 Community,

    The indicator is straightforward modification of the NT8 CurrentDayOHL system indicator. I just want to add a line that shows the average price or MidPoint on the current day's trading session. It helps me determine if I should be looking for longs side or short trades. I have attached the NT8 system code for the indicator, my pseudo code for the MidPoint (it does NOT compile, I don't know why ???), and a picture of what the MidPoint line should look like.

    I was able to code in NT7, but NT8 is whole different game. If anyone could point me in the direction of references or resources to get up to speed on NT8, it would be greatly appreciated.

    Thanks,

    Stephen

    @CurrentDayOHL.cs

    CurrentDayMidPoint.cs

    ​​​​​​​


    #2
    Hello gmachine,

    Thank you for the post.

    I believe the problem is just that you have tried to re use some of the code that stock indicators have in an incorrect way. The stock indicators all utilize Resources for language conversion, this is not something you need to worry about in your custom code. Here is a rundown of the problems that I see.

    To start, anywhere you see Custom.Resource.SomeResourceNameHere you will replace this with your own string. For example lets look at the following:


    Code:
    Description                    = NinjaTrader.Custom.Resource.NinjaScriptIndicatorDescriptionCurrentDayMidPoint;
    Should instead be:

    Code:
    Description                    = "My Own Custome Description";


    The same goes for the plots:


    Code:
    AddPlot(new Stroke(Brushes.Goldenrod,    DashStyleHelper.Dash, 2), PlotStyle.Square, NinjaTrader.Custom.Resource.CurrentDayMidPointOpen);
    AddPlot(new Stroke(Brushes.SeaGreen,    DashStyleHelper.Dash, 2), PlotStyle.Square, NinjaTrader.Custom.Resource.CurrentDayMidPointHigh);
    AddPlot(new Stroke(Brushes.Red,            DashStyleHelper.Dash, 2), PlotStyle.Square, NinjaTrader.Custom.Resource.CurrentDayMidPointLow);
    AddPlot(new Stroke(Brushes.Gray,        DashStyleHelper.Dash, 2), PlotStyle.Square, NinjaTrader.Custom.Resource.CurrentDayMidPointMP);
    Should be:


    Code:
    AddPlot(new Stroke(Brushes.Goldenrod,    DashStyleHelper.Dash, 2), PlotStyle.Square, [B]"Plot1"[/B]);
    AddPlot(new Stroke(Brushes.SeaGreen,    DashStyleHelper.Dash, 2), PlotStyle.Square, [B] "Plot2"[/B]);
    AddPlot(new Stroke(Brushes.Red,            DashStyleHelper.Dash, 2), PlotStyle.Square, [B] "Plot3"[/B]);
    AddPlot(new Stroke(Brushes.Gray,        DashStyleHelper.Dash, 2), PlotStyle.Square, [B] "Plot4"[/B]);
    With your own names of course.


    Also these lines need corrected to use "" strings instead:

    Code:
           Draw.TextFixed(this, "NinjaScriptInfo", Custom.Resource.CurrentDayMidPointError, TextPosition.BottomRight);
                        Log(Custom.Resource.CurrentDayMidPointError, LogLevel.Error);


    The final error is that you did not make a public property for ShowMidPoint which you tried to set in State.DataLoaded. You would need to expand the properties region near the bottom and make a property for that. Your properites also do not need the Custom.Resource part:


    Code:
       [Display(Name = "ShowMP", GroupName = "NinjaScriptParameters", Order = 4)]
            public bool ShowMidPoint
            { get; set; }



    JesseNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Rapine Heihei, Today, 08:19 PM
    0 responses
    1 view
    0 likes
    Last Post Rapine Heihei  
    Started by f.saeidi, Today, 08:01 PM
    1 response
    4 views
    0 likes
    Last Post NinjaTrader_Manfred  
    Started by Rapine Heihei, Today, 07:51 PM
    0 responses
    4 views
    0 likes
    Last Post Rapine Heihei  
    Started by frslvr, 04-11-2024, 07:26 AM
    5 responses
    96 views
    1 like
    Last Post caryc123  
    Started by algospoke, 04-17-2024, 06:40 PM
    6 responses
    49 views
    0 likes
    Last Post algospoke  
    Working...
    X