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 RaddiFX, Yesterday, 09:55 PM
        3 responses
        25 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by geotrades1, Today, 08:33 AM
        2 responses
        9 views
        0 likes
        Last Post geotrades1  
        Started by samish18, 04-17-2024, 08:57 AM
        23 responses
        110 views
        0 likes
        Last Post NinjaTrader_BrandonH  
        Started by Orion815, Today, 08:39 AM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by dcriador, Today, 08:56 AM
        0 responses
        3 views
        0 likes
        Last Post dcriador  
        Working...
        X