Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

draw arrow based on another drawing object

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

    draw arrow based on another drawing object

    i am trying to have a arrow drawn only if the prior condition was met (which would be a diamond plotted on chart) within 7 bars

    here is the code so far

    if ((EMA(22)[0] >= SMA(89)[0]) //mc is above 89
    && (Low [0]< EMA (22)[0]) //low is below mc
    && (Diff[1] <= 0) //ST macd is below 0
    && (Stochastics(5, 3, 3).K[0] <= 40) //stochs is below 40
    && (LTMACD(5,25,170,25)[0] > 0)) //LT macd above 0
    DrawDiamond(Time[0].ToString(), 0, Low[1] - 3.25* TickSize, Color.Pink);



    if ((Diff[0]>DiffAvg[0] && Diff[1]<DiffAvg[1]) //cross of 1 and 5 sma's [diff(yellow); diffavg(cyan)]
    && (EMA(22)[0] >= SMA(89)[0]) //mc is above 89
    && (Diff[1] <= 0) //ST macd is below 0
    && (Stochastics(5, 3, 3).K[0] <= 40) //stochs is below 40
    && (LTMACD(5,25,170,25)[0] > 0)) //LT macd is above 0
    /// this is where i would like to have a condition of that diamond within the last 7 bars///
    DrawArrowUp(Time[
    0].ToString(), 0, Low[1] - 5.25* TickSize, Color.Lime);
    Last edited by duck_CA; 08-25-2008, 01:59 PM.

    #2
    What's the question?
    RayNinjaTrader Customer Service

    Comment


      #3
      lol... sorry, i'm trying to add the condition where the font is in "orange"

      Comment


        #4
        You could create a variable that stores the "CurrentBar" number of the last time you called DrawDiamond()...

        // Declare a variable outside of OnBarUpdate()...
        private int diamondBarNumber = 0;

        if (condition to draw diamond is true)
        {
        DrawDiamond();
        diamondBarNumber = CurrentBar;
        }

        if (diamonBarNumber != 0 && CurrentBar - diamondBarNumber >= 7)
        DrawArrowUp();
        RayNinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by TraderBCL, Today, 04:38 AM
        3 responses
        23 views
        0 likes
        Last Post NinjaTrader_Jesse  
        Started by WeyldFalcon, 08-07-2020, 06:13 AM
        11 responses
        1,423 views
        0 likes
        Last Post jculp
        by jculp
         
        Started by RubenCazorla, Today, 09:07 AM
        0 responses
        4 views
        0 likes
        Last Post RubenCazorla  
        Started by BarzTrading, Today, 07:25 AM
        2 responses
        29 views
        1 like
        Last Post BarzTrading  
        Started by devatechnologies, 04-14-2024, 02:58 PM
        3 responses
        21 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Working...
        X