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 funk10101, Today, 12:02 AM
        1 response
        10 views
        0 likes
        Last Post NinjaTrader_LuisH  
        Started by GLFX005, Today, 03:23 AM
        1 response
        6 views
        0 likes
        Last Post NinjaTrader_Erick  
        Started by nandhumca, Yesterday, 03:41 PM
        1 response
        12 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by The_Sec, Yesterday, 03:37 PM
        1 response
        11 views
        0 likes
        Last Post NinjaTrader_Gaby  
        Started by vecnopus, Today, 06:15 AM
        0 responses
        1 view
        0 likes
        Last Post vecnopus  
        Working...
        X