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 ScottWalsh, Today, 06:52 PM
        3 responses
        20 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by trilliantrader, Today, 03:01 PM
        2 responses
        19 views
        0 likes
        Last Post helpwanted  
        Started by cre8able, Today, 07:24 PM
        0 responses
        1 view
        0 likes
        Last Post cre8able  
        Started by Haiasi, Today, 06:53 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Started by ScottW, Today, 06:09 PM
        1 response
        7 views
        0 likes
        Last Post NinjaTrader_Manfred  
        Working...
        X