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 PaulMohn, Today, 03:49 AM
        0 responses
        5 views
        0 likes
        Last Post PaulMohn  
        Started by inanazsocial, Today, 01:15 AM
        1 response
        8 views
        0 likes
        Last Post NinjaTrader_Jason  
        Started by rocketman7, Today, 02:12 AM
        0 responses
        10 views
        0 likes
        Last Post rocketman7  
        Started by dustydbayer, Today, 01:59 AM
        0 responses
        2 views
        0 likes
        Last Post dustydbayer  
        Started by trilliantrader, 04-18-2024, 08:16 AM
        5 responses
        23 views
        0 likes
        Last Post trilliantrader  
        Working...
        X