Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Plotting newbie question

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

    Plotting newbie question

    I have read through best I can on plotting (NT7b20) and this is what I understand and what I am trying to do in a strategy:

    protected override void Initialize()
    {
    Add(EMA(11)); // plots the moving average continuously
    //
    // adds a StrategyPlot indicator to paint the 'stop loss' with.
    Add(StrategyPlot(0));
    StrategyPlot(0).Plots[0].Pen.Color = Color.Black;
    StrategyPlot(0).Plots[0].PlotStyle = PlotStyle.Square;
    StrategyPlot(0).PanelUI = 1;
    StrategyPlot(0).Name = "StopLoss";
    } // so that is all fine

    // but I only want to have plotting completed on certain conditions as:

    protected override void OnBarUpdate()
    { // this condition
    if (EMA(11)[0] > (EMA(5)[0] // does not
    { // plot something somehow} //have a way of plotting

    // and this condition
    while (EMA(11)[0] > (EMA(5)[0] // also does not
    { // plot something somehow} //have a way of plotting

    }
    // so what can I use in OnBarUpdate to plot on certain conditions

    TIA,
    Jon
    Last edited by Trader.Jon; 08-19-2010, 02:30 PM.

    #2
    Jon, you could use a plot, but there are also quite a few different drawing objects you could place on the chart, like squares, dots, triangles, arrows, diamonds, etc. So if you wanted to place arrows on each crossover, for example, you could do something like this:
    Code:
    if (CrossAbove(EMA(5), EMA(11), 1))
                    DrawArrowUp("up arrow" + CurrentBar, false, 0, Low[0] - 2 * TickSize, Color.Green);
    if (CrossBelow(EMA(5), EMA(11), 1))
                    DrawArrowDown("down arrow" + CurrentBar, false, 0, High[0] + 2 * TickSize, Color.Red);
    I actually have a script laying around that does just this.. I've attached it for your convenience.
    Attached Files
    AustinNinjaTrader Customer Service

    Comment

    Latest Posts

    Collapse

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