Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Risk Reward Indicator , convert to seperate plots

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

    Risk Reward Indicator , convert to seperate plots

    I have created a risk reward indicator that uses rays to draw price areas where my stops and target will be entered if i want to take a trade there. I would like to convert all my rays into separate plots due to do the chart wont render about half the time when I restart Ninja trader. Plus I would like to customize it a little more efficiently. I will paste what the code looks like that I am using. I someone can just convert 2 of the rays to plots for me I should be able to finish the rest

    Thanks
    Quantismo
    namespace NinjaTrader.NinjaScript.Indicators
    {
    public class CenTexRiskReward : Indicator
    {
    #region Variables

    private Brush lineColorPrice = Brushes.Chartreuse;
    private Brush lineColorStop= Brushes.Red;
    private Brush lineColorTarget = Brushes.Yellow;
    private int lineWidthStops = 2;
    private int lineWidth = 10;
    private int lineWidthPrice = 1;
    private DashStyleHelper lineStyle = DashStyleHelper.Solid;
    private int rayLength = 0;
    private double Stops = 12; // The amout of ticks risked
    private double TargetRatio = 3;
    private double Target = 0.0; // will be the reward computed in the OnstateChange area




    #endregion


    private void Initialize()
    {
    Calculate = Calculate.OnEachTick;
    IsOverlay = true;

    IsAutoScale = false;

    }

    protected override void OnStateChange()
    {
    switch (State)
    {
    case State.SetDefaults:
    Name = "CenTexRiskReward";
    Description = "Risk Reward Markers will keep your focus on R&R";

    Target = Stops * TargetRatio;
    //################################################## ################################################## ###






    //################################################## ################################################## ###



    Initialize();
    break;
    }
    }

    protected override void OnBarUpdate()
    {


    if (Close[0] > 0)
    {


    if (CurrentBar > 12)

    //################################################## ################################################## ########
    //test area

    Draw.Ray(this,"CurrRay #1", false, rayLength, Close[0] - (Stops) * TickSize, 0, Close[0] - (Stops) * TickSize, lineColorTarget, lineStyle, lineWidthStops);

    Draw.Ray(this,"CurrRay #2", false, rayLength, Close[0] + (Stops) * TickSize, 0, Close[0] + (Stops) * TickSize, lineColorStop, lineStyle, lineWidthStops);

    Draw.Ray(this,"CurrRay #3", false, rayLength, Close[0], 0, Close[0], lineColorPrice, lineStyle, lineWidthPrice);

    Draw.Ray(this,"CurrRay #4", false, rayLength, Close[0] + (Target) * TickSize, 0, Close[0] + (Target) * TickSize, lineColorTarget, lineStyle, lineWidth);

    Draw.Ray(this,"CurrRay #5", false, rayLength, Close[0] - (Target) * TickSize, 0, Close[0] - (Target) * TickSize, lineColorStop, lineStyle, lineWidth);

    #2
    Hello quantismo,

    Thanks for opening the thread.

    While it is against our policy to create/modify code for our clients at request, I could provide you some direction for you to create the plots in a new indicator and add them to your current indicator.

    In the attached video I have created an indicator that assigns the plot's value to a user defined input. The same approach can be used to create plots and assign a value other than the user defined PriceLevel.

    Demo: https://www.screencast.com/t/xJZAnbmb

    I also suggest creating a blank indicator and then an indicator that only implements one plot. The resulting code can then be compared to see how the Indicator wizard creates plot syntax.

    Documentation items that can be referenced for further understanding and usage can be found below. This documentation is publicly available.


    Also, if it interests you, we can have a representative of our EcoSystem reach out with additional information on NinjaScript consultants who would be happy to create this indicator for you at your request. If that is the case, please let us know.

    Comment

    Latest Posts

    Collapse

    Topics Statistics Last Post
    Started by Geovanny Suaza, 02-11-2026, 06:32 PM
    0 responses
    571 views
    0 likes
    Last Post Geovanny Suaza  
    Started by Geovanny Suaza, 02-11-2026, 05:51 PM
    0 responses
    330 views
    1 like
    Last Post Geovanny Suaza  
    Started by Mindset, 02-09-2026, 11:44 AM
    0 responses
    101 views
    0 likes
    Last Post Mindset
    by Mindset
     
    Started by Geovanny Suaza, 02-02-2026, 12:30 PM
    0 responses
    548 views
    1 like
    Last Post Geovanny Suaza  
    Started by RFrosty, 01-28-2026, 06:49 PM
    0 responses
    548 views
    1 like
    Last Post RFrosty
    by RFrosty
     
    Working...
    X