Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Heiken Ashi 8 body outline color same as candle color on spinning tops

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

    Heiken Ashi 8 body outline color same as candle color on spinning tops

    i've been attempting to modify the HeikenAshi8 indicator by PaulH so that i can see what color the body of a tiny spinning top is - the idea is to outline the body same as the rectangle color when the candle body is less than a certain size in height...

    i added the necessary property for "dojiSize" - the size below which the body will outline the candle body color

    i used what i thought was the body outline code and placed a copy of it in each conditional routine beneath the Rectangle drawing conditions and above the body color brush disposal

    the code will compile but when i open the indicator dialogue to add it to the chart the program essentially locks up working on something as evidenced by the CPU usage in task manager - but won't finish and just keeps chunking some kinds of data

    I must have coded some kind of sticky loop but i'm not skilled enough to be able to understand and find the problems
    it may be that i'm not using DX brushes properly by putting another conditional draw before the up or down brush is disposed
    or something like returning out of the secondary condition nest
    if some help could be offered it would really be appreciated /thx
    here's my hack job:

    Code:
    SharpDX.Direct2D1.Brush shadowColordx = shadowColor.ToDxBrush(RenderTarget); // prepare for the color to use
    var xy2 = new Vector2(x, y2);
    var xy3 = new Vector2(x, y3);
    RenderTarget.DrawLine(xy2, xy3, shadowColordx, shadowWidth);
    
    if (y4 == y1)
    RenderTarget.DrawLine( new Vector2( x - barPaintWidth / 2, y1), new Vector2( x + barPaintWidth / 2, y1), shadowColordx, shadowWidth);
    else
    {
    if (y4 > y1)
    {
    SharpDX.Direct2D1.Brush barColorDowndx = barColorDown.ToDxBrush(RenderTarget); // prepare for the color to use /// Original Line 0
    RenderTarget.FillRectangle( new RectangleF(x - barPaintWidth / 2, y1, barPaintWidth, y4 - y1), barColorDowndx); /// Original Line 1
    
    if ( (y4-y1) < ( DojiSize * TickSize) ) /// ADDED TO OUTLINE SPINNING TOPS BAR WITH BAR COLOR FOR VISIBILITY
    {
    RenderTarget.DrawRectangle( new RectangleF( x - barPaintWidth / 2 + (float)shadowWidth / 2,
    Math.Min(y4, y1), barPaintWidth - (float)shadowWidth, Math.Abs(y4 - y1)), barColorDowndx, shadowWidth); /// ADDED FROM BELOW
    }
    barColorDowndx.Dispose(); /// Original Line 2
    }
    else
    {
    SharpDX.Direct2D1.Brush barColorUpdx = barColorUp.ToDxBrush(RenderTarget); // prepare for the color to use /// Original Line 0
    RenderTarget.FillRectangle( new RectangleF(x - barPaintWidth / 2, y4, barPaintWidth, y1 - y4),barColorUpdx); /// Original Line 1
    
    if ( (y1-y4) < ( DojiSize * TickSize ) ) /// ADDED TO OUTLINE SPINNING TOPS BAR WITH BAR COLOR FOR VISIBILITY
    {
    RenderTarget.DrawRectangle( new RectangleF( x - barPaintWidth / 2 + (float)shadowWidth / 2,
    Math.Min(y4, y1), barPaintWidth - (float)shadowWidth, Math.Abs(y4 - y1)), barColorUpdx, shadowWidth); /// ADDED FROM BELOW
    }
    
    barColorUpdx.Dispose(); /// Original Line 2
    }
    //// RenderTarget.DrawRectangle( new RectangleF( x - barPaintWidth / 2 + (float)shadowWidth / 2,
    //// Math.Min(y4, y1), barPaintWidth - (float)shadowWidth, Math.Abs(y4 - y1)), shadowColordx, shadowWidth);
    }
    shadowColordx.Dispose();

    #2
    Hello stafe,

    Thanks for the post.

    From the given information I don't see what would make the menu freeze, OnRender is only used once the item is being rendered on the chart. The menu would indicate a problem in OnStateChange or with a public property.

    With the details you gave I would guess that this relates to the property you made. From whats happening I could guess that you made a recursion or infinite loop, here is a quick example of what would cause that:

    Code:
    public int dojiSize
    {
       get { return dojiSize; }
       set { dojiSize = value; }
    }
    This property is getting its self causing a infinite loop, that would freeze the menu when opening it.

    If you made a property like that, try making it into a simple get set:

    Code:
    public int dojiSize { get; set; }
    If thats not the problem I would suggest to either try commenting out the changes you made and find where the specific problem starts or attach the .cs file so we can view the full context of the script.

    I look forward to being of further assistance.

    Comment


      #3
      that was the exact issue.... thanks !!

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      601 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      347 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      103 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      559 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      558 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X