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 Gerik, Today, 09:40 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by RookieTrader, Today, 09:37 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Started by alifarahani, Today, 09:40 AM
        0 responses
        5 views
        0 likes
        Last Post alifarahani  
        Started by KennyK, 05-29-2017, 02:02 AM
        3 responses
        1,285 views
        0 likes
        Last Post NinjaTrader_Clayton  
        Started by AttiM, 02-14-2024, 05:20 PM
        11 responses
        186 views
        0 likes
        Last Post NinjaTrader_ChelseaB  
        Working...
        X