Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

DrawTriangle Up or Down not working properly

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

    DrawTriangle Up or Down not working properly

    i am back to square one with me programming and i need some help from an external perspective.

    My goal is to print triangles above and below every bar (the problem here is simplified just to illustrate). All i get are triangles on the last finished bar... all others older bars seem unmodified.

    My print check routines in the output window show the opposite. Thereafter all the bars should be modified (refer to attachment).

    Click image for larger version

Name:	ninja2.png
Views:	1
Size:	19.6 KB
ID:	891055

    This is the simplified code:
    -------------------------------------
    if (downtrend && returnbardown)
    {
    Print (Instrument.FullName.ToString()+ "MARKED DOWN--> Bar No. " + CurrentBar.ToString () + ">> O:" + Open.ToString() + ">> C:" + Close.ToString() + ">>H:" + High.ToString() + ">> L:" + Low.ToString());
    DrawTriangleUp("tryup",true, 0,Low[0] - TickSize * 12, downcolor);
    barup.Set(1); }
    else
    barup.Set(0);

    if (uptrend && returnbarup)
    {
    Print (Instrument.FullName.ToString()+ "MARKED UP--> Bar No. " + CurrentBar.ToString () + ">> O:" + Open.ToString() + ">> C:" + Close.ToString() + ">>H:" + High.ToString() + ">> L:" + Low.ToString());
    DrawTriangleDown("trydown",true,0,High[0] + TickSize * 12, upcolor);
    bardown.Set(1);}
    else
    bardown.Set(0);
    ------------------------------------------------------------------
    In the same indicator i modifiy the outline of candles. This works for the current and all older candles. I use the same programming for this and i cannot find out why this works in this case and in the above mentioned "triangle" case not??????

    This is the code for the candle modification working properly:
    --------------------------------------------------------------
    if (switch1 == false)
    {
    highinside = High[1];
    lowinside = Low[1];
    }
    if (Open[0] > Close[0])
    {
    BarColor = downcolor;
    CandleOutlineColor = outlinecolordown;
    }
    else
    {
    BarColor = upcolor;
    CandleOutlineColor = outlinecolorup;
    }

    insidebar.Set(1);
    switch1 = true;
    -------------------------------------------------------
    You can see the result here (see attachment):
    Click image for larger version

Name:	ninja1.png
Views:	1
Size:	46.6 KB
ID:	891054

    Please give me a hint, why the DrawTriangle Up and Down Function is not working properly???

    thanks christian

    #2
    You are re-drawing the same triangle so that the previous one disappears. Each triangle needs a unique name. Try adding the currentbar number to each triangle name:
    DrawTriangleUp("tryup" + CurrentBar, true, 0,Low[0] - TickSize * 12, downcolor);
    eDanny
    NinjaTrader Ecosystem Vendor - Integrity Traders

    Comment


      #3
      Thanks for the help eDanny!
      BertrandNinjaTrader Customer Service

      Comment


        #4
        that´s it.

        Thanks eDanny for your prompt support.

        Best regards
        christian

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by mattbsea, Today, 05:44 PM
        0 responses
        3 views
        0 likes
        Last Post mattbsea  
        Started by RideMe, 04-07-2024, 04:54 PM
        6 responses
        31 views
        0 likes
        Last Post RideMe
        by RideMe
         
        Started by tkaboris, Today, 05:13 PM
        0 responses
        2 views
        0 likes
        Last Post tkaboris  
        Started by GussJ, 03-04-2020, 03:11 PM
        16 responses
        3,282 views
        0 likes
        Last Post Leafcutter  
        Started by WHICKED, Today, 12:45 PM
        2 responses
        20 views
        0 likes
        Last Post WHICKED
        by WHICKED
         
        Working...
        X