Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

How to put this on a strategy?

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

    How to put this on a strategy?

    Hi

    I need to calculate for every bar the difference beetween the longer tail and the smaller tail. I know I can say to the strategy "if the close of the bar is X ticks above the low, then..." But, how can I compare the lenght of the two tails?

    Thanks!

    #2
    Originally posted by marcopicos View Post
    Hi

    I need to calculate for every bar the difference beetween the longer tail and the smaller tail. I know I can say to the strategy "if the close of the bar is X ticks above the low, then..." But, how can I compare the lenght of the two tails?

    Thanks!
    psuedo code:

    if open of bar > close of bar
    then
    --it's red
    lower wick = close - low;
    upper wick = high - open;

    else
    --it's green or open=close
    lower wick = open - low;
    upper wick = high - close;
    end if;

    if lower wick > upper wick
    then
    difference = lower wick - upper wick;
    else
    difference = upper wick - lower wick;
    end if;

    you might want absolute value to avoid negative #s....

    *I'm still half asleep, but I think the logic is there.

    Comment


      #3
      ok, I see... thanks!

      Comment


        #4
        Hello Marcopicos,

        Thank you for your post and to Sledge for answering!

        Sledge's logic looks great and should get you what you are looking for.

        Also, for the absolute value use Math.Abs()

        Let me know if I can be of further assistance.
        Cal H.NinjaTrader Customer Service

        Comment

        Latest Posts

        Collapse

        Topics Statistics Last Post
        Started by Mindset, 04-21-2026, 06:46 AM
        0 responses
        116 views
        0 likes
        Last Post Mindset
        by Mindset
         
        Started by M4ndoo, 04-20-2026, 05:21 PM
        0 responses
        163 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by M4ndoo, 04-19-2026, 05:54 PM
        0 responses
        83 views
        0 likes
        Last Post M4ndoo
        by M4ndoo
         
        Started by cmoran13, 04-16-2026, 01:02 PM
        0 responses
        127 views
        0 likes
        Last Post cmoran13  
        Started by PaulMohn, 04-10-2026, 11:11 AM
        0 responses
        87 views
        0 likes
        Last Post PaulMohn  
        Working...
        X