Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to code condition about wick and tail?

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

    How to code condition about wick and tail?

    I am not a programmer, but I have adjusted a code template of a previously existing strategy code. I would like the strategy to take a trade on the third bar after HMAinflective and SmartThickness cross. I was able to get the strategy to do this. But I would like to add a condition to not take the trade if there is a wick or tail on that bar. Is there a way to do this?

    So the strategy would take a trade on the third bar after HMAinflective and SmartThickness cross UNLESS there is a wick or tail on on that third bar.

    Any advice?

    #2
    Hello defo1,

    Thanks for your post and welcome to the forums.

    I am assuming your definition of a wick is the line at the top of the candle regardless of being an up or down candle and a tail is the line below the candle regardless if it is an up or down candle. Based on that definition then you can perform these type checks:

    To check for a wick:
    In the case of an Up bar, if the High[0] is > Close[0]
    In the case of the Down bar, if the High[0] is > Open[0]

    To check for a tail:
    In the case of an Up bar, if the Low[0] is < Open[0]
    In the case of a Down bar, if the Low[0] is < Close[0]

    Comment


      #3
      Originally posted by defo1 View Post
      I am not a programmer, but I have adjusted a code template of a previously existing strategy code. I would like the strategy to take a trade on the third bar after HMAinflective and SmartThickness cross. I was able to get the strategy to do this. But I would like to add a condition to not take the trade if there is a wick or tail on that bar. Is there a way to do this?

      So the strategy would take a trade on the third bar after HMAinflective and SmartThickness cross UNLESS there is a wick or tail on on that third bar.

      Any advice?
      Code:
      bool HasNoWickOrTail = ((High[0] == Math.Max(Close[0], Open[0])) && (Low[0] == Math.Min(Close[0], Open[0])));
      
      if (EntryConditions && HasNoWickOrTail){//trade}
      where EntryConditions is your current code for entering. In other words you need to define the bool flag HasNoWickOrTail, and then add it to your current entry conditions as a gate.

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by Geovanny Suaza, 02-11-2026, 06:32 PM
      0 responses
      633 views
      0 likes
      Last Post Geovanny Suaza  
      Started by Geovanny Suaza, 02-11-2026, 05:51 PM
      0 responses
      364 views
      1 like
      Last Post Geovanny Suaza  
      Started by Mindset, 02-09-2026, 11:44 AM
      0 responses
      105 views
      0 likes
      Last Post Mindset
      by Mindset
       
      Started by Geovanny Suaza, 02-02-2026, 12:30 PM
      0 responses
      567 views
      1 like
      Last Post Geovanny Suaza  
      Started by RFrosty, 01-28-2026, 06:49 PM
      0 responses
      568 views
      1 like
      Last Post RFrosty
      by RFrosty
       
      Working...
      X