• If this is your first visit, you will have to register before you can post. To view messages, please scroll below and select the forum that you would like to visits. Questions? Be sure to check out the Forum FAQ.

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 ATMtrader0001, Today, 01:48 PM
        1 response
        4 views
        0 likes
        Last Post NinjaTrader_PaulH  
        Started by RandanAL, Yesterday, 05:13 PM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Kate  
        Started by JustinCross, Today, 02:11 PM
        0 responses
        4 views
        0 likes
        Last Post JustinCross  
        Started by Uwe1981, Today, 03:41 AM
        3 responses
        22 views
        0 likes
        Last Post NinjaTrader_Kate  
        Started by maxie, Today, 11:43 AM
        1 response
        9 views
        0 likes
        Last Post NinjaTrader_Monica  
        Working...
        X