Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

Code for drawing wicks in candlestyle.cs doesn' make any sense to me

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

    Code for drawing wicks in candlestyle.cs doesn' make any sense to me

    Hi !

    I am taking a look at the candlestyle code because I want to code my own style. I am looking at the "candle style" code . I understand the logic behind it. But I don't understand why the code I attach is a valid code for wicks. I see that the candles are drawn in an order : FIrst It draws the body , second the High wick and third the low wick. But as far as I understand, for the wicks the logic is "rare". Let's imagine it is drawing an up candle. The condition for drawing the upper wick will be if High >= Max (Open,close) . But the condition that is coded in the current cd file doesn't make any sense to me. It says that a wick is draw if high is below the minimun of the open,close. So in an upper candle, is High is less than the open. Doesn't make any sense to me

    Could someone, please, try to explain to me the logic bihind the current code ?

    Thanks

    #2
    Hello hbolorin,

    For this type of a question the general suggestion would be to make a copy of the script and add Prints into the logic where you are unsure. Using a Print you could output the relevant values at that time to better understand how that logic is used in a real use case.

    Because this is rendering logic the values used will be X/Y coordinates so if you are thinking that this should be related to prices that may be part of the confusion. If you print out the values for that condition you will see it is true and the values are being used to delegate using that logic for drawing:

    Code:
    if (high < Math.Min(open, close))
    {
    Print("high: " + high + " min: " + Math.Min(open, close));
    high: 87 min: 102
    high: 53 min: 67
    high: 33 min: 63
    high: 28 min: 53
    high: 92 min: 102
    high: 77 min: 102
    As far as answering the question of why this is valid, all I could really answer is that it is valid for the use case and depends on the values the condition sees when converting prices from the chart to pixels. If you wanted to get a deeper understanding of why the values are the way they are you would need to look at the open/high/low/close variables and their values in pixels after being converted.

    I look forward to being of further assistance.
    JesseNinjaTrader Customer Service

    Comment


      #3
      Hi !

      Thank you for the answer. Yes, my mistake was I thought in price levels ( price 0 is down ) instead of coordinates ( 0 coordinate is up ) . Once You answered me , my question has no sense amnd the code is logical.

      Thanks again

      Comment

      Latest Posts

      Collapse

      Topics Statistics Last Post
      Started by OllieFeraher, 05-09-2024, 11:14 AM
      6 responses
      18 views
      0 likes
      Last Post OllieFeraher  
      Started by PaulMohn, 05-02-2024, 06:59 PM
      2 responses
      42 views
      0 likes
      Last Post PaulMohn  
      Started by ETFVoyageur, Today, 02:10 AM
      0 responses
      10 views
      0 likes
      Last Post ETFVoyageur  
      Started by rayyyu12, Today, 12:47 AM
      0 responses
      8 views
      0 likes
      Last Post rayyyu12  
      Started by ETFVoyageur, 05-07-2024, 07:05 PM
      17 responses
      137 views
      0 likes
      Last Post ETFVoyageur  
      Working...
      X